question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
react-native-botcommented, Feb 24, 2018

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

2reactions
DeforeChencommented, May 4, 2018

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 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

onSubmitEditing not working on TextInput when Multiline ...
Since multiline requires Return key to jump to the next line. This info is explicitly stated in the React Native TextInput docs page....
Read more >
TextInput - React Native
A foundational component for inputting text into the app via a keyboard. Props provide configurability for several features, ...
Read more >
textinput multiple line react native Code Example - Code Grepper
Style prop: (React native TextInput) textAlignVertical: 'top';
Read more >
Android onSubmitEditing - Expo Snack
import { Text, TextInput, View, StyleSheet. } from 'react-native';. import { Constants } from 'expo';. export default class App extends Component.
Read more >
Android – React Native multi line TextInput, text is centered
So when using, text input with multiline=true, I have this issue where the text ... For more info try https://github.com/facebook/react-native/issues/13897 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found