问题描述
我正在使用带有“十进制”键盘的输入组件。不幸的是,这个键盘没有关闭自己的按钮。 我的解决方法是在右侧显示一个带有适当操作的图标。但是,这可用性很差。
<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>
解决方法
您只需要更改returnKeyType="done"
returnKeyType 确定返回键的外观。
以下值适用于跨平台:
done
go
next
search
send
这些值只是外观。
因此,在您的情况下,next
有效,但它看起来像一个向右箭头。