Skip to content

TextInput text is undefined on blur in android #20771

Closed
@dmoss18

Description

@dmoss18

Environment

Environment:
OS: macOS High Sierra 10.13.6
Node: 10.3.0
Yarn: 1.9.2
npm: 6.1.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
react: ^16.4.1 => 16.4.1
react-native: 0.55.4 => 0.55.4

Description

I have an onBlur handler for a TextInput that should pass in the text via the nativeEvent. However, the text is always undefined on android. It works on iOS.

handleBlur = (event: NativeSyntheticEvent<TextInputFocusEventData>) => {
  console.log(event.nativeEvent.text)
}

render() {
  return (
    <TextInput onBlur={this.handleBlur} value="Test" />
  )
}

Reproducible Demo

https://snack.expo.io/By6uT3F87

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions