您必须
import { Keyboard } from "react-native";
并向其添加侦听器。每当键盘打开时,隐藏页脚。
类似:
componentDidMount () {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
}
componentWillUnmount () {
this.keyboardDidShowListener.remove();
this.keyboardDidHideListener.remove();
}
_keyboardDidShow () {
// change the state of showFooter to false
}
_keyboardDidHide () {
// change the state of showFooter to true
}
查看键盘文档