Skip to content
4 changes: 2 additions & 2 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function MoneyReportHeaderContent({reportID: reportIDProp, shouldDisplayBackButt

// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use a correct layout for the hold expense modal https://github.com/Expensify/App/pull/47990#issuecomment-2362382026
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout, isSmallScreenWidth, isMediumScreenWidth, isInLandscapeMode} = useResponsiveLayout();
const shouldDisplayNarrowVersion = shouldUseNarrowLayout || isMediumScreenWidth;
const route = useRoute<
| PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>
Expand All @@ -78,7 +78,7 @@ function MoneyReportHeaderContent({reportID: reportIDProp, shouldDisplayBackButt

const {isWideRHPDisplayedOnWideLayout, isSuperWideRHPDisplayedOnWideLayout} = useResponsiveLayoutOnWideRHP();

const shouldDisplayNarrowMoreButton = !shouldDisplayNarrowVersion || isWideRHPDisplayedOnWideLayout || isSuperWideRHPDisplayedOnWideLayout;
const shouldDisplayNarrowMoreButton = isInLandscapeMode || !shouldDisplayNarrowVersion || isWideRHPDisplayedOnWideLayout || isSuperWideRHPDisplayedOnWideLayout;
const isReportInRHP = route.name !== SCREENS.REPORT;
const shouldDisplaySearchRouter = !isReportInRHP || isSmallScreenWidth;
const isReportInSearch = route.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT || route.name === SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT;
Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function MoneyRequestHeader({reportID: reportIDProp, onBackButtonPress}: MoneyRe

// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use a correct layout for the hold expense modal https://github.com/Expensify/App/pull/47990#issuecomment-2362382026
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout, isSmallScreenWidth, isInLandscapeMode} = useResponsiveLayout();
const route = useRoute<
| PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_REPORT>
Expand Down Expand Up @@ -91,7 +91,7 @@ function MoneyRequestHeader({reportID: reportIDProp, onBackButtonPress}: MoneyRe
const isFromReviewDuplicates = !!route.params.backTo?.replaceAll(/\?.*/g, '').endsWith('/duplicates/review');
const shouldDisplayTransactionNavigation = !!(reportID && isReportInRHP);
const shouldOpenParentReportInCurrentTab = !isSelfDM(parentReport);
const shouldDisplayNarrowMoreButton = !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const shouldDisplayNarrowMoreButton = isInLandscapeMode || !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);

const getStatusIcon: (src: IconAsset) => ReactNode = (src) => (
<Icon
Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyRequestHeaderActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ type MoneyRequestHeaderActionsProps = {
function MoneyRequestHeaderActions({reportID, onBackButtonPress}: MoneyRequestHeaderActionsProps) {
const styles = useThemeStyles();
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout, isSmallScreenWidth, isInLandscapeMode} = useResponsiveLayout();
const {wideRHPRouteKeys} = useWideRHPState();
const route = useRoute<
| PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT>
>();

const isNarrow = !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const isNarrow = isInLandscapeMode || !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const shouldDisplayTransactionNavigation = !!(reportID && route.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyRequestHeaderPrimaryAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function MoneyRequestHeaderPrimaryAction({reportID}: MoneyRequestHeaderPrimaryAc
const {isDelegateAccessRestricted} = useDelegateNoAccessState();
const {showDelegateNoAccessModal} = useDelegateNoAccessActions();
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const {shouldUseNarrowLayout, isSmallScreenWidth, isInLandscapeMode} = useResponsiveLayout();
const {wideRHPRouteKeys} = useWideRHPState();
const route = useRoute<
| PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT>
>();

const isNarrow = !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const isNarrow = isInLandscapeMode || !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const {isOffline} = useNetwork();
const isFromReviewDuplicates = !!route.params.backTo?.replaceAll(/\?.*/g, '').endsWith('/duplicates/review');

Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyRequestHeaderSecondaryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type MoneyRequestHeaderSecondaryActionsProps = {

function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: MoneyRequestHeaderSecondaryActionsProps) {
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isInNarrowPaneModal, shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const {isInNarrowPaneModal, shouldUseNarrowLayout, isSmallScreenWidth, isInLandscapeMode} = useResponsiveLayout();
const route = useRoute<
| PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>
| PlatformStackRouteProp<RightModalNavigatorParamList, typeof SCREENS.RIGHT_MODAL.SEARCH_REPORT>
Expand All @@ -108,7 +108,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
] as const);

const {wideRHPRouteKeys} = useWideRHPState();
const isNarrow = !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const isNarrow = isInLandscapeMode || !shouldUseNarrowLayout || (wideRHPRouteKeys.length > 0 && !isSmallScreenWidth);
const {isOffline} = useNetwork();

// Per-key Onyx subscriptions
Expand Down
11 changes: 6 additions & 5 deletions src/pages/domain/Admins/DomainAdminsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const theme = useTheme();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
const illustrations = useMemoizedLazyIllustrations(['UserShield']);
const icons = useMemoizedLazyExpensifyIcons(['Gear', 'Plus', 'DotIndicator']);

Expand Down Expand Up @@ -75,6 +75,7 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
);

const hasSettingsErrors = hasDomainAdminsSettingsErrors(domainErrors);
const shouldDisplayNarrowHeaderButton = isInLandscapeMode || !shouldUseNarrowLayout;

const headerContent = isAdmin ? (
<View style={[styles.flexRow, styles.gap2]}>
Expand All @@ -83,17 +84,17 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
onPress={() => Navigation.navigate(ROUTES.DOMAIN_ADD_ADMIN.getRoute(domainAccountID))}
text={translate('domain.admins.addAdmin')}
icon={icons.Plus}
innerStyles={[shouldUseNarrowLayout && styles.alignItemsCenter]}
style={shouldUseNarrowLayout && [styles.flexGrow1, styles.mb3]}
innerStyles={[!shouldDisplayNarrowHeaderButton && styles.alignItemsCenter]}
style={!shouldDisplayNarrowHeaderButton && [styles.flexGrow1, styles.mb3]}
/>
<Button
onPress={() => Navigation.navigate(ROUTES.DOMAIN_ADMINS_SETTINGS.getRoute(domainAccountID))}
text={translate('domain.common.settings')}
icon={hasSettingsErrors ? icons.DotIndicator : icons.Gear}
iconFill={hasSettingsErrors ? theme.danger : undefined}
iconHoverFill={hasSettingsErrors ? theme.dangerHover : undefined}
innerStyles={[shouldUseNarrowLayout && styles.alignItemsCenter]}
style={shouldUseNarrowLayout ? [styles.flexGrow0, styles.mb3] : undefined}
innerStyles={[!shouldDisplayNarrowHeaderButton && styles.alignItemsCenter]}
style={!shouldDisplayNarrowHeaderButton ? [styles.flexGrow0, styles.mb3] : undefined}
/>
</View>
) : null;
Expand Down
8 changes: 5 additions & 3 deletions src/pages/domain/BaseDomainMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ function BaseDomainMembersPage({
}: BaseDomainMembersPageProps) {
const {formatPhoneNumber, localeCompare, translate} = useLocalize();
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const icons = useMemoizedLazyExpensifyIcons(['FallbackAvatar']);
const illustrations = useMemoizedLazyIllustrations(['EmptyShelves']);

const shouldDisplayNarrowHeaderButton = isInLandscapeMode || !shouldUseNarrowLayout;

const data: MemberOption[] = accountIDs
.filter((accountID) => {
const details = personalDetails?.[accountID];
Expand Down Expand Up @@ -271,9 +273,9 @@ function BaseDomainMembersPage({
shouldShowBackButton={shouldUseNarrowLayout}
shouldUseHeadlineHeader={!useSelectionModeHeader}
>
{!shouldUseNarrowLayout && !!headerContent && <View style={[styles.flexRow, styles.gap2]}>{headerContent}</View>}
{shouldDisplayNarrowHeaderButton && !!headerContent && <View style={[styles.flexRow, styles.gap2]}>{headerContent}</View>}
</HeaderWithBackButton>
{shouldUseNarrowLayout && !!headerContent && <View style={[styles.ph5, styles.flexRow, styles.gap2]}>{headerContent}</View>}
{!shouldDisplayNarrowHeaderButton && !!headerContent && <View style={[styles.ph5, styles.flexRow, styles.gap2]}>{headerContent}</View>}
<SelectionListWithModal
data={filteredData}
shouldShowRightCaret
Expand Down
11 changes: 6 additions & 5 deletions src/pages/domain/Members/DomainMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ function DomainMembersPage({route}: DomainMembersPageProps) {
const styles = useThemeStyles();
const illustrations = useMemoizedLazyIllustrations(['Profile']);
const icons = useMemoizedLazyExpensifyIcons(['Plus', 'Gear', 'DotIndicator', 'RemoveMembers', 'Download', 'Transfer']);
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
const [selectedMembers, setSelectedMembers] = useState<string[]>([]);
const clearSelectedMembers = () => setSelectedMembers([]);
const isMobileSelectionModeEnabled = useMobileSelectionMode(clearSelectedMembers);
const {isOffline} = useNetwork();

const canSelectMultiple = shouldUseNarrowLayout ? isMobileSelectionModeEnabled : true;
const selectionModeHeader = isMobileSelectionModeEnabled && shouldUseNarrowLayout;
const shouldDisplayNarrowHeaderButton = isInLandscapeMode || !shouldUseNarrowLayout;

const [domainErrors] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`);
const [domainPendingActions] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`, {selector: memberPendingActionSelector});
Expand Down Expand Up @@ -228,10 +229,10 @@ function DomainMembersPage({route}: DomainMembersPageProps) {
onPress={() => null}
options={getBulkActionsButtonOptions()}
isSplitButton={false}
style={shouldUseNarrowLayout ? [styles.flexGrow1, styles.mb3] : undefined}
style={!shouldDisplayNarrowHeaderButton ? [styles.flexGrow1, styles.mb3] : undefined}
isDisabled={!selectedMembers.length}
testID="DomainMembersPage-header-dropdown-menu-button"
wrapperStyle={shouldUseNarrowLayout && styles.flexGrow1}
wrapperStyle={!shouldDisplayNarrowHeaderButton && styles.flexGrow1}
/>
) : (
<View style={[styles.flexRow, styles.gap2]}>
Expand All @@ -240,8 +241,8 @@ function DomainMembersPage({route}: DomainMembersPageProps) {
onPress={() => Navigation.navigate(ROUTES.DOMAIN_ADD_MEMBER.getRoute(domainAccountID))}
text={translate('domain.members.addMember')}
icon={icons.Plus}
innerStyles={[shouldUseNarrowLayout && styles.alignItemsCenter]}
style={shouldUseNarrowLayout ? [styles.flexGrow1, styles.mb3] : undefined}
innerStyles={[!shouldDisplayNarrowHeaderButton && styles.alignItemsCenter]}
style={!shouldDisplayNarrowHeaderButton ? [styles.flexGrow1, styles.mb3] : undefined}
/>
<ButtonWithDropdownMenu
success={false}
Expand Down
14 changes: 8 additions & 6 deletions src/pages/settings/Rules/ExpenseRulesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function ExpenseRulesPage() {
const genericIllustration = useGenericEmptyStateIllustration();
const isMobileSelectionModeEnabled = useMobileSelectionMode();
const [expenseRules = getEmptyArray<ExpenseRule>(), expenseRulesResult] = useOnyx(ONYXKEYS.NVP_EXPENSE_RULES);
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
useDocumentTitle(translate('expenseRulesPage.title'));
const [selectedRules, setSelectedRules] = useState<string[]>([]);
const [deleteConfirmModalVisible, setDeleteConfirmModalVisible] = useState(false);
Expand Down Expand Up @@ -178,6 +178,8 @@ function ExpenseRulesPage() {
});
}

const shouldDisplayNarrowHeaderButton = isInLandscapeMode || !shouldUseNarrowLayout;

const headerButton = isInSelectionMode ? (
<ButtonWithDropdownMenu
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
Expand All @@ -187,17 +189,17 @@ function ExpenseRulesPage() {
onPress={() => null}
options={headerDropdownOptions}
shouldAlwaysShowDropdownMenu
style={[shouldUseNarrowLayout && styles.flexGrow1, shouldUseNarrowLayout && styles.mb3]}
style={[!shouldDisplayNarrowHeaderButton && styles.flexGrow1, !shouldDisplayNarrowHeaderButton && styles.mb3]}
testID="ExpenseRulesPage-header-dropdown-menu-button"
/>
) : (
<View style={[styles.flexRow, styles.gap2, shouldUseNarrowLayout && styles.mb3]}>
<View style={[styles.flexRow, styles.gap2, !shouldDisplayNarrowHeaderButton && styles.mb3]}>
<Button
success
onPress={navigateToNewRulePage}
icon={icons.Plus}
text={translate('expenseRulesPage.newRule')}
style={[shouldUseNarrowLayout && styles.flex1]}
style={[!shouldDisplayNarrowHeaderButton && styles.flex1]}
sentryLabel={CONST.SENTRY_LABEL.SETTINGS_RULES.NEW_RULE}
/>
</View>
Expand Down Expand Up @@ -260,9 +262,9 @@ function ExpenseRulesPage() {
shouldDisplayHelpButton
title={selectionModeHeader ? translate('common.selectMultiple') : translate('expenseRulesPage.title')}
>
{!shouldUseNarrowLayout && hasRules && headerButton}
{shouldDisplayNarrowHeaderButton && hasRules && headerButton}
</HeaderWithBackButton>
{shouldUseNarrowLayout && hasRules && <View style={[styles.pl5, styles.pr5]}>{headerButton}</View>}
{!shouldDisplayNarrowHeaderButton && hasRules && <View style={[styles.pl5, styles.pr5]}>{headerButton}</View>}
{!hasRules && !isLoading && headerContent}
{!hasRules && !isLoading && (
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexShrink0]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function EarlyDiscountBanner({isSubscriptionPage, onboardingHelpDropdownButton,
const initialDiscountInfo = getEarlyDiscountInfo(firstDayFreeTrial);
const [discountInfo, setDiscountInfo] = useState(initialDiscountInfo);
const [isDismissed, setIsDismissed] = useState(false);
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
const icons = useMemoizedLazyExpensifyIcons(['Close']);
useEffect(() => {
const intervalID = setInterval(() => {
Expand Down Expand Up @@ -80,21 +80,22 @@ function EarlyDiscountBanner({isSubscriptionPage, onboardingHelpDropdownButton,
);

const rightComponent = useMemo(() => {
const smallScreenStyle = shouldUseNarrowLayout ? [styles.flex0, styles.flexBasis100, styles.justifyContentCenter] : [];
const smallScreenStyle = shouldUseNarrowLayout && !isInLandscapeMode ? [styles.flex0, styles.flexBasis100, styles.justifyContentCenter] : [];
return (
<View style={[styles.flexRow, styles.gap2, smallScreenStyle, styles.alignItemsCenter]}>
{onboardingHelpDropdownButton}
<Button
success={!hasActiveScheduledCall}
style={shouldUseNarrowLayout ? [styles.earlyDiscountButton, styles.flexGrow2] : styles.mr2}
style={shouldUseNarrowLayout && !isInLandscapeMode ? [styles.earlyDiscountButton, styles.flexGrow2] : styles.mr2}
text={translate('subscription.billingBanner.earlyDiscount.claimOffer')}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.getRoute(Navigation.getActiveRoute()))}
/>
{!shouldUseNarrowLayout && dismissButton}
{(!shouldUseNarrowLayout || isInLandscapeMode) && dismissButton}
</View>
);
}, [
shouldUseNarrowLayout,
isInLandscapeMode,
hasActiveScheduledCall,
styles.flex0,
styles.flexBasis100,
Expand Down Expand Up @@ -123,7 +124,7 @@ function EarlyDiscountBanner({isSubscriptionPage, onboardingHelpDropdownButton,
) : (
<View style={[styles.justifyContentBetween, styles.flexRow]}>
<RenderHTML html={translate('subscription.billingBanner.earlyDiscount.onboardingChatTitle', discountInfo?.discountType)} />
{shouldUseNarrowLayout && dismissButton}
{shouldUseNarrowLayout && !isInLandscapeMode && dismissButton}
</View>
);

Expand Down
Loading
Loading