-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.54] Warnings for soon to be deprecated lifecycle methods #18175
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 |
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" ***@***.***> 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
<#18175 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAqya3O5qAE8mmbsceiYyt7xHcEMkTmtks5tbT0ZgaJpZM4Sa8No>
.
|
Here's a link of "what's to come": |
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 import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings([
'Warning: componentWillMount is deprecated',
'Warning: componentWillReceiveProps is deprecated',
]); I agree that |
alternatively you can also do this: #18165 (comment) |
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. |
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 ***@***.***> 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) <#18175 (comment)> 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 <#18175 (comment)>, 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 ***@***.***> 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<HelloWorldExpoReactWarnings.png>
> On Apr 20, 2018, at 8:43 AM, Dan Abramov ***@***.*** ***@***.***>> 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) <#18175 (comment)> 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 <#18175 (comment)>, 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 ***@***.***> wrote:
Oops meant Dan, that’s embarrassing
On Apr 20, 2018, at 8:52 AM, Ryan Dines ***@***.***> 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<HelloWorldExpoReactWarnings.png>
On Apr 20, 2018, at 8:43 AM, Dan Abramov ***@***.***> 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)
<#18175 (comment)>
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
<#18175 (comment)>,
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 #18175 and post it there? Thanks! |
Done
… On Apr 20, 2018, at 9:19 AM, Ryan Dines ***@***.***> wrote:
Adding an iOS screen shot
<IMG_0101.jpg>
On Fri, Apr 20, 2018 at 8:52 AM Ryan Dines ***@***.*** ***@***.***>> wrote:
Oops meant Dan, that’s embarrassing
> On Apr 20, 2018, at 8:52 AM, Ryan Dines ***@***.*** ***@***.***>> 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<HelloWorldExpoReactWarnings.png>
>
>> On Apr 20, 2018, at 8:43 AM, Dan Abramov ***@***.*** ***@***.***>> 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) <#18175 (comment)> 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 <#18175 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ARB_0mi8XLOyqfBg80d8WU3T-lx_f88Vks5tqdf-gaJpZM4Sa8No>.
>>
>
|
Looking at your StackOverflow question, you were using There was a also similar bug in |
I’m going to close this as the issue appears solved in |
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 ***@***.***> wrote:
@ryan2clw <https://github.com/ryan2clw>
Looking at your StackOverflow question, you were using ***@***.*** As explained in this thread there was a bug in ***@***.*** which caused this. The bug was fixed in ***@***.*** So if you update to that, it should work.
There was a also similar bug in ***@***.***, and it was fixed in ***@***.***
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#18175 (comment)>, 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 ***@***.***> 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 ***@***.*** ***@***.***>> wrote:
>
> @ryan2clw <https://github.com/ryan2clw>
> Looking at your StackOverflow question, you were using ***@***.*** As explained in this thread there was a bug in ***@***.*** which caused this. The bug was fixed in ***@***.*** So if you update to that, it should work.
>
> There was a also similar bug in ***@***.***, and it was fixed in ***@***.***
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub <#18175 (comment)>, 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 (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 |
I'll ping |
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 |
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 ***@***.***> 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 ***@***.*** ***@***.***>> 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 ***@***.*** ***@***.***>> wrote:
>>
>> @ryan2clw <https://github.com/ryan2clw>
>> Looking at your StackOverflow question, you were using ***@***.*** As explained in this thread there was a bug in ***@***.*** which caused this. The bug was fixed in ***@***.*** So if you update to that, it should work.
>>
>> There was a also similar bug in ***@***.***, and it was fixed in ***@***.***
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub <#18175 (comment)>, 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 |
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 ***@***.***> 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 <#18175 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ARB_0m8JFV5mKwdTPAa1YPG7sy9G1ZBjks5tuAXKgaJpZM4Sa8No>.
|
|
is it fixed on react-native 0.56 ? |
oh, so this is coming from the eslint stage of our build. original post:
react-native-cli: 2.0.1 |
Check out solution for this issue : https://www.skptricks.com/2018/10/warning-componentwillmount-is-deprecated-in-react-native.html |
This fixes yellow boxes (bug in RN release - see facebook/react-native#18175) as well as broken maps.
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.:
Steps to Reproduce
With Chrome debugger open.
The text was updated successfully, but these errors were encountered: