'How to input two or more data types in "setInputTypeAuto"?

How to input two or more data types in setInputTypeAuto? I've used | and || but an error appears.

setInputTypeAuto(InputNewView.TYPE.EMAIL | InputNewView.TYPE.NUMBER)


Solution 1:[1]

You shouldn't. A text field can have a single type. Even if you combine them like that, the keyboard won't recognize it. It'll end up picking one or the other, most likely whichever it tests for first.

Please not that the input type of a field has no effect on your app. What it does is hint to the keyboard, which is a totally separate app, about what type of data you'll be inputting. It uses that to optimize its layout and behavior. But it's not a contract- different keyboards will interpret it differently, and do different things. It won't put a filter controlling what can be typed in, like some people think. So you're better off keeping things simple, because anything non standard is going to be interpreted in different ways by every different keyboard app.

Also, no idea what setInputTypeAuto is doing- the function is setInputType.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gabe Sechan