-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Crash when navigating to 2 screens at the same time on new arch #2235
Comments
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! |
@tboba Is this problem similar to this one software-mansion/react-native-reanimated#6222 ? Otherwise I can open a new issue |
@RalissonMattias can't say if this issue is related to screens, as there's too few info attached in the original issue. Could you post us a full log trace from the error? Also, are there any errors printed in the JS console? |
Here is more infos
|
@RalissonMattias that's strange indeed. Are you trying to do something similar as in this issue (navigate to two different screens)? If not, I think you can post an issue with the reproducer, so we could check this error on our side. |
@tboba Yes, I'm trying to navigate to two different screens, but using tab navigation. A curious fact is that when I use react-native-reanimated in version 3.12.1 the application does not break, however when I use react-native-reanimated in version 3.13.0 the application breaks. That's why I initially posted the issue on react-native-reanimated |
https://github.com/Titozzz/crash-screens-tabs-new-arch |
I actually just hit that bug too, I can confirm it is a regression in reanimated v3.13. |
I do not think they are related tho |
The same problem in react-native-reanimated v3.13, and it became normal after use v3.12.1. |
Looks like software-mansion/react-native-reanimated#6222 has been reopened, so for further discussions about the bug with bottom-tabs, please head over there. |
I can confirm this issue is reproducible 🫡 |
Hey hey @janicduplessis, could you try to get screens from branch |
@tboba Works fine now, thanks! |
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. |
…oftware-mansion#2249) ## Description On Paper, while user tries to navigate to 2 or more screens at the same time, updates were batched (on async thread), resulting rerendering stack hierarchy on the next layout. In the same scenario, on Fabric, updates are not being batched, which causes crash: ``` "<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" ``` since `maybeAddToParentAndUpdateContainer` is being called to early. This PR fixes this bug by moving the logic of calling that method on `mountingTransactionDidMount` method. I've also checked if this change does not call `maybeAddToParentAndUpdateContainer` too frequent and I can't see more than one correct call there (every doubled call is being catched by `return` in conditions). Fixes software-mansion#2235. ## Changes - Moved updating containers to `mountingTransactionDidMount` method. ## Screenshots / GIFs ### Before https://github.com/user-attachments/assets/24daf575-d06c-4972-9166-89454be60126 ### After https://github.com/user-attachments/assets/d377c527-0b2c-4850-b0b5-8e93dd5f25ac ## Test code and steps to reproduce You can use `Test2235.tsx` to test this change. ## Checklist - [X] Included code example that can be used to test this change - [x] Ensured that CI passes --------- Co-authored-by: Kacper Kafara <[email protected]>
Description
When navigating to 2 screens at the same time on new arch it crashes with the following error:
Steps to reproduce
Using this code in FabricExample app SimpleNativeStack.tsx
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
The text was updated successfully, but these errors were encountered: