Open SpadarShut opened 1 year ago
Sandbox: https://codesandbox.io/s/react-input-mask-react-hook-form-bug-forked-wxrp98?file=/src/App.js
Steps to reproduce:
Expected result: Last character is removed
Actual result: The string is mangled: from +1 559-386-2345 to (153) 823-4
+1 559-386-2345
(153) 823-4
The code
import { useMask } from "@react-input/mask"; export default function App() { const maskRef = useMask({ mask: "(___) ___-____", replacement: { _: /\d/ } }); return ( <form> <input defaultValue="+1 559-386-2345" ref={maskRef} type="text" /> </form> ); }
I am also experiencing the same issue. Have you found any solution for this?
@matrixmandeep It seems I ended up preparing the initial value to be valid.
Sandbox: https://codesandbox.io/s/react-input-mask-react-hook-form-bug-forked-wxrp98?file=/src/App.js
Steps to reproduce:
Expected result: Last character is removed
Actual result: The string is mangled: from
+1 559-386-2345
to(153) 823-4
The code