You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Native share - Android - No sharing flow/app freezes when share image signed out #101425
The Android share intent is delivered as a plain deep link (new-expensify://share/root) with no session or onboarding awareness (FileIntentHandler.kt:36-41). When the user is signed out, that route does not exist yet (SHARE_MODAL_NAVIGATOR is only registered in AuthScreens), so the deep link is parked and replayed after sign-in by openReportFromDeepLink. For a brand new user, three separate things then break it:
The share deep link is deliberately dropped for new users.Link.ts:613-617 returns early whenever hasCompletedGuidedSetupFlow was false at sign-in, on the assumption that navigateAfterOnboarding owns the destination. But navigateAfterOnboarding only knows about reports and Home — it has no notion of a pending share, so the shared file is abandoned. That is the "no sharing flow" half.
If the share modal does get mounted, onboarding amputates it.NAVIGATORS.SHARE_MODAL_NAVIGATOR is listed in MODAL_ROUTES_TO_DISMISS, and RootStackRouter.ts:136-160 slices the stack at the first such route whenever OnboardingGuard issues a redirect. The share flow is deleted, not stacked — "share modal appears and disappears".
The error text on the onboarding modal is set by the deep link handler itself.Link.ts:599-603 sets onboarding.purpose.errorBackButton ("Please finish the setup questions to start using the app") when the replayed link resolves while an onboarding screen is focused. A public-domain (gmail) user lands on OnboardingWorkEmail, whose Android back handler sets the same error — private-domain users land on a screen that swallows back silently, which is why only Scenario 2 shows errors.
Why Scenario 1 (private domain) freezes instead: the onboarding navigator is registered as a transparent, gestureEnabled: false modal (AuthScreens.tsx:352-363) and renders null while account metadata loads (OnboardingModalNavigator.tsx:109-112). The share page stays visible underneath but every touch goes to the empty focused screen on top — an apparent freeze, not a crash.
What changes do you think we should make in order to solve the problem?
Don't drop a pending share intent for new users. Exempt ROUTES.SHARE_ROOT from the early return at Link.ts:613-617, and instead persist it as a pending destination that navigateAfterOnboarding consumes once guided setup finishes. This keeps the anti-flash behaviour that early return was added for while making the share flow survive onboarding.
Suppress the misleading onboarding error for this path. At Link.ts:599-603, don't call setOnboardingErrorMessage when the deep link is a share intent — the user never pressed back, so "Please finish the setup questions" is wrong.
Make ShareRootPage fail loudly instead of hanging. Wrap the JSON.parse(processedFiles) at ShareRootPage.tsx:103 in a guard and set an error state. The native module invokes the callback with the bare string "No data found" when the prefs are empty (ShareActionHandlerModule.kt:32), which throws inside the callback, so isFileReady never flips and the page renders TabNavigatorSkeleton forever with no retry.
Add Share_Root to EXCLUDE_FROM_LAST_VISITED_PATH (runtimeDefaults.ts:92-109). /share/root is currently persisted and restored on a later cold start, where there is no share payload at all — restoration is skipped for public-domain accounts (NavigationRoot.tsx:163-165), which is a second way private-domain users specifically reach a permanently skeletal share page.
What alternative solutions did you explore? (Optional)
Alternatives considered and evidence
Alternative: defer onboarding while a share intent is pending. There is no such guard today — startOnboardingFlow deliberately bypasses the router with a raw navigationRef.resetRoot (OnboardingFlow.ts:91-108, called from useOnboardingFlow.ts:135-139) precisely because OnboardingGuard would block a normal navigate. Letting share pre-empt onboarding would mean a new user could post an attachment before having an account set up, so resuming after onboarding (fix 1) is safer.
Alternative: gate the native intent on session state. The native handler could check for an auth token before firing the deep link and show a "sign in first" screen. This duplicates session logic in Kotlin and still needs the JS-side resume, so it doesn't remove any of the work above.
Ruled out: a native ANR / main-thread stall. The reported symptom is a freeze on the Expensify sharing page, i.e. JS already rendered the share screen, so the intent handling and file copy completed.
Timing note. The share modal is visible at all in Scenario 2 because OnboardingGuard allows navigation while ONYXKEYS.IS_LOADING_APP is true; once OpenApp returns, the reset/redirect above tears it down. Exactly which of the two teardown paths wins is a race, so the ordering (but not the mechanism) is unconfirmed.
Not verified: the report is build 9.4.81-0 on a Samsung device, which is likely HybridApp. All the JS fixes above are in this repo, but if HybridApp ships its own MainActivity/manifest from Mobile-Expensify, the native half of the intent path should be re-checked there. I could not inspect that repo.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/101425) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
I don't think this changes the decision. The public-room mechanism keeps a fullscreen route underneath onboarding, but it deliberately drops modals, and ShareModalNavigator is a modal. Keeping it there is a new exception to that rule. It also leaves three gaps that the selected proposal covers:
The share still shows before onboarding on cold start. Your fix only works if the share is already on the stack when onboarding is added. That flash is the reason the C+ reviewer gave for choosing the other proposal.
Several onboarding exits still cover the share. Only the two Home pushes check for an open share (L154, L182). These exits still push a screen on top of it:
Track → Concierge (L160-L163). The reviewer already flagged this case on another proposal.
Warm start isn't handled by this change, and there are no tests. The branch doesn't touch Link.ts, so a share that arrives while the app is already running depends on main's existing deep-link replay.
The existing guards check fullscreen routes only.isReportTopmostSplitNavigator() asks whether the top fullscreen tab is Reports, so it can't tell whether a modal is open. You had to add hasOpenShareModal() as a new check.
The dismiss change follows from the router change.dismissOnboardingModalBeforeExit is safe today only because the router makes onboarding the only modal. Your router change removes that guarantee, so the dismiss needs a guard too.
30. > As the video shows, onboarding comes first and the user lands back on the share afterwards. That's the same experience as the public-room flow.
I see Share coming first (1:13) in your video before onboarding and I think this should be fixed on public-room flow as well
This is not new behavior even on large screen onboarding modal opens on top of the underlying screen whethere it is Home or Inbox. When it is native on emulator it is slow and takes time before the modal opens even in normal case.
81. > 28. Thanks, everyone, for the proposals! I think @abbasifaizan70 's proposal #101425 (comment) looks good, as it avoids showing the Share page before onboarding is complete. The onboarding flow completes first, and then we see the Share page.
> 🎀 👀 🎀 C+ reviewed
[@jayeshmangwani](https://github.com/jayeshmangwani) thanks for the review. Could you pls give feedback what is wrong with [this proposal](https://github.com/Expensify/App/issues/101425#issuecomment-6068417543). I already included flash onboarding on alternative solution. thanks! just curios
> Filtering share/root out of React Navigation's native linking while signed out. That would remove the flash,
@mukhrr Nothing wrong with your proposal! I tested it, and it has the same behavior as the other proposals: the Share with expensify page appears before the onboarding flow. That’s why I decided to go with this approach #101425 (comment).
@abbasifaizan70, I'm testing the PR on iOS right now. As discussed in our DM, the fix was previously not working in the hybrid app, although it worked in the standalone app. I've retested it with the latest push, and it's now working fine in the hybrid app as well. I've completed testing and am adding a few comments to the PR now.
Activity
applause-bot commentedon Sep 17, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/6206f76e5be76d4d949b1f10c2dc5772d019fa70faa669870ebdcf893dde4aba
https://platform.applause.com/services/links/v1/external/2ebe0bc8f96f524359e8209034e7dcf780825d61b858502bc06a4907afea2b45
MelvinBot commentedon Sep 17, 2026
Proposal
What is the root cause of that problem?
The Android share intent is delivered as a plain deep link (
new-expensify://share/root) with no session or onboarding awareness (FileIntentHandler.kt:36-41). When the user is signed out, that route does not exist yet (SHARE_MODAL_NAVIGATORis only registered inAuthScreens), so the deep link is parked and replayed after sign-in byopenReportFromDeepLink. For a brand new user, three separate things then break it:Link.ts:613-617returns early wheneverhasCompletedGuidedSetupFlowwasfalseat sign-in, on the assumption thatnavigateAfterOnboardingowns the destination. ButnavigateAfterOnboardingonly knows about reports and Home — it has no notion of a pending share, so the shared file is abandoned. That is the "no sharing flow" half.NAVIGATORS.SHARE_MODAL_NAVIGATORis listed inMODAL_ROUTES_TO_DISMISS, andRootStackRouter.ts:136-160slices the stack at the first such route wheneverOnboardingGuardissues a redirect. The share flow is deleted, not stacked — "share modal appears and disappears".Link.ts:599-603setsonboarding.purpose.errorBackButton("Please finish the setup questions to start using the app") when the replayed link resolves while an onboarding screen is focused. A public-domain (gmail) user lands onOnboardingWorkEmail, whose Android back handler sets the same error — private-domain users land on a screen that swallows back silently, which is why only Scenario 2 shows errors.Why Scenario 1 (private domain) freezes instead: the onboarding navigator is registered as a transparent,
gestureEnabled: falsemodal (AuthScreens.tsx:352-363) and rendersnullwhile account metadata loads (OnboardingModalNavigator.tsx:109-112). The share page stays visible underneath but every touch goes to the empty focused screen on top — an apparent freeze, not a crash.What changes do you think we should make in order to solve the problem?
ROUTES.SHARE_ROOTfrom the early return atLink.ts:613-617, and instead persist it as a pending destination thatnavigateAfterOnboardingconsumes once guided setup finishes. This keeps the anti-flash behaviour that early return was added for while making the share flow survive onboarding.Link.ts:599-603, don't callsetOnboardingErrorMessagewhen the deep link is a share intent — the user never pressed back, so "Please finish the setup questions" is wrong.ShareRootPagefail loudly instead of hanging. Wrap theJSON.parse(processedFiles)atShareRootPage.tsx:103in a guard and set an error state. The native module invokes the callback with the bare string"No data found"when the prefs are empty (ShareActionHandlerModule.kt:32), which throws inside the callback, soisFileReadynever flips and the page rendersTabNavigatorSkeletonforever with no retry.Share_RoottoEXCLUDE_FROM_LAST_VISITED_PATH(runtimeDefaults.ts:92-109)./share/rootis currently persisted and restored on a later cold start, where there is no share payload at all — restoration is skipped for public-domain accounts (NavigationRoot.tsx:163-165), which is a second way private-domain users specifically reach a permanently skeletal share page.What alternative solutions did you explore? (Optional)
Alternatives considered and evidence
Alternative: defer onboarding while a share intent is pending. There is no such guard today —
startOnboardingFlowdeliberately bypasses the router with a rawnavigationRef.resetRoot(OnboardingFlow.ts:91-108, called fromuseOnboardingFlow.ts:135-139) precisely becauseOnboardingGuardwould block a normal navigate. Letting share pre-empt onboarding would mean a new user could post an attachment before having an account set up, so resuming after onboarding (fix 1) is safer.Alternative: gate the native intent on session state. The native handler could check for an auth token before firing the deep link and show a "sign in first" screen. This duplicates session logic in Kotlin and still needs the JS-side resume, so it doesn't remove any of the work above.
Ruled out: a native ANR / main-thread stall. The reported symptom is a freeze on the Expensify sharing page, i.e. JS already rendered the share screen, so the intent handling and file copy completed.
Timing note. The share modal is visible at all in Scenario 2 because
OnboardingGuardallows navigation whileONYXKEYS.IS_LOADING_APPis true; onceOpenAppreturns, the reset/redirect above tears it down. Exactly which of the two teardown paths wins is a race, so the ordering (but not the mechanism) is unconfirmed.Not verified: the report is build 9.4.81-0 on a Samsung device, which is likely HybridApp. All the JS fixes above are in this repo, but if HybridApp ships its own
MainActivity/manifest fromMobile-Expensify, the native half of the intent path should be re-checked there. I could not inspect that repo.Possibly related issues
Link.ts:613-617dropping a deep link for new users.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/101425)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Sep 17, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (
External)melvin-bot commentedon Sep 17, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
melvin-bot commentedon Sep 22, 2026
@jayeshmangwani Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Sep 24, 2026
@jayeshmangwani Still overdue 6 days?! Let's take care of this!
jayeshmangwani commentedon Sep 25, 2026
Melvin, let’s raise a draft PR so I can test the changes on my side and see how they work.
jayeshmangwani commentedon Sep 25, 2026
@MelvinBot implement this
72 remaining items
MelvinBot commentedon Oct 28, 2026
I don't think this changes the decision. The public-room mechanism keeps a fullscreen route underneath onboarding, but it deliberately drops modals, and
ShareModalNavigatoris a modal. Keeping it there is a new exception to that rule. It also leaves three gaps that the selected proposal covers:Link.ts, so a share that arrives while the app is already running depends on main's existing deep-link replay.Details
RootStackRouter.ts:132-138cuts the stack at the first route inMODAL_ROUTES_TO_DISMISS, which includesSHARE_MODAL_NAVIGATOR. The comment there explains why: it prevents two stacked modals (Web - Onboarding - Two Expensify logos appear on the modal). fix: land new account on initially opened room added this branch, and its test checks that the SignIn modal is dropped while the fullscreen report is kept. A public room survives because it is a fullscreen route, not a modal.isReportTopmostSplitNavigator()asks whether the top fullscreen tab is Reports, so it can't tell whether a modal is open. You had to addhasOpenShareModal()as a new check.dismissOnboardingModalBeforeExitis safe today only because the router makes onboarding the only modal. Your router change removes that guarantee, so the dismiss needs a guard too.consumeDeepLinkToOpenAfterOnboarding()opens it at L139 and skips the router change. I traced this in code only and didn't test it on a device.FitseTLT commentedon Oct 28, 2026
This is not new behavior even on large screen onboarding modal opens on top of the underlying screen whethere it is Home or Inbox. When it is native on emulator it is slow and takes time before the modal opens even in normal case.
jayeshmangwani commentedon Oct 29, 2026
@mukhrr Nothing wrong with your proposal! I tested it, and it has the same behavior as the other proposals: the Share with expensify page appears before the onboarding flow. That’s why I decided to go with this approach #101425 (comment).
melvin-bot commentedon Oct 29, 2026
Current assignee @Gonals is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.
abbasifaizan70 commentedon Nov 2, 2026
@Gonals @jayeshmangwani The PR is ready for the review. Thanks
jeffrey-graham commentedon Nov 7, 2026
melvin-bot commentedon Nov 7, 2026
expensify-chore-bot commentedon Nov 18, 2026
@abbasifaizan70 Still overdue 6 days?! Let's take care of this!
abbasifaizan70 commentedon Nov 18, 2026
WIP.
abbasifaizan70 commentedon Nov 19, 2026
@jayeshmangwani, can we finish the review ASAP? This is getting too long. Thanks
jayeshmangwani commentedon Nov 19, 2026
@abbasifaizan70, I'm testing the PR on iOS right now. As discussed in our DM, the fix was previously not working in the hybrid app, although it worked in the standalone app. I've retested it with the latest push, and it's now working fine in the hybrid app as well. I've completed testing and am adding a few comments to the PR now.