简体   繁体   English

React Native TextInput手机键盘提交?

[英]React Native TextInput phone keyboard submit?

In React Native when using the keyboard, once a user hits return to submit text to signify they are done typing something in the input, how would I call a function from the keyboard return event touch? 在使用键盘的React Native中,一旦用户点击返回提交文本以表示他们已完成在输入中键入内容,我将如何从键盘返回事件触摸调用函数?

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>
    );
  }

You should call the onSubmitEditing function. 你应该调用onSubmitEditing函数。

myFunction() {
  // do something
}

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM