Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reactNative TextInput number-pad not showing properly on android

Im using

TextInput

with

keyboardType = "number-pad"

On iOS it works fine, but on Android it shows normal keyboard, how do I make android show the number-pad keyboard, and hide the "suggest" bar

screenshot mobiles On the left the iOS showing correctly, on the right the android emulator showing wrong keyboard.

<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); }}

/>

like image 971
manuelBetancurt Avatar asked Apr 10 '18 05:04

manuelBetancurt


1 Answers

As per the docs, you need to supply keyboardType as phone-pad.

number-pad is only for IOS

For hiding the bar try autoCorrect={false}

Edit

As per the latest docs number-pad has been added for cross-platform support

like image 188
Pritish Vaidya Avatar answered Nov 20 '22 14:11

Pritish Vaidya