React-native: [0.54] Warnings for soon to be deprecated lifecycle methods

Created on 3 Mar 2018  Ā·  107Comments  Ā·  Source: facebook/react-native

Environment

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.

JavaScript Locked Discussion

Most helpful comment

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):

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
  'Warning: componentWillMount is deprecated',
  'Warning: componentWillReceiveProps is deprecated',
]);

I agree that componentWillMount should be avoided completely, but until the React Native components are updated those warnings are just getting in the way.

All 107 comments

Same here, with run-android too.

This deprecation won't happen for quite some time still, and it's a React issue per sĆØ. Closing.

Is this an issue with the React version then? Deprecating it down to 16.0.0 shows the same warning boxes.

Same issue Replicated both on ios and android.

Same here too on android.

Same issue android and ios.

I understand that you think that will need only a short time poeriod before all dependecies will upgrade itselfs... but in the while, what's the right syntax for console.ignoreYelloBox ?

@kelset These warnings are generating YellowBoxs that we are going to have to ignore for "quite some time"?

Also, this isn't a React issue at all. React is deprecating the component lifecycles that React-Native components are using. The React-Native components need to be upgraded in order to conform with the new React standard.

Would you consider re-opening this issue for extended discussion on the subject?

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.

Hi Guys,

I'm a beginner and I started to learn React Native for the past 2 days. I got the same error in Android. We can't ignore it - It's my opinion. We need to discuss on it and find the solution.

I'm having the same issue, looking for a way to at least hide these specific warnings.

So can i understand that react is deprecating componentWillMount / componentWillReceiveProps, and it is react-native that will need to update TouchableHighlight/ Text /View. Not the developers that are using the elements wrongly?

Every component that uses that method will need to be updated, so both react-native and developers need to take action.

Also I checked react js website. There is no update/log/documentation about this issue. But I'm very sure that the issue is not because of development bugs. According to the warning message, there must be an alternative solution for it. I could not get after a long time search.. :( and I'm wondering about this issue ;)

In my opinion,react is deprecating the component lifecycles that React-Native components are using.The React-Native components need to be upgraded in order to conform with the new React standard.

I am a beginner in react native.The same warning message am getting in every project i am creating
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: Text, View

This was a confusion for a few engineers on my team. React has an RFC that
proposed changes to the lifecyle methods:
https://github.com/reactjs/rfcs/blob/master/text/0006-static-lifecycle-methods.md

It's a big change, and supporting it will take some time. To hide the
yellow box would be to inappropriately ignore a deprecation, but users
should understand that this is not due to their code but instead internal
to React Native.

On Mar 5, 2018 7:26 AM, "dhani112" notifications@github.com wrote:

I am a beginner in react native.The same warning message am getting in
every project i am creating

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: Text, View

ā€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/18175#issuecomment-370418075,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAqya3O5qAE8mmbsceiYyt7xHcEMkTmtks5tbT0ZgaJpZM4Sa8No
.

Here's a link of "what's to come":

https://github.com/facebook/react-native/issues/18165#issuecomment-369913385

Thank you @jhnferraris and @gre for the code to disable these warnings.

Will this disable warnings for custom components as well as React-Native provided components?

@turnrye While hiding deprecation warnings may be inappropriate, there is no reason why the deprecation warnings for both lifecycle methods (which are hard-coded in and thrown by React Native, not by the React lib) should be duplicated twice or more.

The duplication issue is a bug, as the warnings are identical and are thrown from the same path and may obscure other yellow boxes in debugging. It would be appropriate to only throw the deprecation warnings once if the warnings are coming from core React Native components (View, Text, etc).

I suppose occasional minor annoyance is the price of free amazing software

@mjfox09 You should avoid using componentWillMount completely -- put any logic you want to run pre-mount in your component's constructor() function.

@njwest absolutely ā€“ there should not be duplicate warnings.

@njwest I think there's some confusion in my question. I understand what the RFC states and what my code needs to be changed to.

What I'm asking about is if setting the "warnAboutDeprecatedLifecycles" flag to false (found on the ReactFeatureFlags package) will impact the warnings that React is generating for my projects components or if it will only remove warnings for React-Native components. I don't have my project in front of me to try this.

Take a look at the issue that jhnferraris linked to get a glimpse of the code I'm talking about.

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):

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
  'Warning: componentWillMount is deprecated',
  'Warning: componentWillReceiveProps is deprecated',
]);

I agree that componentWillMount should be avoided completely, but until the React Native components are updated those warnings are just getting in the way.

alternatively you can also do this: https://github.com/facebook/react-native/issues/18165#issuecomment-369907978

Hey everyone!

Weā€™re sorry about this warning slipping throughā€”this warning wasnā€™t intended to fire until we finish writing the documentation and migration instructions. I believe it got into the release by accident. Please give us a day to sort this out.

Thanks!

I want to stress these lifecycles are not being deprecated quite yet. Again, weā€™ll post a blog post with more details. The warning came before the blog post by accident.

Also, this definitely sounds like a bug:

Please update the following components: Text, View

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.

We'll fix or revert this asap. Please give us a day to sort this out.

@gaearon Thanks!

Quick follow-up to Dan's comment. @grabbou and I chatted about this earlier, and the deprecation warning feature flag has been turned off for the 0.54 branch.

It's refreshing to see the Dan's responsiveness compared to the person who closed the issue without even attempting to understand the concern.

@hey99xx I'm sure Dan would have done the same: close the issue and get in touch with React team ASAP. This was just the right call since this is the React Native repo and this is a React issue. Have some respect for other peoples' decisions you don't fully understand.

Since Dan is the one who re-opened the issue, that's clearly not the case. I also don't see any indication that Lorenzo was the one who contacted React team. From his comment it looked like he was content with all developers see the deprecation warning constantly. I expect the same kind of respect from the contributors of the project, he could have at least guided OP to open an issue in React instead of just closing this report with no resolution.

@bvaughn Re: https://github.com/facebook/react-native/issues/18175#issuecomment-371205379,
what version of RN should we be using to use this fix?

Whichever one was released after @grabbou's commit (2f84463 ~ March 7, 2018 8:11 am PST)

$ npm info react-native | grep 0.54
  'dist-tags': { latest: '0.54.0', next: '0.54.0-rc.4' },
     '0.54.0-rc.0',
     '0.54.0-rc.2',
     '0.54.0-rc.3',
     '0.54.0-rc.4',
     '0.54.0' ],
     '0.20.0': '2016-02-16T17:50:54.610Z',
     '0.54.0-rc.2': '2018-02-12T16:48:13.799Z',
     '0.54.0-rc.0': '2018-02-12T20:35:08.410Z',
     '0.54.0-rc.3': '2018-02-13T18:17:51.808Z',
     '0.54.0-rc.4': '2018-02-27T19:54:11.332Z',
     '0.54.0': '2018-03-01T19:02:06.832Z' },

Looks like maybe one hasn't been cut yet? I think Mike was going to cherry-pick a few more fixes in before doing another release. My guess is he hasn't finished that yet. (I am not involved with the react-native release process.

@bvaughn Thanks for the info. I asked because when I tried $ yarn add react-native to update the version I still see the warnings. I'll just wait for the release information

I wanted to cherry-pick few other things before, but since it's already Friday and I don't want to leave this quite important issue too long, I am going to release 0.54.1 with this fix only right now.

Please expect 0.54.2 at the beginning of next week - there are few minor tweaks related to linking that I want to ship.

@grabbou react-native-git-upgrade can't find 0.54.1

Looks like it hasn't been released yet, @wellyshen:

$ npm info react-native | grep 54.1
     '0.54.0-rc.4': '2018-02-27T19:54:11.332Z'

Just released it. Sorry, Circleci failed on deploy and had to retrigger
manually.

On Sat, Mar 10, 2018, 5:23 PM Brian Vaughn notifications@github.com wrote:

Looks like it hasn't been released yet, @wellyshen
https://github.com/wellyshen:

$ npm info react-native | grep 54.1
'0.54.0-rc.4': '2018-02-27T19:54:11.332Z'

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/18175#issuecomment-372042199,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWcxrifV-GPyX6Y8aMIqeIPazMcZshbks5tc_4KgaJpZM4Sa8No
.

@grabbou Great! I updated my RN to v0.54.1 everything works fine!

We'll need to remember to follow up before the next branch cut on this. Docs will likely be ready by then, but it seems wrong this fires for Text/View and the ergonomics seem not ideal too.

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.

I would not expect this to happen. We only warn once per component type and we collapse all component names into a single warning message (well, one per lifecycle). We _could_ combine the messages further, but I think a separate warning per deprecated lifecycle makes sense.

Here we go again at 55.1

The links are all ready now, so they should actually redirect to the blog post with instructions. I'm not sure if we wanted to hold the actual warnings until 16.4.0 or not though (like we did on the web). Let me chat to @bvaughn.

There also shouldn't be false positives like <View> and <Image>.

Let's reopen for discussion until we're sure everything is intentional.

We asked @grabbou to cut another patch that temporarily disables the warning flag. I guess we need to keep doing this in every stable release until 16.4.0 comes out.

I think the (temporary) solution to this will be another cherry pick like 2f84463, as Dan mentioned above.

I am cherry-picking this one more time. There has to be something really weird with our RNTester app as I didn't see any warnings during testing. I will further investigate that to prevent this in the future.

@bvaughn why not just set it to false on master until we are ready?

Because we need it turned on internally at FB and donā€™t currently have a way to use different feature flags in OS builds.

master is auto-synced from fbsource, and it needs to be true in fbsource.

FYI 0.55.2 is on its way (CI tests right now) including a fix for this
issue.

On Fri, 6 Apr 2018 at 18:18 Dan Abramov notifications@github.com wrote:

Because we need it turned on internally at FB and donā€™t currently have a
way to use different feature flags in OS builds.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/18175#issuecomment-379303006,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWcxjEDcmYaYMgsOw46m2sreadK4rsgks5tl5VJgaJpZM4Sa8No
.

I've created a gist that goes into more detail about the current feature flag situation if anyone is interested:
https://gist.github.com/bvaughn/91583b158a207c72d63954452101b5d6

@bvaughn Thanks for the explanation. It helps.

Where is this feature flag file for react-native so that we can do some postinstall tweaking to turn off flags that were turned on accidentally?

Also, for this particular issue where lifecycle hooks have changed, is there a rationale published somewhere? Kind of a core thing to do...Thanks.

The feature flag file is ReactFeatureFlags.js, but there is no API to expose the feature flags. (They can't be turned off that way.)

Hmm... This file cannot be edited before a build?

I don't know how you're building your native apps. Maybe it's possible for you to edit this file, but any automated steps you added to do this might break unexpectedly in a future release- because this is not part of the public API (and so it may change without warning).

Setting warnAboutDeprecatedLifecycles: false in ReactFeatureFlags.js does resolve this issue. Any idea when 0.55.2 is coming out?

same problem here....just updated to
"react": "16.3.1",
"react-native": "0.55.0"

and seeing the multiple repeated warnings about life cycle. Which is the version that has the fix?

0.55.2 will have the fix. Will be out in a few days.

None of the suggestions worked for me in 0.55.1.

I found that you can manually edit this file https://github.com/facebook/react-native/blob/master/Libraries/Renderer/shims/ReactFeatureFlags.js to disable these warnings.

You can find it in your node_modules folder: node_modules/react-native/Libraries/Renderer/shims/ReactFeatureFlags.js, update warnAboutDeprecatedLifecycles to false

It will work until 0.55.2 is out...

I got this kind of new deprecated warning in 0.55.2.

simulator screen shot - iphone 8 - 2018-04-10 at 00 35 37

@wellyshen Can you provide example code that triggers it?

@gaearon For me, I don't use isMounted anywhere in my project code. I believe the warning is coming from packages inside node_modules. A quick search reveals that it's used in react-native/Libraries/Components/Touchable and in a few places in react-navigation.

I had the same problem today & temporarily used YellowBox to disable this message specifically.
it was almost impossible for me to chase down from which this error come from, the error don't tell which component this is and the stacktrace don't help.

Do you also use react-navigation?

On Mon, 9 Apr 2018 at 21:03 Gaƫtan Renaudeau notifications@github.com
wrote:

I had the same problem today & temporarily used YellowBox to disable this
message specifically.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/18175#issuecomment-379858904,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWcxkTWTKP3V7K0hgDVS292aZzaEY0Gks5tm7B7gaJpZM4Sa8No
.

We'll need a minimal reproducing project to look at this.

Yes I didn't use isMounted(...) in my project but I'm using react-navgiation.

It looks like these warnings have been addressed in the 2.x branch of react-navigation FWIW. Although I guess that's still only available as an RC.

How to disable isMounted() warning? Any workaround?

YellowBox API can help us ignore these warnings.

import { YellowBox } from 'react-native';

// ...

YellowBox.ignoreWarnings([
  'Warning: isMounted(...) is deprecated in plain JavaScript React classes.'
]);

or console.disableYellowBox = true; to remove all the yellow boxes completely.

edit: downvoted for no apparent reason...

@MiLeung you don't want to do that. That will get rid of all legitimate warnings that may require addressing

I am having the same issue. I just created a new project using create-react-native-app

"expo": "^26.0.0",
"native-base": "^2.4.2",
"react": "16.3.0-alpha.1",
"react-native": "0.54.0",
"react-navigation": "^1.5.11"

@ujwal-setlur That is incorrect - warnings still appear in the console. I use it because dismissing yellow boxes is annoying.

I'm just learning React for the first time, was not expecting to troubleshoot hello world. Wrote a stack overflow post about it: https://stackoverflow.com/questions/49928456/stable-version-of-react-native/49930992#49930992. My solution was to just roll it back to the last version. I was afraid that disabling warnings might interfere with me learning best practices.

@ryan2clw Itā€™s not clear either from your comment or from Q&A which warnings youā€™re seeing specifically. I also asked for a reproducing case in https://github.com/facebook/react-native/issues/18175#issuecomment-379890106 and neither you nor anybody else in this thread has provided it so far. So it is hard to help you.

Hi Dad,

Attached is screen shot. Iā€™m happy using the expo 25.0.0 version, but if you are attempting to fix it for others, here is the screen shot. Thanks for looking out. I just ran the commands for hello world from the React site after installing node and this is the warning once you follow the link in expo and the program loads up.

Sincerely,

Ryan

On Apr 20, 2018, at 8:43 AM, Dan Abramov notifications@github.com wrote:

@ryan2clw https://github.com/ryan2clw Itā€™s not clear either from your comment or from Q&A which warnings youā€™re seeing specifically. I also asked for a reproducing case in #18175 (comment) https://github.com/facebook/react-native/issues/18175#issuecomment-379890106 and neither you nor anybody else in this thread has provided it so far. So it is hard to help you.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383083521, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0mi8XLOyqfBg80d8WU3T-lx_f88Vks5tqdf-gaJpZM4Sa8No.

Oops meant Dan, thatā€™s embarrassing

On Apr 20, 2018, at 8:52 AM, Ryan Dines ryan.dines@gmail.com wrote:

Hi Dad,

Attached is screen shot. Iā€™m happy using the expo 25.0.0 version, but if you are attempting to fix it for others, here is the screen shot. Thanks for looking out. I just ran the commands for hello world from the React site after installing node and this is the warning once you follow the link in expo and the program loads up.

Sincerely,

Ryan

On Apr 20, 2018, at 8:43 AM, Dan Abramov <[email protected] notifications@github.com> wrote:

@ryan2clw https://github.com/ryan2clw Itā€™s not clear either from your comment or from Q&A which warnings youā€™re seeing specifically. I also asked for a reproducing case in #18175 (comment) https://github.com/facebook/react-native/issues/18175#issuecomment-379890106 and neither you nor anybody else in this thread has provided it so far. So it is hard to help you.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383083521, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0mi8XLOyqfBg80d8WU3T-lx_f88Vks5tqdf-gaJpZM4Sa8No.

Adding an iOS screen shot

On Fri, Apr 20, 2018 at 8:52 AM Ryan Dines ryan.dines@gmail.com wrote:

Oops meant Dan, thatā€™s embarrassing

On Apr 20, 2018, at 8:52 AM, Ryan Dines ryan.dines@gmail.com wrote:

Hi Dad,

Attached is screen shot. Iā€™m happy using the expo 25.0.0 version, but if
you are attempting to fix it for others, here is the screen shot. Thanks
for looking out. I just ran the commands for hello world from the React
site after installing node and this is the warning once you follow the link
in expo and the program loads up.

Sincerely,

Ryan

On Apr 20, 2018, at 8:43 AM, Dan Abramov notifications@github.com wrote:

@ryan2clw https://github.com/ryan2clw Itā€™s not clear either from your
comment or from Q&A which warnings youā€™re seeing specifically. I also asked
for a reproducing case in #18175 (comment)
https://github.com/facebook/react-native/issues/18175#issuecomment-379890106
and neither you nor anybody else in this thread has provided it so far. So
it is hard to help you.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/18175#issuecomment-383083521,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARB_0mi8XLOyqfBg80d8WU3T-lx_f88Vks5tqdf-gaJpZM4Sa8No
.

I think mailing attachments doesn't work, could you please go to https://github.com/facebook/react-native/issues/18175 and post it there? Thanks!

img_0101

helloworldexporeactwarnings
YellowBoxes in terminal and app

Done

On Apr 20, 2018, at 9:19 AM, Ryan Dines ryan.dines@gmail.com wrote:

Adding an iOS screen shot

On Fri, Apr 20, 2018 at 8:52 AM Ryan Dines [email protected] ryan.dines@gmail.com> wrote:
Oops meant Dan, thatā€™s embarrassing

On Apr 20, 2018, at 8:52 AM, Ryan Dines [email protected] ryan.dines@gmail.com> wrote:

Hi Dad,

Attached is screen shot. Iā€™m happy using the expo 25.0.0 version, but if you are attempting to fix it for others, here is the screen shot. Thanks for looking out. I just ran the commands for hello world from the React site after installing node and this is the warning once you follow the link in expo and the program loads up.

Sincerely,

Ryan

On Apr 20, 2018, at 8:43 AM, Dan Abramov <[email protected] notifications@github.com> wrote:

@ryan2clw https://github.com/ryan2clw Itā€™s not clear either from your comment or from Q&A which warnings youā€™re seeing specifically. I also asked for a reproducing case in #18175 (comment) https://github.com/facebook/react-native/issues/18175#issuecomment-379890106 and neither you nor anybody else in this thread has provided it so far. So it is hard to help you.

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383083521, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0mi8XLOyqfBg80d8WU3T-lx_f88Vks5tqdf-gaJpZM4Sa8No.

@ryan2clw

Looking at your StackOverflow question, you were using [email protected]. As explained in this thread there was a bug in [email protected] which caused this. The bug was fixed in [email protected]. So if you update to that, it should work.

There was a also similar bug in [email protected], and it was fixed in [email protected].

Iā€™m going to close this as the issue appears solved in 0.54.1 (for 0.54 branch) and 0.55.2 (for 0.55 branch).

Iā€™ll check that out. I just installed react from the start-up guide, using npm and then later yarn. I would recommend that when you run ā€œcreate-react-native-app ProjectNameā€ that it defaults to 0.54.1, as troubleshooting ā€œhelloWorldā€ might discourage your average noob.

On Apr 20, 2018, at 9:44 AM, Dan Abramov notifications@github.com wrote:

@ryan2clw https://github.com/ryan2clw
Looking at your StackOverflow question, you were using [email protected]. As explained in this thread there was a bug in [email protected] which caused this. The bug was fixed in [email protected]. So if you update to that, it should work.

There was a also similar bug in [email protected], and it was fixed in [email protected].

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383099957, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0tMhgQdux1Au_DpNNjHJxGQ0GA7Iks5tqeYpgaJpZM4Sa8No.

I would expect it to default to the latest version, but cc @ide in case it doesn't.

Donā€™t go switching versions just yet: 0.54.1 has the same warnings. Iā€™m happy with using version react 0.52 and exp 25.0.0. I canā€™t really spend any more time playing with this. If you need a good devOps engineer, Iā€™m available for hire, otherwise, its back to coding for me. Thanks for looking into it.

On Apr 20, 2018, at 9:51 AM, Ryan Dines ryan.dines@gmail.com wrote:

Iā€™ll check that out. I just installed react from the start-up guide, using npm and then later yarn. I would recommend that when you run ā€œcreate-react-native-app ProjectNameā€ that it defaults to 0.54.1, as troubleshooting ā€œhelloWorldā€ might discourage your average noob.

On Apr 20, 2018, at 9:44 AM, Dan Abramov <[email protected] notifications@github.com> wrote:

@ryan2clw https://github.com/ryan2clw
Looking at your StackOverflow question, you were using [email protected]. As explained in this thread there was a bug in [email protected] which caused this. The bug was fixed in [email protected]. So if you update to that, it should work.

There was a also similar bug in [email protected], and it was fixed in [email protected].

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383099957, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0tMhgQdux1Au_DpNNjHJxGQ0GA7Iks5tqeYpgaJpZM4Sa8No.

The main source of deprecation warnings was indeed disabled via 2f84463 and released as 0.54.1, but I believe there was a second source of warnings coming from NativeMethodMixins for 0.54 that wasn't fixed until commit d9bd9d5 which was released with 0.54.3.

(Relates to facebook/react/pull/12212)

Edit 0.54.4 is the latest 54 release, so anyone reading this should probably just update to it anyway because it has a couple of additional, minor bug fixes. šŸ˜‰

I started a create-react-native-app a couple hours ago and the default was [email protected], change it to [email protected] and it solves this problem. ([email protected] didn't work for me.)

I'll ping create-react-native-app maintainers. I don't know why it uses a buggy version by default.

I'm not sure whether this still the case, or whether this is the proper place to mention it, but I recall that back in January or so CRNA was shipping a broken expo build as well.

Got a word back from CRNA folks, theyā€™ll fix it to use the latest patch. Thanks for pointing it out!

Its working, just tried it. That was a fast turnaround.

On Apr 20, 2018, at 10:19 AM, Ryan Dines ryan.dines@gmail.com wrote:

Donā€™t go switching versions just yet: 0.54.1 has the same warnings. Iā€™m happy with using version react 0.52 and exp 25.0.0. I canā€™t really spend any more time playing with this. If you need a good devOps engineer, Iā€™m available for hire, otherwise, its back to coding for me. Thanks for looking into it.

On Apr 20, 2018, at 9:51 AM, Ryan Dines [email protected] ryan.dines@gmail.com> wrote:

Iā€™ll check that out. I just installed react from the start-up guide, using npm and then later yarn. I would recommend that when you run ā€œcreate-react-native-app ProjectNameā€ that it defaults to 0.54.1, as troubleshooting ā€œhelloWorldā€ might discourage your average noob.

On Apr 20, 2018, at 9:44 AM, Dan Abramov <[email protected] notifications@github.com> wrote:

@ryan2clw https://github.com/ryan2clw
Looking at your StackOverflow question, you were using [email protected]. As explained in this thread there was a bug in [email protected] which caused this. The bug was fixed in [email protected]. So if you update to that, it should work.

There was a also similar bug in [email protected], and it was fixed in [email protected].

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-383099957, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0tMhgQdux1Au_DpNNjHJxGQ0GA7Iks5tqeYpgaJpZM4Sa8No.

console.disableYellowBox = true;

With regard to this suggestion:

console.disableYellowBox = true;

I would not advise this because it suppresses all warnings- not just the false positive you're trying to suppress.

@nicodeslandes's suggestion from a few days ago shows a safer short term workaround approach:

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
  'Warning: componentWillMount is deprecated',
  'Warning: componentWillReceiveProps is deprecated',
]);

Although- please be sure to remove this sort of ignore statement in the future- because it would otherwise suppress _actionable_ warnings (deprecations in your own components) that will be important not to ignore.

anybody's seeing this issue as well with react-native version 0.55.3?

Note that isMounted is deprecated false positive is being discussed in https://github.com/facebook/react-native/issues/18868.
(It's unrelated to this thread.)

Iā€™m on version 0.54.1. No warnings here. How often should I be updating React? Is it bad practice to keep the same version while the software is in development?

On May 1, 2018, at 2:50 AM, Vidyana Putranto notifications@github.com wrote:

anybody's seeing this issue as well with react-native version 0.55.3?

ā€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/18175#issuecomment-385611201, or mute the thread https://github.com/notifications/unsubscribe-auth/ARB_0m8JFV5mKwdTPAa1YPG7sy9G1ZBjks5tuAXKgaJpZM4Sa8No.

react-native 0.55.4 is still not fixed.

is it fixed on react-native 0.56 ?

_oh, so this is coming from the eslint stage of our build._

original post:
I am seeing this, but it is an "error" not just a "warning" so my build fails. Lo, I am confused.

/Users/x/Dev/a/b/c/src/components/button/d/D.js
  56:16  error  componentWillReceiveProps is deprecated since React 16.3.0, use UNSAFE_componentWillReceiveProps instead, see https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops  react/no-deprecated

react-native-cli: 2.0.1
react-native: 0.53.0
npm: 5.6.0
node: v8.11.3
("react" in package-lock.json is "16.2.0" per RN 0.53.0 but still have these errors)
running on mac os x 10.13.6

Was this page helpful?
0 / 5 - 0 ratings