Repository navigation
Use narrow layout in landscape mode mWeb #97880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mjasikowski
merged 27 commits into
Expensify:main
from
software-mansion-labs:@GCyganek/landscape-mweb/use-narrow-layout-for-mweb-landscape
Sep 4, 2026
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
ab5dd54
Use narrow layout in landscape mode mWeb
GCyganek 1a187dc
keyboardShouldPersistTaps
GCyganek 23ce776
Fix isInLandscapeMode mWeb check
GCyganek a477b6c
isInLandscapeMode web improvements
GCyganek 0bfcc9f
isMobile import
GCyganek b136cda
Merge branch 'main' into @GCyganek/landscape-mweb/use-narrow-layout-f…
GCyganek 9f87c27
Listen to orientation changes
GCyganek bbc63a9
Merge branch 'main' into @GCyganek/landscape-mweb/use-narrow-layout-f…
GCyganek 3bb74c2
Fix landscape mode true on tablets
GCyganek 17f2adc
Recompute after attach
GCyganek 6145aca
Prioritize usage of isInLandscapeMode from useResponsiveLayout if alr…
GCyganek 50e34ac
Fix layout flickers on orientation changes
GCyganek bc78c26
Merge branch 'main' into @GCyganek/landscape-mweb/use-narrow-layout-f…
GCyganek 0ab7037
Fix knip check
GCyganek 908f7f7
useEmojiPickerMenu use isLandscapeMenu util
GCyganek f1f2fa9
Fix crashes on iOS safari mWeb when rotating to landscape with open k…
GCyganek a48c977
Fix isMediumScreenWidth check in landscapem ode
GCyganek ae9ccba
delete console.log
GCyganek e590bc2
Use the same default as getIsNarrowLayout()
GCyganek 17c07e9
Fix Save view screen safe area iOS Safari
GCyganek 58ba55b
Merge branch 'main' into @GCyganek/landscape-mweb/use-narrow-layout-f…
GCyganek 31569d3
useScrollableWrapper
GCyganek acf498d
Merge branch 'main' into @GCyganek/landscape-mweb/use-narrow-layout-f…
GCyganek 4a610aa
Fix GPS; shouldUseNarrowLayout do not check isInLandscapeMode
GCyganek 81dba94
getStyleWithEnvSafeAreaPadding()
GCyganek 4a96104
SearchSavePage options
GCyganek cf57701
Fix Workspace screens having double safe area paddings
GCyganek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,16 @@ | ||
| import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
|
|
||
| import isInLandscapeMode from '@libs/isInLandscapeMode'; | ||
|
|
||
| /** | ||
| * We only want to change UI according to the landscape mode on native platforms. | ||
| * Returns whether the device is currently in landscape orientation. | ||
| * If component already uses useResponsiveLayout, it will return the value from that hook. | ||
| * If component already uses useWindowDimensions, use @libs/isInLandscapeMode instead. | ||
| */ | ||
| function useIsInLandscapeMode(): boolean { | ||
| return false; | ||
| const {windowWidth, windowHeight} = useWindowDimensions(); | ||
|
|
||
| return isInLandscapeMode(windowWidth, windowHeight); | ||
| } | ||
|
|
||
| export default useIsInLandscapeMode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth'; | ||
| import isInLandscapeMode from '@libs/isInLandscapeMode'; | ||
|
|
||
| export default function getIsNarrowLayout() { | ||
| return getIsSmallScreenWidth(); | ||
| return getIsSmallScreenWidth() || isInLandscapeMode(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| import DeviceInfo from 'react-native-device-info'; | ||
|
|
||
| const isTablet = DeviceInfo.isTablet(); | ||
|
|
||
| /** | ||
| * Returns whether the device is currently in landscape orientation. | ||
| * Returns false on tablets. | ||
| */ | ||
| export default function isInLandscapeMode(windowWidth: number, windowHeight: number): boolean { | ||
| const isTablet = DeviceInfo.isTablet(); | ||
| return !isTablet && windowWidth > windowHeight; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,37 @@ | ||
| import {isMobile} from '@libs/Browser'; | ||
|
|
||
| import {Dimensions} from 'react-native'; | ||
|
|
||
| const TABLET_MIN_SCREEN_DIMENSION = 600; | ||
|
|
||
| function isTabletScreen(): boolean { | ||
| return Math.min(window.screen.width, window.screen.height) >= TABLET_MIN_SCREEN_DIMENSION; | ||
| } | ||
|
|
||
| const isMobilePhoneWeb = isMobile() && !isTabletScreen(); | ||
|
|
||
| const screenShortSide = Math.min(window.screen.width, window.screen.height); | ||
| const screenLongSide = Math.max(window.screen.width, window.screen.height); | ||
|
|
||
| function getViewportWidth(): number { | ||
| return Dimensions.get('window').width; | ||
| } | ||
|
|
||
| /** | ||
| * We only want to change UI according to the landscape mode on native platforms. | ||
| * Returns whether the device is currently in landscape orientation. Returns false on tablets and non-mobile browsers. | ||
| * Derived from the width instead of the Screen Orientation API (its `change` event lands in a different task than | ||
| * `resize`, causing a flicker) and instead of the height (the soft keyboard shrinks height). | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| export default function isInLandscapeMode(windowWidth: number, windowHeight: number): boolean { | ||
| return false; | ||
| function isInLandscapeMode(windowWidth: number = getViewportWidth(), windowHeight?: number): boolean { | ||
| if (!isMobilePhoneWeb) { | ||
| return false; | ||
| } | ||
|
|
||
| const distanceToLongSide = Math.abs(windowWidth - screenLongSide); | ||
| const distanceToShortSide = Math.abs(windowWidth - screenShortSide); | ||
|
|
||
| return distanceToLongSide < distanceToShortSide; | ||
| } | ||
|
|
||
| export default isInLandscapeMode; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.