gpt4 book ai didi

react-native - react native : Dismiss the keyboard and remain the focus in the TextInput

转载 作者:行者123 更新时间:2023-12-04 04:12:05 24 4
gpt4 key购买 nike

我已经尝试了所有方法,但是当我关闭键盘时,焦点也会模糊。但是当我想让用户将信息粘贴到 TextInput 时,我不愿意显示软键盘。

<TextInput
ref='barcodeInput'
style={{height: 60,borderColor: '#000000', borderWidth: 1, width:300, fontSize:30}}
underlineColorAndroid="transparent"
onChangeText={(text) => this.setState({inputBarcode:text})}
onSubmitEditing={this.handleSubmitEditing.bind(this)}
keyboardType = {'numeric'}
/>

最佳答案

您应该可以使用 Keyboard组件来自 react-native .例如:

import { Keyboard } from 'react-native'
Keyboard.dismiss()

焦点仍应保持在您的输入上,但软键盘将消失。

关于react-native - react native : Dismiss the keyboard and remain the focus in the TextInput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41697432/

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