Skip to content

iPhone Duo - Distance - Next button disappears after rotating from portrait to landscape #106372

Open

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.34-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #104988
Email or phone of affected tester (no customers): jnosidjodsjojo@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone Duo / iOS 27.2
App Component: Money Requests

Action Performed:

  1. Launch Expensify app unfolded in landscape mode.
  2. Open FAB > Track distance > Map.
  3. Rotate device to portrait.
  4. Rotate device to landscape.

Expected Result:

Next button will not disappear after rotating from portrait to landscape.

Actual Result:

Next button disappears after rotating from portrait to landscape.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7308996_1794226788173.ScreenRecording_11-09-2026_20-17-38_1.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7308996

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 9, 2026
  2. applause-bot commented on Nov 9, 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/6822962160286d9bac5d42bfef586b7b072ee471f2b656654d5a8956afa4029c

  3. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #104988

  4. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    @lakchote you have been assigned to this deploy blocker because you reviewed the offending PR: #104988

  5. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    @war-in you have been assigned to this deploy blocker because you authored the offending PR: #104988

  6. melvin-bot commented on Nov 9, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  7. github-actions commented on Nov 9, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  8. jponikarchuk commented on Nov 9, 2026

    @jponikarchuk

    We couldn't reproduce this issue a second time because it is device-specific, and the iPhone Duo is the only one in the team.

  9. MelvinBot commented on Nov 9, 2026

    @MelvinBot
    Contributor

    Deploy blocker investigation

    Recommendation: keep DeployBlockerCash; the causing PR is not yet confirmed.

    Update macOS runners to Xcode 27 is a plausible candidate because it shipped in the affected staging release and changes the native toolchain. However, its diff changes only build infrastructure—not the distance screen or orientation handling. The automated assignments are not sufficient evidence to recommend reverting it.

    What the code shows

    One concrete hypothesis: a portrait-height minimum survives rotation back to landscape, pushing Next below the visible area. ScreenWrapper derives its minimum height from cached initial dimensions, and the dimensions hook can retain an earlier height when window height decreases. Whether the reported device actually triggers that condition is unverified. Native safe-area or list-layout updates remain alternatives.

    Recommended resolution

    Compare otherwise-identical native builds with and without the Xcode update on the reported device. During landscape → portrait → landscape, capture window/screen dimensions, safe-area frame, cached initial height, and button/container bounds.

    Revert only if that comparison establishes toolchain causality; otherwise address the demonstrated layout problem.

    No interactive reproduction was performed: web testing cannot confirm this iOS-specific rotation/toolchain behavior. Confidence is low in the exact root cause and PR attribution. No code, labels, or assignments were changed.


    view run

  10. added and removed on Nov 9, 2026
  11. cocvn157 commented on Nov 15, 2026

    @cocvn157

    Proposal

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

    On an unfolded foldable device (such as iPhone Duo), launching the app in landscape mode, opening FAB > Track distance > Map, rotating the device to portrait, and then rotating back to landscape causes the Next button at the bottom of the Distance Map screen to disappear below the visible viewport.

    What is the root cause of that problem?

    1. DistanceRequestStartPage passes shouldEnableMinHeight={canUseTouchScreen()} to ScreenWrapper (src/pages/iou/request/DistanceRequestStartPage.tsx):
      In src/pages/iou/request/DistanceRequestStartPage.tsx:167-172:

      <ScreenWrapper
          shouldEnableKeyboardAvoidingView={false}
          shouldEnableMinHeight={canUseTouchScreen()}
          testID="DistanceRequestStartPage"
          focusTrapSettings={{containerElements: focusTrapContainerElements}}
      >

      And in src/components/ScreenWrapper/ScreenWrapperContainer.tsx:110-118 and line 190:

      const {initialHeight} = useInitialDimensions();
      const minHeight = shouldEnableMinHeight && !isSafari() ? initialHeight : undefined;
      ...
      style={[styles.flex1, styles.appBG, styles.screenWrapperContainerMinHeight(minHeight)]}
    2. useInitialWindowDimensions latches the larger portrait window.height and fails to shrink initialHeight when rotating back to landscape if screen dimensions do not change (src/hooks/useInitialWindowDimensions/index.ts):
      In src/hooks/useInitialWindowDimensions/index.ts:35-50:

      const onDimensionChange = (newDimensions: NewDimensions) => {
          const {window, screen} = newDimensions;
      
          setDimensions((oldState) => {
              if (screen.width !== oldState.screenWidth || screen.height !== oldState.screenHeight || window.height > oldState.initialHeight) {
                  return {
                      initialHeight: window.height,
                      initialWidth: window.width,
                      screenHeight: screen.height,
                      screenWidth: screen.width,
                  };
              }
      
              return oldState;
          });
      };
      • When the app launches unfolded in landscape mode, initialHeight is initialized to the smaller landscape height (window.height).
      • When the user rotates to portrait mode, window.height > oldState.initialHeight is true, so initialHeight updates to the taller portrait height (and on iOS / unfolded foldable Simulator/devices where Dimensions.get('screen') reports fixed native screen bounds or orientation-independent screen dimensions during window rotation, screen.width === oldState.screenWidth && screen.height === oldState.screenHeight).
      • When the user rotates back to landscape, window.height decreases back to the shorter landscape height (window.height < oldState.initialHeight), while window.width increases (window.width > oldState.initialWidth). If screen.width and screen.height remain unchanged in the Dimensions change payload, the condition screen.width !== oldState.screenWidth || screen.height !== oldState.screenHeight || window.height > oldState.initialHeight evaluates to false!
      • As a result, useInitialWindowDimensions keeps the stale, taller portrait initialHeight as minHeight on ScreenWrapperContainer (styles.screenWrapperContainerMinHeight(minHeight)). Because DistanceMapTabContent (src/pages/iou/request/step/DistanceMapTabContent.tsx:93-149) stretches its flex1 column to ScreenWrapperContainer's minHeight and places the <Button> (Next) at the bottom of that column after <DraggableList>, the bottom of the container extends below the actual landscape viewport, pushing the Next button off-screen!

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

    1. Detect orientation / window.width changes in src/hooks/useInitialWindowDimensions/index.ts:
      useInitialWindowDimensions is meant to ignore window.height reductions caused by the virtual keyboard opening (during which window.width does not change), NOT reductions caused by device rotation (during which window.width !== oldState.initialWidth).
      Update onDimensionChange in src/hooks/useInitialWindowDimensions/index.ts:39 to also update dimensions whenever window.width !== oldState.initialWidth:

      setDimensions((oldState) => {
          if (
              screen.width !== oldState.screenWidth ||
              screen.height !== oldState.screenHeight ||
              window.width !== oldState.initialWidth ||
              window.height > oldState.initialHeight
          ) {
              return {
                  initialHeight: window.height,
                  initialWidth: window.width,
                  screenHeight: screen.height,
                  screenWidth: screen.width,
              };
          }
      
          return oldState;
      });

      When rotating from portrait back to landscape, window.width !== oldState.initialWidth is always true, so initialHeight immediately resets to the new landscape window.height while still ignoring pure vertical shrinks from the virtual keyboard (window.width === oldState.initialWidth && window.height < oldState.initialHeight).

    2. (Complementary) Exclude unfolded tablet-sized viewports from isInLandscapeMode in src/libs/isInLandscapeMode/index.native.ts:
      As noted in #106376 and #106385, DistanceMapTabContent (src/pages/iou/request/step/DistanceMapTabContent.tsx:86-126) switches between a single-column layout (!isInLandscapeMode, map inside DraggableList's ListFooterComponent) and a two-column split layout (isInLandscapeMode, map on the left and DraggableList + Next button on the right). Updating isInLandscapeMode/index.native.ts so unfolded tablet-sized viewports (Math.min(windowWidth, windowHeight) > variables.mobileResponsiveWidthBreakpoint) are not treated as compact phone landscape also prevents unnecessary hierarchy remounts of DraggableFlatList and DistanceRequestFooter across rotations on unfolded devices.

    What alternative solutions did you explore? (Optional)

    • Removing shouldEnableMinHeight={canUseTouchScreen()} from DistanceRequestStartPage.tsx: rejected because DistanceRequestStartPage shares its ScreenWrapper across the Manual and Odometer tabs (which contain text inputs that open the virtual keyboard), and fixing window.width !== oldState.initialWidth in useInitialWindowDimensions fixes the root cause for all screens using shouldEnableMinHeight.
  12. lakchote commented on Nov 16, 2026

    @lakchote
    Contributor

    Not overdue.

  13. lakchote commented on Nov 17, 2026

    @lakchote
    Contributor

    @war-in can you take a look? Melvin linked this to your PR #104988, and there's a proposal above waiting for review.

  14. lakchote commented on Nov 18, 2026

    @lakchote
    Contributor

    Not overdue. #104730 added iPhone Duo support and war-in is going through these now, so I'm moving this to Weekly.

  15. added and removed on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions