oliviertassinari/react-swipeable-views

Improper lifecycle implementation

Closed this issue · 2 comments

SwipeableViews implements both getDerivedStateFromProps and UNSAFE_componentWillReceiveProps. This is causing the following warning:

  Warning: Unsafe legacy lifecycles will not be called for components using new component APIs.
  
  ReactSwipableView uses getDerivedStateFromProps() but also contains the following legacy lifecycles:
    UNSAFE_componentWillReceiveProps
  
  The above lifecycles should be removed. Learn more about this warning here:
  https://fb.me/react-unsafe-component-lifecycles

Also, it is implementing UNSAFE_componentDidUpdate which is not a real lifecycle method. It is probably meant to be either UNSAFE_componentWillUpdate or componentDidUpdate.

This change was introduced in #537

I am using:

"react": "16.12.0",
"react-swipeable-views": "0.13.6",
"react-swipeable-views-core": "0.13.6",
"react-swipeable-views-utils": "0.13.6",

Also related to this issue #566

SwipeableViews implements both getDerivedStateFromProps and UNSAFE_componentWillReceiveProps.

Also, it is implementing UNSAFE_componentDidUpdate which is not a real lifecycle method. It is probably meant to be either UNSAFE_componentWillUpdate or componentDidUpdate.

None of these statements appear to be true any longer.

Closing.