如何使用 React Native 以编程方式为 TextInput 显示键盘?使用 ScrollView,在 TextInput 之间点击会导致键盘消失。我想使用 TextInput 的 onFocus 方法再次显示键盘。无论如何要完成这个?
最佳答案
考虑引用您的 textInput :
<TextInput ref={(ref)=>{this.myTextInput = ref}} />
当你必须再次聚焦它时使用:this.myTextInput.focus()
编辑 React16
对于 react16,使用 React.createRef
创建引用。
关于ios - 使用 React native 以编程方式显示键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38992297/