himelbrand / react-native-numeric-input

a stylish numeric input for react native
MIT License
150 stars 98 forks source link

[BUG] - Warning: componentWillReceiveProps has been renamed #60

Closed saadjutt01 closed 2 years ago

saadjutt01 commented 4 years ago

Getting this warning !!!

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: NumericInput

nccharles commented 4 years ago

Same to me @saadjutt01 if you find a solution don't hesitate to let me know

YahiaBadr commented 4 years ago

Badly this has no solution but changing this function and replace it with componentDidMount in the source code of the package. So you will have to wait till they update it or you could clone this repo and edit it by yourself then publish it to the npm and use your own library. Edit: I looked at the Pull requests and i found this one resolves this issue PR #49, so you will have to wait till they merge it, hope they do it soon.

nccharles commented 4 years ago

Badly this has no solution but changing this function and replace it with componentDidMount in the source code of the package. So you will have to wait till they update it or you could clone this repo and edit it by yourself then publish it to the npm and use your own library. Edit: I looked at the Pull requests and i found this one resolves this issue PR #49, so you will have to wait till they merge it, hope they do it soon.

I did it @YahiaBadr and it works properly in my app. Actually the source updated but they didn't update NPM. I would recommend someone to do this.

JustinJoyce88 commented 3 years ago

Is there any chance we can get a new version with this change in it?

ShubhamKushwah commented 3 years ago

Until they merge PR #49, this is just a warning and can be safely ignored. Won't recommend setting up a custom version of the package yourself for a minor issue like this.

I also tried: npx react-codemod rename-unsafe-lifecycles, to remove the warning, but seems like this only affects the source, and not the packages.