react-native-screens: Crash when navigating to 2 screens at the same time on new arch
Description
When navigating to 2 screens at the same time on new arch it crashes with the following error:
navigation.navigate('a');
navigation.navigate('b');
"<RNSNavigationController> is pushing the same view controller instance (<RNSScreen>) more than once which is not supported and is most likely an error in the application"
Steps to reproduce
Using this code in FabricExample app SimpleNativeStack.tsx
- Go to “Simple Native Stack” example
- Click on “Go to detail”
- App crashes
Snack or a link to a repository
https://github.com/janicduplessis/react-native-screens/tree/%40janic/double-push
Screens version
main@e5a6220
React Native version
0.74
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- fix(iOS): Crash while pushing n different screens at the same time (#2249) ## Description On Paper, while user tries to navigate to 2 or more screens at the same time, updates were batched (on async... — committed to software-mansion/react-native-screens by tboba 2 years ago
- fix(iOS): Crash while pushing n different screens at the same time (#2249) ## Description On Paper, while user tries to navigate to 2 or more screens at the same time, updates were batched (on async... — committed to WiseOwlTech/react-native-screens by tboba 2 years ago
I can confirm this issue is reproducible 🫡
I wonder whether we should pursue reporting this to RN team & trying to fix this upstream. Since there is a discrepancy between Paper & Fabric updates batching I believe this could be considered as an unintended change, similarly to this one.
@tboba Works fine now, thanks!
Looks like https://github.com/software-mansion/react-native-reanimated/issues/6222 has been reopened, so for further discussions about the bug with bottom-tabs, please head over there.
I actually just hit that bug too, I can confirm it is a regression in reanimated v3.13.
https://github.com/Titozzz/crash-screens-tabs-new-arch @RalissonMattias this is a repro for your bug (and mine) It actually related to Reanimated 🤯
Hi @janicduplessis, thanks for submitting this issue! I remember I’ve tried to fix this issue couple months ago (here, but this change has ended in revealing another issues with view traversing 😕 I’ll try to find out what’s going on here, thanks!