【发布时间】:2019-07-04 08:59:08
【问题描述】:
我为我的键盘添加了一个监听器,这样当它出现时我可以做一些事情,
首先我尝试了keyboardDidShow,它起作用了,但我希望在键盘出现之前触发我的功能,所以根据react native doc,我将其更改为keyboardWillShow。现在它根本不起作用!
componentDidMount() {
this.keyboardWillShowListener = Keyboard.addListener(
'keyboardWillShow',
()=> this.setState({keyboard_open: true})
);
}
我错过了什么吗?
【问题讨论】:
标签: javascript react-native keyboard