当React Native中的Multiline = {true}时,onSubmitEditing无法处理TextInput(android)

时间:2018-02-01 16:25:47

标签: javascript reactjs react-native react-native-android

在iOS上没有问题,但在Android上我有多行TextInput时,onSubmitEditing似乎无法正常工作。用户在输入中键入一些符号,当按下返回键时,我希望停止输入选项,保存已输入的符号,但是下面会出现新行,用户继续输入。

<TextInput
  multiline
  onSubmitEditing={text => this.saveCurrentValues()}
/>

1 个答案:

答案 0 :(得分:0)

If the Textinput's Multiline is set to true, onSubmitEditing prop won't work. Since multiline requires Return key to jump to the next line. This info is explicitly stated in the React Native TextInput docs page.