stephy / CalendarPicker

CalendarPicker Component for React Native
792 stars 369 forks source link

RN 0.54 / React 16.3 deprecation warnings for componentWillReceiveProps, componentWillMount #116

Closed peacechen closed 5 years ago

peacechen commented 6 years ago
Warning: componentWillReceiveProps is deprecated and will be removed in the next major version. Use static getDerivedStateFromProps instead.

Please update the following components: CalendarPicker, Swiper
Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks

Warning: componentWillMount is deprecated and will be removed in the next major version. Use componentDidUpdate instead. As a temporary workaround, you can rename to UNSAFE_componentWillUpdate.

Please update the following components: CalendarPicker, Swiper

The fixes are actually simple and maintain backward compatibility. Replace componentWillMount with componentDidMount or move it to the constructor. Replace componentWillReceiveProps with componentDidUpdate and tweak logic appropriately.

In the rare case that getDerivedStateFromProps is necessary, a polyfill can be used to maintain backwards compatibility. See https://github.com/reactjs/react-lifecycles-compat

peacechen commented 6 years ago

Fixed in f4fbb16d8970eb99ed08da53a612234839e70c05