react native textinput min number max nuber
const onCheckLimit = (value: string) => {
const parsedQty = Number.parseInt(value)
if (Number.isNaN(parsedQty)) {
setQuantity(0) //setter for state
} else if (parsedQty > 10) {
setQuantity(10)
} else {
setQuantity(parsedQty)
}
}
/* React Wrapper */
<Input
value={quantity}
onChangeText={onCheckLimit}
otherProps
/>
/*React Wrapper*/
If the value passed is higher than the limit,
it will set the value to the limit. Otherwise, simply set the value that the user entered