You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Such a mask should be able to enter numbers like 100.35 ₽. But this is not happening.
This starts working if you write setValue(value) in onAccept, but the cursor position becomes incorrect (it shifts to the last position). When you enter a new digit or click in the input area, the cursor position shifts to the correct position.
If you do setUnmaskedValue(mask.unmaskedValue) in onAccept, then the cursor is positioned correctly relative to the additional character, but you will not be able to enter the fractional part. onAccept is called a second time, but with a value without . or ,
To Reproduce #990
You can run an example from here, it's almost mine. The same problem is observed there.
Expected behavior
updateValue and alignCursor in onAccept don't help.
This can only be fixed in a separate useEffect, where you can bind to the input value in the mask.
P.S. - There is also a bug with the fact that setUnmaskedValue does not change the value, but only unmaskedValue, so you have to use it like this
useEffect(() => {
if (unmaskedValue !== value) {
setUnmaskedValue(value)
// костыль setUnmaskedValue не меняет почему-то value, а updateValue не работает
setValue(value)
}
// setTimeout(() => {
// maskRef.current?.updateValue()
// }, 0)
}, [value])
And updateValue doesn't help. So that it doesn't interfere when entering numbers with a fractional part, you have to wrap it in setTimeout. But when the state is changed from the outside, it does not work.
The text was updated successfully, but these errors were encountered:
Describe the bug
Such a mask should be able to enter numbers like 100.35 ₽. But this is not happening.
This starts working if you write setValue(value) in onAccept, but the cursor position becomes incorrect (it shifts to the last position). When you enter a new digit or click in the input area, the cursor position shifts to the correct position.
If you do setUnmaskedValue(mask.unmaskedValue) in onAccept, then the cursor is positioned correctly relative to the additional character, but you will not be able to enter the fractional part. onAccept is called a second time, but with a value without . or ,
To Reproduce
#990
You can run an example from here, it's almost mine. The same problem is observed there.
Expected behavior
updateValue and alignCursor in onAccept don't help.
This can only be fixed in a separate useEffect, where you can bind to the input value in the mask.
Environment:
P.S. - There is also a bug with the fact that setUnmaskedValue does not change the value, but only unmaskedValue, so you have to use it like this
And updateValue doesn't help. So that it doesn't interfere when entering numbers with a fractional part, you have to wrap it in setTimeout. But when the state is changed from the outside, it does not work.
The text was updated successfully, but these errors were encountered: