Migration navigation from InteractionManager to TransitionTracker V2#83899
Conversation
…acker" This reverts commit 7f4df01.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
… match the other platform implementations
|
@ikevin127 needs to be assigned here. cc: @roryabraham |
|
I'll get to this sometime by the EOW next week when I'll be back at full capacity 🙏 If this is urgent - feel free to ask for another reviewer 🙌 |
I can review in that case |
|
Hey @Pujan92! 👋 I’ve just resolved the conflicts so the PR can be reviewed already! |
|
@Pujan92 friendly bump 🙂 |
|
Yes @collectioneur, I am about to go through the issue conversion and then start the review 🙂 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppm1.webmp2.webmp3.webmAndroid: mWeb ChromeiOS: HybridAppSimulator.Screen.Recording.-.iPhone.15.Pro.-.2026-03-16.at.23.27.18.movSimulator.Screen.Recording.-.iPhone.15.Pro.-.2026-03-16.at.23.32.43.movSimulator.Screen.Recording.-.iPhone.15.Pro.-.2026-03-16.at.23.35.37.moviOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2026-03-16.at.23.38.15.movSimulator.Screen.Recording.-.iPhone.15.Pro.-.2026-03-16.at.23.41.19.movMacOS: Chrome / SafariScreen.Recording.2026-03-16.at.23.43.54.mov |
| TransitionTracker.runAfterTransitions({ | ||
| callback: () => { | ||
| ref.dispatch({type: CONST.NAVIGATION.ACTION_TYPE.DISMISS_MODAL}); | ||
|
|
||
| ref.dispatch({type: CONST.NAVIGATION.ACTION_TYPE.DISMISS_MODAL}); | ||
| if (afterTransition) { | ||
| TransitionTracker.runAfterTransitions({callback: afterTransition, waitForUpcomingTransition: true}); | ||
| } | ||
| }, | ||
| runImmediately, | ||
| }); |
There was a problem hiding this comment.
| TransitionTracker.runAfterTransitions({ | |
| callback: () => { | |
| ref.dispatch({type: CONST.NAVIGATION.ACTION_TYPE.DISMISS_MODAL}); | |
| ref.dispatch({type: CONST.NAVIGATION.ACTION_TYPE.DISMISS_MODAL}); | |
| if (afterTransition) { | |
| TransitionTracker.runAfterTransitions({callback: afterTransition, waitForUpcomingTransition: true}); | |
| } | |
| }, | |
| runImmediately, | |
| }); | |
| TransitionTracker.runAfterTransitions({ | |
| callback: () => { | |
| if (afterTransition) { | |
| afterTransition(); | |
| } | |
| }, | |
| runImmediately, | |
| waitForUpcomingTransition: true | |
| }); | |
| ref.dispatch({type: CONST.NAVIGATION.ACTION_TYPE.DISMISS_MODAL}); |
Can't we do it like this by using waitForUpcomingTransition?
There was a problem hiding this comment.
Good idea! The only catch here is that ref.dispatch will fire synchronously right away. While this code ensures the afterTransition callback waits for the modal to dismiss, we also need to delay the DISMISS_MODAL action itself until all current active transitions are fully complete (if waitForTransition === true).
We basically need to chain them: [Wait for current transitions] -> [Dismiss Modal] -> [Run callback] 😄
|
Hey @collectioneur, looks like conflicts just came up, do you think you could resolve them when you have a chance |
|
@srikarparsi conflicts resolved ✅ |
|
🚧 @srikarparsi has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.40-0 🚀
|
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.40-0 🚀
|
|
Deploy Blocker #85687 was identified to be related to this PR. |
The revert conflict resolution incorrectly dropped the nanoid import, which was added by a separate PR (dynamic-routes suffix layering) after the TransitionTracker PR merged. nanoid is still used in goUp() to generate unique route keys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ker-v2 Revert "Merge pull request #83899 from software-mansion-labs/collecti…
…s/collectioneur/transition-tracker-v2" This reverts commit a6b928b.
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.41-0 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
This PR introduces the TransitionTracker and migrates the first batch of
InteractionManagerusages in navigation code to use it.TransitionTracker (
src/libs/Navigation/TransitionTracker.ts) is a new module that explicitly tracks active transitions (navigation, modal, keyboard, focus) using a counted map. It exposesstartTransition/endTransitionto mark transition boundaries, andrunAfterTransitionsto queue callbacks that fire once all transitions are idle. A safety timeout (1s) auto-ends transitions that are never explicitly closed.On top of TransitionTracker, existing APIs gain transition-aware options:
*
Navigation.navigate,goBack, anddismissModalnow acceptwaitForTransition(defer the navigation until ongoing transitions finish) andafterTransition(run a callback after the triggered transition completes). This replaces the old pattern of wrapping navigation calls inInteractionManager.runAfterInteractions.dismissModalWithReportusesafterTransitioninstead of the oldDeviceEventEmitter-basedMODAL_EVENTS.CLOSEDcallback pattern. TheMODAL_EVENTS.CLOSEDconstant and its associatedDeviceEventEmitteremissions inBaseModalandRightModalNavigatorare removed.KeyboardUtils.dismissnow accepts{ afterTransition, shouldSkipSafari }instead of a bare boolean, and tracks keyboard show/hide as a transition type.ScreenLayout(src/libs/Navigation/PlatformStackNavigation/ScreenLayout.tsx) is a new component wired into the web stack navigator viascreenLayoutprop. It listens totransitionStart/transitionEndevents to feed TransitionTracker.ReanimatedModalnow callsTransitionTracker.startTransition('modal')/endTransition('modal')alongside the existingInteractionManagerhandles.Concrete migration examples in this PR:
WorkspaceCategoriesSettingsPageandWorkspaceCreateTagPagereplaceKeyboard.dismiss()+InteractionManagerwithKeyboardUtils.dismiss({ afterTransition }).WorkspaceInviteMessageComponent,NewChatPage,TransactionReceiptModalContent, andReport/index.tsreplacedismissModal({ callback })withdismissModal({ afterTransition }).Fixed Issues
$ #71913
$ #83727
$ #83755
$ #83759
$ #83711
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Start new chat:
Screen.Recording.2026-03-03.at.16.17.56.mov
Workspace invite:
Screen.Recording.2026-03-03.at.16.19.09.mov
Create group:
Screen.Recording.2026-03-03.at.16.21.00.mov
Replace receipt:
Screen.Recording.2026-03-03.at.16.14.02.mov
Keyboard behaviour:
Screen.Recording.2026-03-03.at.16.15.22.mov
MacOS: Chrome / Safari
Start new chat:
Screen.Recording.2026-03-03.at.16.41.24.mov
Workspace invite:
Screen.Recording.2026-03-03.at.16.42.14.mov
Create group:
Screen.Recording.2026-03-03.at.16.43.08.mov
Replace receipt:
Screen.Recording.2026-03-03.at.16.43.50.mov