onSubmitEditing在Android React-native上不起作用

时间:2017-06-15 21:17:07

标签: react-native redux-form textinput

我使用redux-form并拥有以下代码:

<Field name='email' placeholder='abc@gmail.com' title='Email'
 keyboardType={'email-address'} autoFocus={false} component={reduxFormTextInput}
 onSubmitEditing={() => this.moveFocus()}/>

reduxFormInput只是来自react-native-elements的FormInput组件。

moveFocus函数是一个控制台语句:

  moveFocus () {
    console.log('ZZZZZZZ')
  }

然而,在textInput上点击返回键时,唯一发生的事情是键盘关闭。没有控制台语句被执行。

1 个答案:

答案 0 :(得分:0)

第一次点击你的键盘是为了让键盘关闭,所以让键盘保持不变。

点击

 keyboardShouldPersistTaps="always"
内容标记中的

<Content Style={{
                  paddingBottom:0,
                  backgroundColor: 'white'
                }}
                keyboardShouldPersistTaps="always">

    </Content>

现在键盘将持续存在,控制台语句将被执行。