Reply to this post?

In React Native, when using the keyboard, when the user presses return to send text to indicate that they typed something at the input, how would I call a function from the keyboard return event?

returnKeyboardClick(){
    //how to call this when user clicks return on keyboard?
}
render(){
    return (
      <View style={styles.container}>
          <TextInput
            style={styles.input}
            onChangeText={this.inputTextEnter}
            placeholder='Type Here'
            placeholderTextColor='#000'
            keyboardType='default'
          />
      </View>
    );
  }
+4
source share
1 answer

You must call the onSubmitEditing function .

myFunction() {
  // do something
}

<TextInput onSubmitEditing={ () => this.myFunction() } />
+7
source

Source: https://habr.com/ru/post/1623045/


All Articles