We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After connecting use-mask-input, using controlled input (passing value/onChange controlled outside), the caret puts on the first character.
use-mask-input
Tried to use useMemo to avoid re-rendering of Input component and set its state via ref, but nothing changed.
useMemo
Here is how it behaves:
Repro project could be found here - https://stackblitz.com/edit/stackblitz-starters-hak8pb?file=app%2Finput.tsx
I think it could be considered as a bug.
The text was updated successfully, but these errors were encountered:
Hey @sergeyzwezdin, yes its a bug... im working on a solution. Thanks for reporting.
Sorry, something went wrong.
@sergeyzwezdin I detected when using controlled component the mask alias not works as espected.
For now, you can pass full mask declaration:
const ref = useInputMask({ mask: '9{1,}[.9{2}]', options: { placeholder: '', rightAlign: true, }, });
This example represents a decimal with optional numbers after radix point.
@sergeyzwezdin, @eduardoborges My workaround for that issue is to add onChange event with below content:
onChange
const caret = event.target.selectionStart; const element = event.target; window.requestAnimationFrame(() => { element.selectionStart = caret; element.selectionEnd = caret; })
No branches or pull requests
After connecting
use-mask-input
, using controlled input (passing value/onChange controlled outside), the caret puts on the first character.Tried to use
useMemo
to avoid re-rendering of Input component and set its state via ref, but nothing changed.Here is how it behaves:
Repro project could be found here - https://stackblitz.com/edit/stackblitz-starters-hak8pb?file=app%2Finput.tsx
I think it could be considered as a bug.
The text was updated successfully, but these errors were encountered: