returnKeyType ="next";反应本地问题 [英] returnKeyType = "next" issue in react native

查看:92
本文介绍了returnKeyType ="next";反应本地问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在TextInput组件中使用了 returnKeyType ="next" ,但是它的作用类似于 returnKeyType ="go" ,而不是移至下一个textinput字段.

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?

推荐答案

您需要使用像这样的引用将焦点放在下一个文本字段上:

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>

这篇关于returnKeyType ="next";反应本地问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆