I need to have a React Native TextInput
component that will only allow numeric characters (0 - 9) to be entered. I can set the keyboardType
to
React Native TextInput provides keyboardType props with following possible values : default number-pad decimal-pad numeric email-address phone-pad
so for your case you can use keyboardType='number-pad' for accepting only numbers. This doesn't include '.'
so,
this.onChanged(text)}
value = {this.state.myNumber}
/>
is what you have to use in your case.
for more details please refer the official doc link for TextInput : https://facebook.github.io/react-native/docs/textinput#keyboardtype