gpt4 book ai didi

reactjs - 按下按钮 : Hide keyboard in react-native

转载 作者:行者123 更新时间:2023-12-03 13:57:57 37 4
gpt4 key购买 nike

我有这个simple screen

当我按下按钮时,键盘仍然出现,我该怎么做:“按下按钮时:隐藏键盘”?

here is my code for button

        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>

最佳答案

试试这个

import { Keyboard } from 'react-native'; 

Keyboard.dismiss()//Call where ever you needed

文档 here

关于reactjs - 按下按钮 : Hide keyboard in react-native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51609210/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com