reactNative TextInput数字键盘在Android上无法正确显示

man*_*urt 5 keyboard android ios react-native

我正在使用

文字输入

keyboardType =“数字键盘”

在iOS上运行正常,但在Android上显示普通键盘,如何使android显示数字键盘,并隐藏“建议”栏

屏幕截图手机 左侧的iOS正确显示,右侧的android仿真器显示错误的键盘。

<TextInput
    ref="second"
    style={this.state.pos > 0 ? styles.textInputStyle : 
    styles.textInputNormalStyle}
    keyboardType = "number-pad"
    maxLength={1}
    value={this.state.secondVal}
    onKeyPress={(event) => {this.onChange(1, event.nativeEvent.key); }}
Run Code Online (Sandbox Code Playgroud)

/>

Pri*_*dya 8

根据文档,您需要提供keyboardType作为phone-pad

number-pad仅适用于IOS

对于隐藏的酒吧尝试 autoCorrect={false}

编辑

根据最新文档number-pad,已添加了跨平台支持

  • 0.56在数字键盘上添加了跨平台支持。但是旧的0.55版本没有https://facebook.github.io/react-native/docs/0.55/textinput#keyboardtype (3认同)