onSubmitEditing not working on TextInput when Multiline={true} in React Native(android)
See original GitHub issueIs this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS High Sierra 10.13.2 Node: 7.10.1 Yarn: Not Found npm: 4.2.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.0.0-alpha.12 => 16.0.0-alpha.12 react-native: https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz => 0.48.4
Steps to Reproduce
On iOS there is no problem, but on Android when I have multiline TextInput, onSubmitEditing doesn’t seem to work. User types some symbols in input and when pressing return key I am expecting to stop typing option, save already typed symbols, but instead new line appears below and user continues to type.
<TextInput
multiline
onSubmitEditing={text => this.saveCurrentValues()}
/>
Expected Behavior
When ‘return’ key is pressed TextInput shouldn’t break and on new line. Like it is on iOS, it should listen to onSubmitEditing()
Actual Behavior
When ‘return’ key is pressed there shouldn’t be a new line.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?
I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.
How to Contribute • What to Expect from Maintainers
If the blurOnSubmit is set to true, although the onSubmitEditing would be called instead of inserting a new line, the keyboard would also dismiss at the same time. I do not want the keyboard be hidden when submit function fired, any way to solve this ?