Reputation: 3032
I'm new to react-native. I'm using numeric keyboard type:
<TextInput style={styles.TextInputSecond} editable = {true} maxLength={3} keyboardType="numeric" ></TextInput>
It is showing .
and -
also on the keyboard.
How can I hide or disable (as ,
disabled) them from the keyboard?
Upvotes: 1
Views: 823
Reputation: 516
Can you try this and check if it resolve your issue
keyboardType={Device.isAndroid ? "numeric" : "number-pad"}
or you can also Add
const onlyNumber = number.replace(/[^0-9]/g, "");
this.setState({
onlyNumber
});
TextInput's prop value
value={this.state.onlyNumber}
Upvotes: 2