react-native-custom-picker icon indicating copy to clipboard operation
react-native-custom-picker copied to clipboard

RN 0.60: componentWillReceiveProps is deprecated

Open hohl opened this issue 6 years ago • 3 comments

Thank you for providing that component. Since the React Native built-in picker component is barely customizable and I wanted a field view similar to other text inputs I used this library for my app currently under development.

But using this component within React Native 0.60 I get a deprecation warning related to this component: componentWillReceiveProps is deprecated and will be removed in the next major version. Use getDerivedStateFromProps instead.

Since React Native 0.61 was already released a few days ago, this might get an issue soon and I wanted to give you some heads up that this library might need some work to be compatible with future versions of React Native.

hohl avatar Sep 27 '19 18:09 hohl

I have the same problem with you, how to overcome it, whether it can?

kabitacode avatar Oct 31 '19 04:10 kabitacode

You can simply ignore the yellow warning (if that is what you are asking). You can also disable the warning via:

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
    'Warning: componentWillReceiveProps is deprecated',
]);

Anyhow, you should be fine as long as you only use RN 0.60. But any newer version might drop componentWillReceiveProps and then the only solution would be to adopt the codebase of this library. (I did not yet try whether this function is already gone in RN 0.61.)

hohl avatar Oct 31 '19 19:10 hohl

Newer way to ignore, now that LogBox and warning wording changed. Until there's an update ...

import { LogBox } from 'react-native';

LogBox.ignoreLogs(['Warning: componentWillReceiveProps has been renamed'])

rpattcorner avatar Jan 24 '21 17:01 rpattcorner