-
Notifications
You must be signed in to change notification settings - Fork 24k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ANDROID][BUGFIX][TextInput] - Fixed line not breaking when multiline set to true and keyboard type set to numeric (or other numeric type) #21884
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an e2e test for this?
Sure, this week I'm a little busy with the exams coming, so I'll only be able to look into this after wednesday |
@Muritavo, thanks for the PR! One question: Are you sure that this is sufficient to fix the bug? If you replace <TextInput
multiline={true}
keyboardType="numeric"
style={styles.input}
placeholder="some really really really really really really long text"
/> Do you think that's a different problem? I'm asking because maybe there's a better solution that fixes both cases. |
It would be awesome to have this working, great job @Muritavo . I hope this is merged soon :P Need it so bad haha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Murilo Araujo merged commit 28f1648 into |
…e set to numeric (or other numeric type) (facebook#21884) Summary: Native Android sets the EditText widget to multiline only if the InputType flags are set to Text (or its variants like textEmailAddress) and Multiline, which causes the React Native TextInput to not break the line when set to multiline={true} and keyboardType={'numeric'} as it only have the flags Multiline and Number set. This fix forces the widget to enable multiline, by calling setSingleLine(false) everytime a state change needs to be commited and the multiline prop is set to true. Pull Request resolved: facebook#21884 Differential Revision: D14162701 Pulled By: cpojer fbshipit-source-id: b7d3fc8c5a4444dcfd29ad74d515a8ae486c7ede
Native Android sets the EditText widget to multiline only if the InputType flags are set to Text (or its variants like textEmailAddress) and Multiline, which causes the React Native TextInput to not break the line when set to multiline={true} and keyboardType={'numeric'} as it only have the flags Multiline and Number set.
This fix forces the widget to enable multiline, by calling setSingleLine(false) everytime a state change needs to be commited and the multiline prop is set to true.
Test Plan:
This bug only occurs on Android devices
Input some text until it reaches the end of the component
See as you keep input more data, the line doesn't break
The test plan can be reproduced HERE
Release Notes:
[ANDROID] [BUGFIX] [TextInput] - Fixed line not breaking when multiline set to true and keyboard type set to numeric (or other numeric type)