软键盘消失,焦点依然还在textInput中导致需要点击两次按钮,监听软键盘的消失方法,然后在消失方法里面,再一次调用软键盘消失方法
const dismissKeyboard = require('dismissKeyboard'); //引入
componentWillMount () {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
}
componentWillUnmount() {
this.keyboardDidShowListener.remove();
this.keyboardDidHideListener.remove();
}
_keyboardDidShow () {
}
_keyboardDidHide () {
dismissKeyboard();
}