我有这个simple screen
当我按下按钮时,键盘仍然会出现:“如何按下按钮:隐藏键盘”?
这是我的按钮代码
manage = () => {
const { navigate } = this.props.navigation;
if (this.state.text.length === 10) {
navigate('service',{text: this.state.text});
} else {
Alert.alert('الرجاء ادخال الرقم الوطني المكون من 10 أرقام')
}
}
<Button title='التالي'
backgroundColor="#C1272D"
onPress={this.manage}>
</Button>
答案 0 :(得分:5)
尝试
import { Keyboard } from 'react-native';
Keyboard.dismiss()//Call where ever you needed
文档https://developer.android.com/about/versions/oreo/background#broadcasts