效果图:
image.png
//键盘弹出事件响应
keyboardDidShowHandler(event) {
// this.setState({KeyboardShown: true});
console.log(event.endCoordinates.height);
this.setState({
keyboardTopHeight:30,
keyboardTopMarginTop:height - event.endCoordinates.height - 30,
})
}
//键盘隐藏事件响应
keyboardWillHideHandler(event) {
// this.setState({KeyboardShown: false});
this.setState({
keyboardTopHeight:0,
keyboardTopMarginTop:0,
})
}
//强制隐藏键盘
dissmissKeyboard() {
Keyboard.dismiss();
console.log("输入框当前焦点状态:" + this.refs.bottomInput.isFocused());
this.setState({
keyboardTopHeight:0,
keyboardTopMarginTop:0,
})
}
android有物理返回键 所以android用Platform过滤了