Skip to content

Unlock landscape mode#85229

Merged
mjasikowski merged 76 commits intoExpensify:mainfrom
software-mansion-labs:@GCyganek/unlock-landscape-mode
Apr 7, 2026
Merged

Unlock landscape mode#85229
mjasikowski merged 76 commits intoExpensify:mainfrom
software-mansion-labs:@GCyganek/unlock-landscape-mode

Conversation

@GCyganek
Copy link
Copy Markdown
Contributor

@GCyganek GCyganek commented Mar 13, 2026

Explanation of Change

Unlocks landscape mode for phones on iOS and Android. Removes portrait-only orientation locks, adds a new useIsInLandscapeMode hook and isInLandscapeMode utility, and applies layout fixes across modals, text inputs, pages, and popover menus. Auto-focus is suppressed in landscape via a Proxy-based ref wrapper, keyboards can be dismissed by tapping headers/safe area insets, and bottom-docked modals are height-constrained and optionally wrapped in ScrollView.

Fixed Issues

$ #77280
PROPOSAL: #77280 (comment)
MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13889

Tests

  1. Open the app on an iOS or Android phone (not tablet)
  2. Rotate the device to landscape orientation
  3. Navigate through key screens: chat composer, expense creation (scan, distance map, distance GPS), settings (avatar page, set time page, tag settings), onboarding workspace optional screen, and emoji picker
  4. Verify that all screens render correctly in landscape — content is scrollable, modals are height-constrained and not cut off, text inputs do not auto-focus (keyboard does not appear automatically), and no content is unreachable
  5. Open a bottom-docked modal (e.g. FAB popover, action context menu) in landscape mode and verify it is scrollable and closeable, with a max height of 75% of the window height
  6. Verify that in portrait mode the UI remains unchanged
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-03-13.at.14.03.49.mov
iOS: Native
Screen.Recording.2026-03-13.at.14.00.33.mov

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@GCyganek
Copy link
Copy Markdown
Contributor Author

@mountiny could you ran adhoc here and ask QA to do full regression testing in landscape mode?

@github-actions
Copy link
Copy Markdown
Contributor

🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@mountiny mountiny requested a review from truph01 March 13, 2026 13:40
@github-actions

This comment has been minimized.

@truph01
Copy link
Copy Markdown
Contributor

truph01 commented Mar 13, 2026

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained ""why"" the code was doing something instead of only explaining ""what"" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named ""index.js"". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@truph01
Copy link
Copy Markdown
Contributor

truph01 commented Mar 14, 2026

Here are a few issues I noticed during testing:

Bug 1: [Android] Unable to scroll the popover menu

The popover menu cannot be scrolled on Android.

Screen.Recording.2026-03-14.at.15.29.46.mov

Bug 2: [Android] Input field layout issue when focusing

When the input field receives focus and the keyboard opens, the layout looks incorrect.

Screen.Recording.2026-03-14.at.15.34.29.mov

Bug 3: [Android] Digit input partially hidden in landscape mode

The digit input is partially hidden. In landscape mode, it might be better to display it on the left or right side instead of at the bottom.

Screen.Recording.2026-03-14.at.15.37.55.mov

Bug 4: Camera view too narrow in request scan flow

The camera preview in the request scan flow appears too narrow. We may want to adjust the layout for landscape mode to improve the view.

Screen.Recording.2026-03-14.at.15.39.17.mov

Bug 5: [Android] The report action's context menu looks weird

Screen.Recording.2026-03-14.at.15.50.25.mov

@truph01
Copy link
Copy Markdown
Contributor

truph01 commented Mar 14, 2026

@GCyganek Besides the issues above, I noticed that there are quite a few UI problems in landscape mode that still need improvement. However, I’m not sure we should try to address all of them in this PR, since deciding on the appropriate UI changes and implementing them will likely take additional time.

Perhaps we could focus on a few important flows to review, test, and fix in this PR, and leave the remaining issues to be addressed in follow-up PRs.

@mountiny
Copy link
Copy Markdown
Contributor

Yeah I think we should mainly focus on making it work and usable now, anything minor can be handled later

@GCyganek
Copy link
Copy Markdown
Contributor Author

@truph01 thank you so much for testing and reporting these issues! I'll be working on them today

@mountiny is it ok if I just fix all these issues here and then we can merge and keep on fixing remaining issues that pop up until the end of March?

@truph01
Copy link
Copy Markdown
Contributor

truph01 commented Mar 16, 2026

@mountiny I think most of these issues will require input from the design team as well.

@GCyganek
Copy link
Copy Markdown
Contributor Author

I noticed that there are quite a few UI problems in landscape mode that still need improvement. However, I’m not sure we should try to address all of them in this PR, since deciding on the appropriate UI changes and implementing them will likely take additional time.

I guess that anything that comes to mind can be reported here/on the issue and then we can decide if we want to have it fixed.

@GCyganek
Copy link
Copy Markdown
Contributor Author

@mountiny I think most of these issues will require input from the design team as well.

Yeah, @dubielzyk-expensify I see that you're the main designer on this issue, right? Do you have any thoughts on the issues reported above by @truph01? Do you have any requests for the main UI components like the header or bottom menu?

@GCyganek
Copy link
Copy Markdown
Contributor Author

Bug 1: [Android] Unable to scroll the popover menu

The popover menu cannot be scrolled on Android.

Fixed by making it scrollable and limiting max height to 75% of the screen height in landscape mode so that there is an area that user can tap to close the menu:

Screen.Recording.2026-03-16.at.13.22.51.mov

@mountiny
Copy link
Copy Markdown
Contributor

I think that we:

  1. fix the bugs that make it unusable
  2. leave minor ui issues for later, most users will not use the app in the landscape mode
  3. Can we gate the mode in some way for only selected users? so then only QA could test it in staging?

@GCyganek
Copy link
Copy Markdown
Contributor Author

3. Can we gate the mode in some way for only selected users? so then only QA could test it in staging?

The landscape mode was not locked in JS, but in the config (Info.plist, .xml, AndroidManifext.xml files), so to enable it only for selected group of users we would probably need:

  1. to setup a beta
  2. lock the landscape mode in JS for users outside of the beta + we would need to add a library that allows us to lock the orientation in JS, for example expo-screen-orientation

That's how I see it

@GCyganek
Copy link
Copy Markdown
Contributor Author

GCyganek commented Mar 16, 2026

Bug 2: [Android] Input field layout issue when focusing

When the input field receives focus and the keyboard opens, the layout looks incorrect.

I don't know if we should treat it as a bug, not sure what if there is a better alternative to this. This is a global behaviour in the landscape mode - whenever user taps a text input it shows a fullscreen keyboard:

Screen.Recording.2026-03-16.at.13.46.54.mov

Let's see what @Expensify/design thinks about it

@mountiny
Copy link
Copy Markdown
Contributor

hmm I am not sure if its worth that effort to gate it

@shawnborton
Copy link
Copy Markdown
Contributor

Agree with that too.

@GCyganek
Copy link
Copy Markdown
Contributor Author

Bug 3: [Android] Digit input partially hidden in landscape mode

The digit input is partially hidden. In landscape mode, it might be better to display it on the left or right side instead of at the bottom.

It's painful, but usable I think:

Screen.Recording.2026-03-16.at.13.51.28.mov

Would wait for @Expensify/design opinion on this. I'm not sure if there is a way to fit the keyboard entirely on the screen with the input field in view. Maybe just making sure that the input field is sticky so that it's always in view would be enough here if we even want to make some improvements here?

@shawnborton
Copy link
Copy Markdown
Contributor

I don't know how much time I would spend optimizing this personally. But one idea we could do would be to have some kind of split layout:
CleanShot 2026-03-16 at 09 00 58@2x

@GCyganek
Copy link
Copy Markdown
Contributor Author

GCyganek commented Mar 16, 2026

I don't know how much time I would spend optimizing this personally. But one idea we could do would be to have some kind of split layout:

If we were to split the bugs into groups:

  1. bug that makes something unusable
  2. makes UX painful
  3. UX improvements recommended

I'd say it's in the second group where for example the first bug with FAB popover not being closable and scrollable is in the first group. So let's keep it high on the list and try to fix it before the deadline if we have enough time and not on this PR?

@shawnborton
Copy link
Copy Markdown
Contributor

That makes sense to me, I like breaking it down into those three buckets like that. cc @Expensify/design for viz too

@dannymcclain
Copy link
Copy Markdown
Contributor

Oh yeah I like breaking it down that way too. Makes sense to me 👍

@GCyganek
Copy link
Copy Markdown
Contributor Author

Bug 4: Camera view too narrow in request scan flow

The camera preview in the request scan flow appears too narrow. We may want to adjust the layout for landscape mode to improve the view.

Any idea @Expensify/design how to handle this? I'd treat it as "makes UX painful" bug.

Screenshot 2026-03-16 at 15 49 36

@GCyganek
Copy link
Copy Markdown
Contributor Author

GCyganek commented Mar 16, 2026

Adding this here to make sure it's not forgotten: clicking on scan multiple receipts button opens a modal in broken layout that can't be closed.

Screen.Recording.2026-03-16.at.15.49.47.mov

EDIT: Fixed

@shawnborton
Copy link
Copy Markdown
Contributor

Any idea @Expensify/design how to handle this? I'd treat it as "makes UX painful" bug.

Probably another case where we might want to do a split view?
CleanShot 2026-03-16 at 11 02 39@2x

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87364 was identified to be related to this PR.

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87366 was identified to be related to this PR.

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87369 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87370 was identified to be related to this PR.

@jponikarchuk
Copy link
Copy Markdown

Deploy Blocker #87372 was identified to be related to this PR.

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87375 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87374 was identified to be related to this PR

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87377 was identified to be related to this PR

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87401 was identified to be related to this PR.

@nlemma
Copy link
Copy Markdown

nlemma commented Apr 8, 2026

Deploy Blocker #87403 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87405 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87406 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87415 was identified to be related to this PR.

@lanitochka17
Copy link
Copy Markdown

Deploy Blocker ##87423 was identified to be related to this PR.

@OSBotify
Copy link
Copy Markdown
Contributor

OSBotify commented Apr 9, 2026

🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.54-7 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.