Reputation: 2607
In Tablet, Kiosk devices (android).
My code:
<TextInput
keyboardType="numeric"/>
And keyboard show number within operator. How to avoid those operator?
Upvotes: 0
Views: 790
Reputation: 16334
As Gabe mentioned the Keyboard is not under the control of the app so you cant change the way it looks.
Assuming that you are using a TextInput you can use the onChangeText function to decide whether to update the state or not based on what the user inputs. The below code only takes in the numbers from a textinput.
handleTextChange = (text) => {
var cleanedString = '';
for (let i = 0; i < text.length; i++)
{
if (!isNaN(text[i])) {
cleanedString = cleanedString + text[i];
}
}
this.setState({ number : cleanedString });
};
Upvotes: 0
Reputation: 93561
In android, the keyboard is its own application. It decides what's shown in a given mode, and you have no control over it. The most you can do is give it a hint in the type, but the exact layout is the keyboard's final decision.
Also remember that on Android, the user can choose any keyboard program he wants. Not all keyboards will show the same set of keys for the same type- its whatever the keyboard app itself decides is appropriate.
If you really, really want to control it you can write your own keyboard, make it the default input method, and lock down the tablet since its a kiosk. But I really wouldn't suggest it.
Upvotes: 1