Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6290

How to set minimum and maximum number in TextInput in React Native?

$
0
0

I want to give a min value of 0 and a max value of 100, In between those values user can type, otherwise in between user cannot type. I tried validating the data when the onTextChanged events trigger but the UI is re-rendered giving the effect I don't want. I want the same result as when I use the maxLength prop. When the user enters 98, I don't allow them to enter more characters (eg: 988) and then validate and reset the old state => 98. I want to check that when the value is 98, the user cannot enter more characters which means maxLength = 2.

What's the solution for this issue? I appreciate your help!


Viewing all articles
Browse latest Browse all 6290

Trending Articles