(router): fix drawer navigator navigation #25985
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Fix: #25981
How
To be honest, I'm not 100% sure why its broken in the current state. It fires a navigation events on the shared Stack with what seems like the correct params.
But we also don't need to track the last common Stack/Tab lastCommonNavigator. Pre-#24457, we used to fire navigation events on the root navigator, so #24457 tried to not deviate from this behaviour by only changing the behaviour Stacks&Tabs doing replace actions. #24600 cleaned up the logic of #24457 and unified the logic for all navigation types, but still only tracked the last common Stack/Tabs. I don't know why this breaks Drawer, it might be an internal implementation detail, but we can simply fire the event on the last common navigator - no matter what type it is.
Test Plan
Add a smoke test for
<Drawer />
. I don't believe it was being previously tested.Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).