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

Updating value props doesn't update input value

Open FabienCoutant opened this issue 2 years ago • 2 comments

Describe the issue and the actual behavior

I have an input field where I can specify a maxValue and if user set value higher than the maxValue defined the state is set at the max one. The issue is that my state has correctly the maxValue set but not the input field value.

Describe the expected behavior

I expect the NumericFormat input value equal to the value props. The isAllowed block user to provided value whereas I would prefer to override it.

Provide a CodeSandbox link illustrating the issue

https://codesandbox.io/s/onvaluechange-demo-forked-4y4qhy?file=/src/App.js

Provide steps to reproduce this issue

The MAX defined is 10 000. Put any number above this max, you will see the state value block at 10000 but not the input value displayed.

Please check the browsers where the issue is seen

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

FabienCoutant avatar Jun 12 '23 13:06 FabienCoutant

If isAllowed doesn't work for you. You can handle it like this for now.

https://github.com/s-yadav/react-number-format/issues/749#issuecomment-1529001614

s-yadav avatar Jun 13 '23 06:06 s-yadav

Hey, thanks for your quick answer! :) I followed and tried the solution from #749 but it doesn't work as expected on my side 😢

FabienCoutant avatar Jun 13 '23 07:06 FabienCoutant