[React Native]隐藏文本输入默认键盘
[React Native]Hide Text Input default Keyboard
我已经为我的应用程序创建了一个自定义的本机键盘组件。现在我想渲染那个键盘而不是默认键盘。我怎样才能做到这一点?
我试过了
<TextInput
value={clientDetails.city}
onFocus={() => onFocus('city')}
onChangeText={value => onStateChange('city', value)}
placeholderTextColor={colors.placeholderColor}
placeholder={
constants.sellerClosingCosts.clientDetailsCityPlaceholder
}
onEndEditing={event =>
onEndEditing('city', event.nativeEvent.text)
}
style={styles.textInput}
/>
但即使我没有为 keyboardType 传递任何属性值,默认值也会打开。
简而言之
如何在编辑文本输入时停止键盘渲染?
为您的 TextInput 设置 showSoftInputOnFocus false。这会禁用设备键盘,但 onFocus 事件仍会继续监听,您可以在那里调用键盘。
<TextInput
showSoftInputOnFocus={false}
onFocus={() => <CALL_YOUR_KEYBOARD>}
/>
我已经为我的应用程序创建了一个自定义的本机键盘组件。现在我想渲染那个键盘而不是默认键盘。我怎样才能做到这一点? 我试过了
<TextInput
value={clientDetails.city}
onFocus={() => onFocus('city')}
onChangeText={value => onStateChange('city', value)}
placeholderTextColor={colors.placeholderColor}
placeholder={
constants.sellerClosingCosts.clientDetailsCityPlaceholder
}
onEndEditing={event =>
onEndEditing('city', event.nativeEvent.text)
}
style={styles.textInput}
/>
但即使我没有为 keyboardType 传递任何属性值,默认值也会打开。
简而言之
如何在编辑文本输入时停止键盘渲染?
为您的 TextInput 设置 showSoftInputOnFocus false。这会禁用设备键盘,但 onFocus 事件仍会继续监听,您可以在那里调用键盘。
<TextInput
showSoftInputOnFocus={false}
onFocus={() => <CALL_YOUR_KEYBOARD>}
/>