returnKeyType = “next” issue in react native

前端 未结 1 422
逝去的感伤
逝去的感伤 2021-01-12 15:14

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

相关标签:
1条回答
  • 2021-01-12 15:39

    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>
    
    0 讨论(0)
提交回复
热议问题