Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Update deprecated lifecycle method #114

Closed
wants to merge 1 commit into from
Closed

Conversation

DCKT
Copy link

@DCKT DCKT commented Oct 29, 2019

Hello,

componentWillMount and componentWillReceiveProps will be removed in future version, it's required to use the new methods with UNSAFE_ prefix in order to use it.

@chetan-zalake
Copy link

@DCKT This didn't work when updated in my project. I still get those deprecated warnings. Grateful if you could help with this problem?
@ascoders Till when can we expect this to be merged?

@cristianoccazinsp
Copy link

Don't forget to update the .ts files

Can you do another find search for those two deprecated methods? I believe you've left a few out, reason the warnings are still there.

@ascoders can we get this merged asap once it's finished?

@Tamenze
Copy link

Tamenze commented Dec 10, 2019

+1 @ascoders

@sachinshettigar
Copy link

@DCKT Instead of UNSAFE prefix we can replace deprecated lifecycle methods with componentDidMount and componentDidUpdate

edwardlai3582 added a commit to edwardlai3582/react-native-image-zoom that referenced this pull request Feb 19, 2020
@cristianoccazinsp
Copy link

@DCKT Instead of UNSAFE prefix we can replace deprecated lifecycle methods with componentDidMount and componentDidUpdate

This is not entirely true. Keep mind those methods are semantically different, so such change would need to be tested (e.g., didUpdate fires on every render regardless of props change)

@TPXP
Copy link

TPXP commented May 7, 2020

@DCKT Instead of UNSAFE prefix we can replace deprecated lifecycle methods with componentDidMount and componentDidUpdate

This is not entirely true. Keep mind those methods are semantically different, so such change would need to be tested (e.g., didUpdate fires on every render regardless of props change)

In this case, the componentDidUpdate compares previous props with the new ones and will not do anything if the centerOn prop did not change, so this logic can be safely moved to the componentDidUpdate method.

As for the componentWillMount method, the actions performed in this method can be moved in the constructor.

See my PR for this approach #127

@ArtemKolichenkov
Copy link
Collaborator

UNSAFE is not great, yeah.
PR #130 will handle that. (Also check out #129 if you're interested what's going on with this package)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants