use*_*934 3 android react-native
关闭键盘或按其他地方后,如何摆脱文本输入中的光标?
这就是我对 TextInput 的全部内容:
<TextInput
style={styles.searchBar}
onChangeText={null}
placeholder={'What are you searching for?'}
underlineColorAndroid="transparent"
/>
Run Code Online (Sandbox Code Playgroud)
小智 5
我知道这个问题有点老了,但只是改进马丁的答案,你可以这样做:
componentDidMount(){
Keyboard.addListener('keyboardDidHide', this._forceLoseFocus);
}
<TextInput ref={(component) => this._textInput = component}/>
_forceLoseFocus = () => {
this._textInput.blur();
}
Run Code Online (Sandbox Code Playgroud)
经过测试并使用 React Native 0.55.4
归档时间: |
|
查看次数: |
3007 次 |
最近记录: |