returnKeyType = “next” issue in react native

江枫思渺然 提交于 2019-12-01 23:03:33

问题


I am using returnKeyType = "next" in TextInput component, but it is working like returnKeyType="go" instead of moving to the next textinput field.

How can we move from one textinput field to next textinput field using the "next" button on the keyboard?


回答1:


You need to set focus on the next textfield using the reference like this:

<View style={{flex:1}}>
    <TextInput style={{height:40}} 
        placeholder="First TextField Input"
        placeholderTextColor="#DCDCDC"
        returnKeyType="next"
        onSubmitEditing={()=>this.secondTextInput.focus()}/>
    <TextInput style={{height:40}} 
        placeholder="Second TextField Input"
        placeholderTextColor="#DCDCDC"
        returnKeyType="go"
        ref={(input)=>this.secondTextInput = input}/> 
</View>


来源:https://stackoverflow.com/questions/48301596/returnkeytype-next-issue-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!