Skip to content
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

onSubmitEditing not working on TextInput when Multiline={true} in React Native(android) #17825

Closed
nikasvan opened this issue Feb 1, 2018 · 6 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@nikasvan
Copy link

nikasvan commented Feb 1, 2018

Is 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.

@rajivshah3
Copy link
Contributor

Try this: https://facebook.github.io/react-native/docs/textinput.html#bluronsubmit
The blurOnSubmit prop works differently on multiline fields

@SuhairZain
Copy link
Contributor

@rajivshah3 I believe that @nikasvan expects the exact same thing as given in the doc, that it will not insert a new line and instead call onSubmitEditing. But it doesn't happen, which is why he opened this issue. I'm also having this issue.

@react-native-bot
Copy link
Collaborator

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 ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon. labels Feb 24, 2018
@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 24, 2018
@salmanwaheed
Copy link

salmanwaheed commented Feb 24, 2018 via email

@DeforeChen
Copy link

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 ?

@GitHubTracey
Copy link

I am experiencing the exact same as @DeforeChen. I have some inputs where I need to allow the user to be able to type multiple lines (with word wrap), but not allow them to actually enter a new line. It is especially weird behaviour when you are trying just go to the next field, and instead, it adds a new line, and then goes to the next field... so you can get multiple new lines in fields where you don't expect any.. I can clear after, but that's not a smooth experience for the user.

@facebook facebook locked as resolved and limited conversation to collaborators Feb 24, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants