我正在构建一个反应本机应用程序,我对此相当新.我正在使用React导航从一个页面移动到另一个页面.目前,我正在使用堆栈导航器.
我有两个屏幕,A和B.在屏幕BI中有一个使用键盘的搜索输入.当键盘打开时按下标题中的后退按钮时,我导航到屏幕A,但在键盘解除之前有一个明显的延迟.我已经把Keyboard.dismiss(); 屏幕B中的componentWillUnmount和屏幕A中的componentWillMount.不确定是否可以将onClick事件添加到后退按钮,因为我相信它在标题组件中.
export default class Locations extends Component {
static navigationOptions = {
title: 'Search Location',
}
renderHeader = () => {
return <SearchBar onChangeText={(text) =>this.handleSearch(text)}
placeholder="Type Here..." lightTheme round />;
}
componentWillUnmount(){
Keyboard.dismiss();
}
Run Code Online (Sandbox Code Playgroud)
以前有人有过这个问题吗?