-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Multiple transitions between screens causes app to crash #2578
Comments
Facing the same issue right now |
My app with expo-router is affected by this problem. |
I am also facing this issue on Android. When I navigate back to the same screen with the same
The temporary fix working for me now on Android is conditionally using
|
This is causing Pizzahuts app to freeze on IOS 18 devices and simulators. |
Does anyone have a work around? |
Use push, and dismiss. Instead of navigate |
removing the |
Okay, I have high level grasp of the issue mechanism now. Let's have a following stack of screens: Now, in In previous version of Now, the issue arises because reshuffling the screens on stack is not really supported & it seems that it has not been the case for a longer while, as it was not needed. Moreover, the crash that happens (and e.g. causes the header to disappear) suggests that this is due to asynchronous way we do the updates - which won't be easily changed. Immediate solutionuse Proper solutionOne of:
Tagging @satya164 as I think we should handle this on |
@kkafar this behavior now being default with from native perspective, is it not possible to take the same view containing the screens and render it in a new screen if it was reordered? |
I haven't debugged it to very bottom, because the interaction between react-native's native mounting-stage code & Android Fragment transactions we use is quite complex, but the issue arises due to following:
The issue appears at point 4 - react tries to insert B, however it has been not yet effectively detached and still has a parent (still attached to S), because we didn't perform the update - we've just scheduled it for later execution. Idk what would be technical solution here yet. I'll start discussion internally on how we could start supporting such "reshuffling". I still wonder whether allowing for screen reshuffling in stack-based navigators is ok. From my current perspective this seems against the 'stack' logic. I wonder what are the use cases that people might consciously choose reshuffling the screens in stack. My guess is that most of the time this decision is not deliberate. |
What package is navigateDeprecated in? I can't see it under CommonActions? |
@pizzascott its on |
Ah I think we are on an older version so already using deprecated. Which is why android is fine for our app, but IOS is breaking. Still haven’t found a work around and seems to happen when changing tab index also. |
Temp fix for IOS is to use |
Description
Repeated navigation between 2 screens using React Navigation's Native Stack with a
getId()
prop causes the app to "crash". I use the term crash loosely as the behaviour is different per platform but both result in the app becoming unusable.iOS
react-native
elements that use Pressibility become stuck in their "onPress" state, preventing them from receiving further onPress events. The issue does not occur with non-Pressibility elements such as<TouchableOpacity />
.You can observe this behaviour with the reproduction snack by repeatedly moving between the two screens using the Forwards/Backwards
<Text />
items. After 3 transitions, the<Text />
items are no longer pressable and will be rendered with theironPress
highlighting.Android
After 3 transitions, the native stack header will disappear. After 4 transitions, the native stack will no longer render any visible context.
Expo Router issue: expo/expo#33658
React Navigation issue: react-navigation/react-navigation#12346
Steps to reproduce
Snack or a link to a repository
https://snack.expo.dev/@mwlawlor/react-navigation-native-stack-stuck
Screens version
3.3.0
React Native version
0.76.3
Platforms
Android, iOS
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: