eduardoborges / use-mask-input

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

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

Open levipadre opened 3 months ago

levipadre commented 3 months 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 months ago

Up!