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.

[Android] onSubmitEditing not happening when blurOnSubmit is false

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

OS:  macOS Sierra 10.12.3
Node:  8.6.0
Yarn:  0.27.5
npm:  5.3.0
Watchman:  4.7.0
Xcode:  Xcode 8.3.2 Build version 8E2002
Android Studio:  2.3 AI-162.4069837

Packages: (wanted => installed)

react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: 0.48.4 => 0.48.4

Target Platform

Android

compileSdkVersion 23
buildToolsVersion "25.0.0"
minSdkVersion 16
targetSdkVersion 23

Steps to Reproduce

(Write your steps here:)

  1. Make the TextInput maintain focus when pressing the submit button on Android
  2. Add onSubmitEditing={this.submit} and blurOnSubmit={false}
  3. The this.submit method never gets called

Expected Behavior

The submit method should be called

Actual Behavior

The submit method does not call. If I remove the blurOnSubmit={false} or set it to true, the method calls as expected.

Code example

class Input extends Component {
  submit() {
    console.log('Submitting');
  }
  render() {
    return (
      <TextInput
        editable={true}
        keyboardType='phone-pad'
        onSubmitEditing={this.submit}
        blurOnSubmit={false}
        returnKeyType="next"
      />
    )
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
Kosai106commented, Oct 16, 2017

Can confirm this is also the case on 0.49.3.

2reactions
davidhellsingcommented, Oct 11, 2017

@kelset Sorry, I was too quick! Yes, the method does call when removing the blurOnSubmit property (or setting it to false) so the linking is not the problem.

I noticed this after upgrading React & React Native, and also some target SDKs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

textinput text not submitting using onsubmitEditing using ...
you have to pass text from submit event to the function, <TextInput onSubmitEditing={(event) => this.onSubmit(event.nativeEvent.text)} />.
Read more >
TextInput · React Native
If true, the text input can be multiple lines. The default value is false. Type, Required. bool, No. onBlur.
Read more >
TextInput - React Native
The default value is true for single-line fields and false for multiline fields. Note that for multiline fields, setting blurOnSubmit to true ...
Read more >
React Native Keyboard Avoiding View and Request Focus
This is an Example of Request Focus and Keyboard Avoiding View in React Native. While working with TextInput in native app development..
Read more >
React Native Text Input Component - GeeksforGeeks
In the default case, it will be false,; blurOnSubmit: It is used to blur the ... It will not allow users to edit...
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