簡體   English   中英

沒有點和逗號的 React-Native TextInput 數字鍵盤

[英]React-Native TextInput numeric keyboard without dot and comma

我需要在我的應用程序上使用數字鍵盤,但在某些智能手機中,數字鍵盤沒有逗號或點,有什么解決方法嗎? 或其他一些事情來避免它?

代碼:我使用的是 Native-Base,但即使沒有它,結果也是一樣的

class CampoFloat extends Component {
    render() {
        const { ...props } = this.props;
        return (
            <View>
                <Item floatingLabel style={styles.Item}>
                    <Label style={{
                        color: '#323232',
                        fontSize: 18,
                        marginTop: 5
                    }}>{this.props.titulo}</Label>
                    <Input
                        style={styles.input}
                        {...props}
                    />
                </Item>
            </View>
        );
    }
}

<CampoFloat
     titulo="Preço do produto:"
     autoCorrect={false}
     keyboardType="numeric"
     onChangeText={(event) => this.setState({ preco: event })}
/>

示例

它是工廠的默認鍵盤,您應該使用 Google Gboard,無需編碼即可使用。

根據 Facebook 文檔 ReactNative 有適用於 Android 的鍵盤類型,因此請嘗試使用

<TextInput
  key={phone ? 'input-phone' : 'input-default'}
  keyboardType={phone ? 'phone-pad' : 'default'}
/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM