react-native-screens: Warning: Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.
Description
After I upgraded Expo sdk version up tp 53, I got this warning.
console.js:654 Warning: Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.
at SceneView (http://192.168.50.44:8081/node_modules/expo/AppEntry.bundle//&platform=ios&dev=true&hot=false&transform.engine=hermes&transform.bytecode=1&transform.routerRoot=app&unstable_transformProfile=hermes-stable:231139:21)
at RNSScreenStack (<anonymous>)
at ...
The changes are in the React version(18.2 -> 19.0) and the React Native version(0.77.1 -> 0.79.0). I’m trying to write a minimal reproducible. I guess it’s related to suspense. when I removed the suspense code, the warning was gone. The same code worked well with previous React and React Native version.
Also, is there any way to get sourcemap of it? Or is the error from native code so we don’t have?
Steps to reproduce
Not yet.
Snack or a link to a repository
not yet
Screens version
4.9.2
React Native version
0.79.0
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Expo managed workflow
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
Real device
Device model
iPhone 13,
Acknowledgements
Yes
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 21 (7 by maintainers)
@kkafar I’m also getting this issue and was able to create a minimal reproducible example here: https://github.com/grantackerman/rns-react-state-error-repro
A few key things to note that might help debug
Let me know if there’s anything else I can do to help resolve this!
I am also having the issue on Dev when upgrading from expo 52 to expo 53 with RN 0.79.5
For me this is also happening in Expo development build. I’m not using Expo Go. Currently it’s breaking the e2e tests because tab navigation can’t be pressed when the error is shown on screen.
Can we please update the labels? Reproduction is provided now
@kkafar - I added instructions for how to reproduce using a development build to the README. I reproduced on an iPhone 14 running iOS 18.2, an iPhone 16 Pro running iOS 18.3.1, and a Google Pixel 9 Pro with API 36. Let me know if you need any additional info, or if you believe this error is getting caused by a different package.
Repro is here: https://github.com/grantackerman/rns-react-state-error-repro
@kkafar - I was able to repro in a development build as well. I’ll add that to the repo as well and let you know when it’s ready
Same here. It comes randomly.
+1
Hey @kkafar! Just wanted to follow up - I’ve confirmed the repro works in development builds (not just Expo Go) and added dev build instructions to the repo.
The repro is here: https://github.com/grantackerman/rns-react-state-error-repro
Would you be able to take another look when you have a chance? Thanks!
@nguyenlamzx are you able to create reproduction for this issue?