Consistent rows
/numberOfLines
prop on both Android and iOS
#731
chrispader
started this conversation in
Ideas
Replies: 1 comment 8 replies
-
As stated, the two existing props have different behaviors across platforms.
On top of those practical things, changing the existent behavior of existing props is a huge breaking change. It will not only break MEta code, but every other app that uses those properties expecting the current behavior. Personally, I'm okay with a flow like this:
Disclaimer: I will not have capacity to follow this effort. Somebody else @ Meta should champion this. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature Request
The
rows
/numberOfLines
prop on theTextInput
component is currently only available on Android. @Szymon20000 has been working on a PR that adds this prop on iOS and provides a consistent approach on how this prop affects theTextInput
.At the moment, on iOS there is no way to explicitly set a
TextInput
to a specific number of lines without manually setting the actualheight
in style. Creating aTextInput
which should have a specific number of lines is therefore only possible, by somehow calculating the line height by font size, spacing, etc....Problems
The
rows
/numberOfLines
props currently behave different on Android/Web and between different architectures as described in this comment.Additionally, there are two props for the same use-case:
rows
andnumberOfLines
. We should reduce these to only one proprows
. There already is an ongoing discussion about replacingnumberOfLines
withrows
completely: facebook/react-native#35703 (comment)Proposal
On all platforms, we want to have 2 props:
rows
: Sets the fixed number of rows on aTextInput
.TextInput
will always have these number of lines even if the content is lessrows
is higher thanmaxRows
, it will be capped to the defined maximummaxRows
: Sets the maximum number of rows/lines up to which aTextInput
can grow.rows
is not set, theTextInput
will start with only 1 row and can grow up to the maximum number of rowsrows
is set, theTextInput
will always have the defined rows.Note
I'm ignoring
numberOfLines
/maxNumberOfLines
props, as we want to remove them anywayIn this comment @necolas also stated that we'll want to unify this prop on all platforms at some point.
Internal testing
@cipolleschi mentioned here that this change will affect internal (screenshot) testing. I think in order to achieve this interface, we'll eventually want to update the internal tests. Up to this point though, we can also instead name these props
displayedRows
andmaxDisplayedRows
, to prevent internal tests from failing.What's next?
@Szymon20000 has already implemented this on iOS and also improved the Android code. We'll want to continue reviews on the first (iOS) PR and possibly split it up even more (between Fabric and Paper?).
friendly bump @Szymon2000 @roryabraham @cipolleschi @necolas
Beta Was this translation helpful? Give feedback.
All reactions