[0.54] Warnings for soon to be deprecated lifecycle methods
See original GitHub issueEnvironment
Environment: OS: macOS High Sierra 10.13.3 Node: 8.9.3 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed) react: 16.2.0 => 16.2.0 react-native: 0.54.0 => 0.54.0
Expected Behavior
No warnings would appear in debugger console.
Actual Behavior
Warnings about React soon to be deprecated lifecycle methods are displayed. e.g.:
Warning: componentWillMount is deprecated and will be removed in the next major version. Use componentDidMount instead. As a temporary workaround, you can rename to UNSAFE_componentWillMount.
Please update the following components: Container, Image, ResourceSavingSceneView, TabViewPagerPan, TouchableOpacity, Transitioner, withCachedChildNavigation(TabView)
Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks
Steps to Reproduce
react-native run-ios
With Chrome debugger open.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:38
- Comments:107 (42 by maintainers)
Top Results From Across the Web
componentWillMount is deprecated and will be removed in the ...
0 and Whenever run the apps on iOS there is found warning about deprecate the lifecycle methods. and also please update the components....
Read more >Problematic React Lifecycle Methods are Going Away in ...
The React team has decided to deprecate some of the lifecycle methods with React 17. A recent blog post from the reactjs team...
Read more >дэн on Twitter: "@_reznord @reactjs Please wait for official ...
17, following lifecycle methods are going to be deprecated: componentWillMount, componentWillUpdate, componentWillReceiveProps More info on ...
Read more >find_element_by_tag_name is deprecated - You.com | The AI ...
Warnings about React soon to be deprecated lifecycle methods are displayed. e.g.: Warning: componentWillMount is deprecated and will be removed in the next ......
Read more >React-Native Lifecycle Methods Warning - ADocLib
StrictMode currently helps with: Identifying components with unsafe lifecycles; Warning about legacy string ref API usage; Warning about deprecated ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those looking for a way to remove those warnings until the React Native components are updated, you can add the following to your code (eg at the top of
index.js
):I agree that
componentWillMount
should be avoided completely, but until the React Native components are updated those warnings are just getting in the way.To my mind, the bigger problem is not that React Native throws this warning, but that it throws six yellow boxes (in my experience at least) due to duplicate deprecation warnings for componentWillMount and componentWillReceiveProps.
This hurts the dev experience and makes debugging more time consuming, as the seconds wasted getting distracted by and dismissing/ignoring duplicate irrelevant errors start to add up.