How do I add a mask to TextInput in React Native using React Hook Form?

Viewed 52

I'm trying to add a mask in user height input, I know how I should use this in ReactJS but I have no idea how to use it in React Native + React Hook Form.

Anyone can help me with this? I don't want to use an external lib to control my input.

My code:

<InputForm
    control={control}
    name="height"
    label="Altura *"
    placeholder="1,67"
    error={errors.height && errors.height.message}
    keyboardType="numeric"
    maxLength={3}
/>

This is the regex I'm trying to use: ^(0|[1-9]\d*)(,\d+)?$

0 Answers
Related