[0.63.1] Don't fire the render phase update warning for class lifecycles
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
Like in react V16.13.0 the warning Cannot update a component from inside a body of a function component. is thrown from inside of class lifecycles too (i.e. redux-forms will trigger this warning on every synchronous validate).
While arguably these are real issues (they happen in render phase) it's pretty noisy for legacy code. https://github.com/facebook/react/pull/18330
The problem is part of the renderer ReactNativeRenderer-dev.js, and it seemed to me, that these types are auto-generated by a "sync tool"? So probably it just needed to be updated?
React Native version:
System: OS: Windows 10 10.0.19042 CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz Memory: 7.71 GB / 31.96 GB Binaries: Node: 12.18.2 - ~\AppData\Local\Temp\yarn--1595339538342-0.5834644449552555\node.CMD Yarn: 1.22.4 - ~\AppData\Local\Temp\yarn--1595339538342-0.5834644449552555\yarn.CMD npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.2, 30.0.0 System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135 Languages: Java: 1.8.0_211 - C:\Program Files\Java\jdk1.8.0_211\bin\javac.EXE Python: 2.7.18 - C:\Python27\python.EXE npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.1 => 0.63.1 npmGlobalPackages: react-native: Not Found
yarn list [...] ├─ @react-native-community/[email protected] └─ [email protected]
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Its the same issue reported here for React v16.13.0 but for React-Native v0.63.1 https://github.com/redux-form/redux-form/issues/4619
Expected Results
While arguably these are real issues (they happen in render phase) it's pretty noisy for legacy code.
react-navigation is also triggering this warning pretty much after every screen change.
@cristianoccazinsp I had this too, after upgrading. Was triggered by calling navigator.setOptions inside render instead of (as shown in the docu) inside useLayoutEffect.
Probably it's something similar in your case?
I'm not using navigator.setOptions at all (at least not anywhere in the code). From debugging, the culprit is most likely the compatibility layer and the withNavigation HOC.
Still not sure if this is a RN or react-navigation issue.
I've reported the issue here: https://github.com/react-navigation/react-navigation/issues/8584
Looks like there's some vigorous back and forth on the react-navigation issue. When that investigation is wrapped up if it's pointing to a core RN issue we can return here. But in the meantime let's not double up.
@Ztarbox does the discussion on the react-navigation issue match your experience or is yours separate.
I believe it could be a similar issue, in terms of 'a warning is shown that should not, because of legacy code' but it is a different warning message and it is triggered by react-navigation.
I'm talking about a warning which occurrence already was reduced in react itself for class components (see above linked PR) and in my case is triggered by a ClassComponents of redux-form.
So I am sure, that the warning I am talking about could be hidden based on the same reasoning it was done in react. But I am not sure for the react-navigation warning.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.