react-number-format icon indicating copy to clipboard operation
react-number-format copied to clipboard

Caret constantly shifting to the end of input after upgrading to v5

Open kelokchan opened this issue 2 years ago • 1 comments

Describe the issue and the actual behavior

Caret to stay in position

Describe the expected behavior

After ugrading to v5, the caret will constantly move to the end after inputting value with decimals

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/suffice-demo-forked-n0s1s3?file=/src/App.js

Provide steps to reproduce this issue

Type 1.2345 in the input field

Please check the browsers where the issue is seen

  • [x] Chrome
  • [ ] Chrome (Android)
  • [x] Safari (OSX)
  • [x] Safari (iOS)
  • [ ] Firefox
  • [ ] Firefox (Android)

https://user-images.githubusercontent.com/5347725/204445603-5955fc03-1d45-425c-9d10-ff62c1cdf529.mov

kelokchan avatar Nov 29 '22 05:11 kelokchan

As you are using values.value which is a string representation of a number, the valueIsNumericString prop needs to be set to true. https://s-yadav.github.io/react-number-format/docs/props#valueisnumericstring-boolean

Updated Sandbox: https://codesandbox.io/s/suffice-demo-forked-nxfkvy?file=/src/App.js:508-528

s-yadav avatar Dec 04 '22 13:12 s-yadav