react-native-custom-picker
react-native-custom-picker copied to clipboard
RN 0.60: componentWillReceiveProps is deprecated
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.
I have the same problem with you, how to overcome it, whether it can?
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.)
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'])