Skip to content

[Due for payment 2026-08-03] [$250] iOS-Expense-The share screen does not close when swiping back #94908

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.4.23-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93268
Email or phone of affected tester (no customers): agexptest+pr290626@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: iPhone 13 Mini/ iOS 26.5
App Component: Money Requests

Action Performed:

  1. From another app, use the OS Share menu > tap Share to Expensify
  2. Switch between the Share and Submit tabs
  3. Swipe back

Expected Result:

The share screen closes.

Actual Result:

The share screen does not close.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7194774_1782766849033.share_screen.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7194774

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. applause-bot commented on Jun 29, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/040bdef537f9768383b6794f132e895f611f3b9e28dc77d1833d0fea4d6535b4

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 29, 2026
  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 29, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 29, 2026
  5. KJ21-ENG commented on Jun 29, 2026

    @KJ21-ENG
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 11:37:54 UTC.

    Proposal

    What is the root cause of that problem?

    The Share flow is mounted on the root stack as SHARE_MODAL_NAVIGATOR with rootNavigatorScreenOptions.fullScreen:

    https://github.com/Expensify/App/blob/44ba68fbce40783d0397a0a04777443acbc888c0/src/libs/Navigation/AppNavigator/AuthScreens.tsx#L297-L302

    The fullScreen preset uses Animations.NONE:

    https://github.com/Expensify/App/blob/44ba68fbce40783d0397a0a04777443acbc888c0/src/libs/Navigation/AppNavigator/useRootNavigatorScreenOptions.ts#L93-L103

    On native, the NONE animation preset also disables the swipe gesture by setting gestureEnabled: false:

    https://github.com/Expensify/App/blob/44ba68fbce40783d0397a0a04777443acbc888c0/src/libs/Navigation/PlatformStackNavigation/navigationOptions/animation/none/index.native.ts#L5-L8

    So the iOS edge-swipe never dismisses the parent SHARE_MODAL_NAVIGATOR route. The top-left back button still works because it explicitly navigates away with Navigation.navigate(ROUTES.INBOX), but the native swipe gesture is disabled at the root share-modal route level.

    The Share/Submit tab switch makes this more visible, but the issue is not in the tab router. The swipe has to dismiss the parent share modal route, and that parent route is currently configured with gestures off.

    What changes do you think we should make in order to solve the problem?

    Enable the native swipe gesture only for SHARE_MODAL_NAVIGATOR, while keeping the existing fullScreen options and no-animation behavior:

    <RootStack.Screen
        name={NAVIGATORS.SHARE_MODAL_NAVIGATOR}
        options={{
            ...rootNavigatorScreenOptions.fullScreen,
            gestureEnabled: true,
        }}
        component={ShareModalStackNavigator}
        listeners={modalScreenListeners}
    />

    This is scoped to the Share modal only. Other routes using fullScreen keep their existing behavior.

    Test coverage:

    • Manually verify on iOS by opening Share to Expensify from the OS share sheet, switching between Share and Submit, then swiping back and confirming the share screen closes.
    • If adding automated coverage, cover the Share modal route options so SHARE_MODAL_NAVIGATOR keeps gestureEnabled: true while other full-screen routes remain unchanged.

    What alternative solutions did you explore? (Optional)

    Changing OnyxTabNavigator backBehavior was considered, but it targets the wrong layer. With gestureEnabled: false, the iOS swipe never reaches the nested tab navigator as a back action. Changing the global fullScreen or Animations.NONE preset was also rejected because it would affect unrelated full-screen routes. A share-modal-only override has the smallest blast radius.

  6. abbasifaizan70 commented on Jun 29, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    • On iOS, when a file is shared to Expensify via the OS Share menu, the Share screen shows two tabs (Share and Submit). After switching between the Share and Submit tabs and then swiping back, the Share screen does not close as expected — it stays open.

    What is the root cause of that problem?

    The Share screen renders its two tabs through OnyxTabNavigator (a Material Top Tab navigator) inside the share modal. On native, the tab navigator is configured with backBehavior: 'initialRoute'.

    import type {TabRouterOptions} from '@react-navigation/native';
    const defaultScreenOptions = {
    animation: 'default',
    } as const;
    /** On native there is no browser history; hardware back returns to the initial tab first, per platform convention. */
    const backBehavior: NonNullable<TabRouterOptions['backBehavior']> = 'initialRoute';
    export {defaultScreenOptions, backBehavior};

    This backBehavior value is imported and applied unconditionally to every OnyxTabNavigator instance, including the one on the Share screen.

    <TopTab.Navigator
    {...rest}
    id={id}
    initialRouteName={validInitialTab}
    backBehavior={backBehavior}
    keyboardDismissMode="none"

    The Share screen mounts the tab navigator without overriding the back behavior, so it inherits 'initialRoute'.

    <OnyxTabNavigator
    id={CONST.TAB.SHARE.NAVIGATOR_ID}
    tabBar={TabSelector}
    defaultSelectedTab={isFileScannable ? CONST.TAB.SHARE.SUBMIT : CONST.TAB.SHARE.SHARE}
    lazyLoadEnabled
    >
    <TopTab.Screen name={CONST.TAB.SHARE.SHARE}>{() => <ShareTab />}</TopTab.Screen>
    {isFileScannable && <TopTab.Screen name={CONST.TAB.SHARE.SUBMIT}>{() => <SubmitTab />}</TopTab.Screen>}
    </OnyxTabNavigator>

    With backBehavior: 'initialRoute', React Navigation's TabRouter handles a GO_BACK action by checking the focused tab: if the focused tab is not the initial route, it consumes the action and switches back to the initial tab instead of letting the action bubble up. The swipe‑back gesture dispatches exactly this GO_BACK action, and since the gesture is handled by the focused (nested) tab navigator first, the action never reaches the parent stack.

    So the behavior depends on which tab is focused:

    • While on the initial tab, GO_BACK is not consumed by the tab router, bubbles up to the share modal stack, and the screen closes.
    • After switching to the other (non‑initial) tab, GO_BACK is consumed by the tab router (which just switches back to the initial tab), so the share modal never receives the action and the screen does not close.

    This is why the reproduction requires switching tabs first: ending on a non‑initial tab makes the tab navigator swallow the swipe‑back gesture.

    What changes do you think we should make in order to solve the problem?

    Let OnyxTabNavigator accept a backBehavior override so the Share screen can opt out of 'initialRoute', and use 'none' for the Share tab navigator. With 'none', the tab router does not handle GO_BACK, so the action bubbles up to the share modal stack and the screen closes regardless of which tab is focused.

    1. Import the config value under an alias and add the type used to describe the prop.

    import type {MaterialTopTabNavigationEventMap} from '@react-navigation/material-top-tabs';
    import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
    import type {EventMapCore, NavigationState, ParamListBase, ScreenListeners} from '@react-navigation/native';
    import {useRoute} from '@react-navigation/native';
    import React, {useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';
    import {StyleSheet, View} from 'react-native';
    import ActivityIndicator from '@components/ActivityIndicator';
    import FocusTrapContainerElement from '@components/FocusTrap/FocusTrapContainerElement';
    import type {TabSelectorProps} from '@components/TabSelector/types';
    import useOnyx from '@hooks/useOnyx';
    import useThemeStyles from '@hooks/useThemeStyles';
    import Tab from '@userActions/Tab';
    import CONST from '@src/CONST';
    import ONYXKEYS from '@src/ONYXKEYS';
    import type {SelectedTabRequest} from '@src/types/onyx';
    import type ChildrenProps from '@src/types/utils/ChildrenProps';
    import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
    import {backBehavior, defaultScreenOptions} from './OnyxTabNavigatorConfig';

    import type {
      EventMapCore,
      NavigationState,
      ParamListBase,
      ScreenListeners,
      TabRouterOptions,
    } from "@react-navigation/native";
    // ...
    import {
      backBehavior as defaultBackBehavior,
      defaultScreenOptions,
    } from "./OnyxTabNavigatorConfig";
    1. Add the optional prop to OnyxTabNavigatorProps.

    /** Whether to lazy load the tab screens */

        /** Overrides the platform default back behavior of the tab navigator */
        backBehavior?: TabRouterOptions['backBehavior'];
    1. Destructure the prop, defaulting to the platform config value.

    lazyLoadEnabled = false,

        lazyLoadEnabled = false,
        backBehavior = defaultBackBehavior,

    The backBehavior={backBehavior} line already passed to TopTab.Navigator now reads the prop instead of the imported constant, so no change is needed there.

    1. Opt the Share tab navigator out of 'initialRoute' so swipe‑back closes the modal.

    <OnyxTabNavigator
    id={CONST.TAB.SHARE.NAVIGATOR_ID}
    tabBar={TabSelector}
    defaultSelectedTab={isFileScannable ? CONST.TAB.SHARE.SUBMIT : CONST.TAB.SHARE.SHARE}
    lazyLoadEnabled

                        <OnyxTabNavigator
                            id={CONST.TAB.SHARE.NAVIGATOR_ID}
                            tabBar={TabSelector}
                            defaultSelectedTab={isFileScannable ? CONST.TAB.SHARE.SUBMIT : CONST.TAB.SHARE.SHARE}
                            backBehavior="none"
                            lazyLoadEnabled
                        >
  7. melvin-bot commented on Jun 29, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

  8. godzillaxbox19982014-lgtm commented on Jun 29, 2026

    @godzillaxbox19982014-lgtm

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    iOS-Expense-The share screen does not close when swiping back

    What is the root cause of that problem?

    I traced this to the path that handles the issue-specific state:

    • src/pages/media/AttachmentModalScreen/routes/ShareDetailsAttachmentModalContent.tsx:13 (source): const source = useMemo(() => Number(sourceParam) || (typeof sourceParam === 'string' ? tryResolveUrlFromApiRoot(decodeURIComponent(sourceParam)) : undefined), [sourceParam]);
    • src/pages/media/AttachmentModalScreen/AttachmentModalBaseContent/index.tsx:109 (index): const [files, setFilesInternal] = useState<FileObject | FileObject[] | undefined>(() => filesProp ?? fallbackFile);
    • src/components/Navigation/DebugTabView.tsx:148 (focusedLeaf): const focusedLeaf = getFocusedLeafScreenName(activeRoute.state) ?? activeRoute.name;
    • The local evidence matches this recurring failure shape: route params are created in one format and read in another. Here, src/pages/media/AttachmentModalScreen/routes/ShareDetailsAttachmentModalContent.tsx:13 and src/pages/media/AttachmentModalScreen/AttachmentModalBaseContent/index.tsx:109 do not agree on the same the issue-specific state value, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.

    What changes do you think we should make in order to solve the problem?

    • Update src/pages/media/AttachmentModalScreen/routes/ShareDetailsAttachmentModalContent.tsx:13 to derive the issue-specific state from the route/access source that owns this flow before the value is consumed.
    • Carry the same normalized value through src/pages/media/AttachmentModalScreen/AttachmentModalBaseContent/index.tsx:109; that follows the safer family move to fix the route builder/consumer pair instead of adding a screen-only redirect, so the write/optimistic/read paths agree instead of only changing the visible component.
    • Keep the change inside the Navigation, RHP, Not Here, Back Stack surface and avoid changing deep links, auth/onboarding redirects.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    1. Add or update a regression in tests/navigation/**/*.ts for the exact issue flow: iOS-Expense-The share screen does not close when swiping back.
    2. Cover the counter-case near src/pages/media/AttachmentModalScreen/routes/ShareDetailsAttachmentModalContent.tsx:13 so valid existing the issue-specific state behavior still works.
    3. Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.

    What alternative solutions did you explore? (Optional)

    • I would not add a broad new condition outside these referenced paths; the safer fix is to keep the issue-specific state consistent at the first read/write boundary shown above.
  9. kitvasyl commented on Jun 29, 2026

    @kitvasyl

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    On iOS, after opening Expensify from the system share sheet and switching between the Share and Submit tabs, swiping back does not close the share screen.

    What is the root cause of that problem?

    In src/libs/Navigation/AppNavigator/AuthScreens.tsx, NAVIGATORS.SHARE_MODAL_NAVIGATOR is registered with the generic rootNavigatorScreenOptions.fullScreen options. This route does not explicitly enable the iOS stack dismissal gesture, so after the nested ShareModalStackNavigator changes tabs, the swipe is not handled as a pop of the root share-modal route.

    What changes do you think we should make in order to solve the problem?

    Update the options for NAVIGATORS.SHARE_MODAL_NAVIGATOR in AuthScreens to retain rootNavigatorScreenOptions.fullScreen while explicitly setting gestureEnabled: true. This makes the edge swipe pop the root share-modal navigator and close the share flow regardless of which nested Share/Submit tab is active.

    Add a navigation test covering opening the share modal, changing its nested tab, and dispatching the back gesture/action to verify that the share-modal route is removed.

    What alternative solutions did you explore? (Optional)

    Handling back separately inside each Share/Submit tab would duplicate dismissal logic and would not address the root navigator configuration that owns presentation of the share flow.

  10. melvin-bot commented on Jun 29, 2026

    @melvin-bot
  11. changed the title [-]iOS-Expense-The share screen does not close when swiping back[/-] [+][$250] iOS-Expense-The share screen does not close when swiping back[/+] on Jun 29, 2026
  12. lorretheboy commented on Jun 29, 2026

    @lorretheboy
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  13. 58 remaining items

  14. melvin-bot commented on Jul 30, 2026

    @melvin-bot

    @shubham1206agra Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  15. melvin-bot commented on Aug 2, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Aug 2, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2071707710356671699/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  17. shubham1206agra commented on Aug 5, 2026

    @shubham1206agra
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: https://github.com/Expensify/App/pull/58834/changes#r3720604815
      Link to the comment on the Issue: NA

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/668942

    Regression Test Proposal

    Test:

    1. Open the Photos app on the native device.
    2. Tap Share and select Expensify from the share menu.
    3. Verify the Share to Expensify screen opens.
    4. On iOS, swipe back and verify the Share to Expensify screen closes.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-41a6-ac73-c0ca-7aad9d79b294
  18. shubham1206agra commented on Aug 5, 2026

    @shubham1206agra
    Contributor

    @mallenexpensify This is ready for payment

  19. melvin-bot commented on Aug 5, 2026

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  20. mallenexpensify commented on Aug 5, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @samranahm paid $250 via Upwork
    Contributor+: @shubham1206agra due $250 via NewDot

    ^ Test case created. Thx

  21. JmillsExpensify commented on Aug 10, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @shubham1206agra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions