eduardoborges / use-mask-input

✏️ A react Hook for build elegant input masks. Compatible with React Hook Form
https://npmjs.com/package/use-mask-input
265 stars 13 forks source link

How to remove without the cursor jumping to the end? #89

Open levipadre opened 1 month ago

levipadre commented 1 month ago

Hi, thank you for the great plugin!

I'm trying the following:

<Form.Control
    id='sortCode'
    type='text'
    {...registerWithMask('sortCode', ['99-99-99'], {
        required: true,
        jitMasking: true,
        autoUnmask: true,
    })}
    isInvalid={!!errors.sortCode}
    isValid={touchedFields.sortCode && !errors.sortCode}
    required
    onInput={() => trigger('sortCode')}
/>

After I have all the numbers in place and try to remove the first number, for example, it jumps to the end. Can I avoid that somehow?

viniciusbezvieira commented 3 weeks ago

Up!