我使用的是带有“十进制”键盘的输入组件。不幸的是,这个键盘没有按钮来关闭自己。我的解决办法是在右侧显示一个图标,并在其上执行适当的操作。然而,这是不好的可用性。
解决这个问题的最好方法是什么?
<Input
ref={purchasePriceInput}
placeholder="Enter purchase price"
returnKeyType={'next'}
keyboardType = 'decimal-pad'
onChangeText={value => setPurchasePrice(value)}
label={'Purchase Price'}
labelStyle={styles.label}
rightIcon={<Icon
name='check'
type='font-awesome-5'
color='gray'
onPress={()=>{purchasePriceInput.current.blur()}} //<-- my workaround
/>}
>
{purchasePrice.toLocaleString()}
</Input>发布于 2020-12-22 14:46:30
您只需要更改returnKeyType="done"
returnKeyType确定返回键的外观。
以下值跨平台工作:
donegonextsearchsend这些值只是外观。
因此,在您的例子中,next工作,但它看起来像一个正确的箭头。
https://stackoverflow.com/questions/65406045
复制相似问题