Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/AddPaymentMethodMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function AddPaymentMethodMenu({
anchorPosition={anchorPosition}
anchorAlignment={anchorAlignment}
anchorRef={anchorRef}
enableEdgeToEdgeBottomSafeAreaPadding
onItemSelected={() => {
setRestoreFocusType(CONST.MODAL.RESTORE_FOCUS_TYPE.DELETE);
onClose();
Expand Down
1 change: 1 addition & 0 deletions src/components/AvatarWithImagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ function AvatarWithImagePicker({
menuItems={menuItems}
anchorAlignment={anchorAlignment}
anchorRef={anchorRef}
enableEdgeToEdgeBottomSafeAreaPadding
/>
</>
);
Expand Down
6 changes: 2 additions & 4 deletions src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import usePopoverPosition from '@hooks/usePopoverPosition';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
Expand Down Expand Up @@ -131,8 +130,6 @@ function ButtonWithDropdownMenu<IValueType>({ref, ...props}: ButtonWithDropdownM
setSelectedItemIndex(defaultSelectedIndex);
}, [defaultSelectedIndex]);

const {paddingBottom} = useSafeAreaPaddings(true);

const {calculatePopoverPosition} = usePopoverPosition();

useEffect(() => {
Expand Down Expand Up @@ -342,9 +339,10 @@ function ButtonWithDropdownMenu<IValueType>({ref, ...props}: ButtonWithDropdownM
anchorPosition={popoverAnchorPosition}
shouldShowRadioButton={shouldShowRadioButton}
anchorRef={dropdownAnchor}
scrollContainerStyle={!shouldUseModalPaddingStyle && isSmallScreenWidth && {...styles.pt4, paddingBottom}}
scrollContainerStyle={!shouldUseModalPaddingStyle && isSmallScreenWidth && styles.pt4}
anchorAlignment={anchorAlignment}
shouldUseModalPaddingStyle={shouldUseModalPaddingStyle}
enableEdgeToEdgeBottomSafeAreaPadding
headerText={menuHeaderText}
shouldUseScrollView={shouldPopoverUseScrollView}
containerStyles={containerStyles}
Expand Down
2 changes: 2 additions & 0 deletions src/components/CategoryPicker/CategoryPickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ function CategoryPickerModal({
shouldMeasureAnchorPositionFromTop={shouldMeasureAnchorPositionFromTop}
shouldSkipRemeasurement
shouldDisplayBelowModals
enableEdgeToEdgeBottomSafeAreaPadding
>
<View style={[StyleUtils.getHeight(popoverDimensions.height), styles.flexColumn, styles.pt4]}>
<CategoryPicker
selectedCategory={selectedCategory}
policyID={policyID}
onSubmit={handleCategorySelect}
addBottomSafeAreaPadding
/>
</View>
</PopoverWithMeasuredContent>
Expand Down
1 change: 1 addition & 0 deletions src/components/ConnectToCertiniaFlow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function ConnectToCertiniaFlow({policyID}: ConnectToCertiniaFlowProps) {
anchorPosition={connectionOptionsPopoverPosition}
anchorAlignment={anchorAlignment}
anchorRef={threeDotsMenuContainerRef}
enableEdgeToEdgeBottomSafeAreaPadding
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ConnectToNetSuiteFlow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) {
anchorPosition={reuseConnectionPopoverPosition}
anchorAlignment={{horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP}}
anchorRef={threeDotsMenuContainerRef}
enableEdgeToEdgeBottomSafeAreaPadding
/>
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/DecisionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ function DecisionModal({
onModalHide={onModalHide}
shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false}
shouldHandleNavigationBack={shouldHandleNavigationBack}
enableEdgeToEdgeBottomSafeAreaPadding
>
<ScrollView contentContainerStyle={styles.p5}>
<ScrollView
contentContainerStyle={styles.p5}
addBottomSafeAreaPadding
>
<View>
<View style={[styles.flexRow, styles.mb5]}>
<Header
Expand Down
5 changes: 4 additions & 1 deletion src/components/ExportDownloadStatusModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useEnvironment from '@hooks/useEnvironment';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -109,6 +110,7 @@ function ExportDownloadStatusModal({exportID, isVisible, onClose, failedBody}: E
};

const isNonDismissible = isPreparing;
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true, style: styles.m5});

const renderContent = () => {
if (isPreparing) {
Expand Down Expand Up @@ -240,8 +242,9 @@ function ExportDownloadStatusModal({exportID, isVisible, onClose, failedBody}: E
onBackdropPress={isNonDismissible ? () => {} : undefined}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={styles.pv0}
enableEdgeToEdgeBottomSafeAreaPadding
>
<View style={styles.m5}>{renderContent()}</View>
<View style={bottomSafeAreaPaddingStyle}>{renderContent()}</View>
</Modal>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import MenuItem from '@components/MenuItem';
import Modal from '@components/Modal';

import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';

Expand All @@ -11,6 +12,7 @@ import CONST from '@src/CONST';
import type {Ref} from 'react';

import React, {useImperativeHandle, useState} from 'react';
import {View} from 'react-native';

type MoneyRequestReportTransactionLongPressModalHandle = {
/** Opens the modal for the given transaction */
Expand All @@ -33,6 +35,7 @@ function MoneyRequestReportTransactionLongPressModal({isMobileSelectionModeEnabl
const expensifyIcons = useMemoizedLazyExpensifyIcons(['CheckSquare']);
const [isVisible, setIsVisible] = useState(false);
const [selectedTransactionID, setSelectedTransactionID] = useState('');
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true});

useImperativeHandle(ref, () => ({
show: (transactionID: string) => {
Expand All @@ -47,18 +50,21 @@ function MoneyRequestReportTransactionLongPressModal({isMobileSelectionModeEnabl
type={CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
onClose={() => setIsVisible(false)}
shouldPreventScrollOnFocus
enableEdgeToEdgeBottomSafeAreaPadding
>
<MenuItem
title={translate('common.select')}
icon={expensifyIcons.CheckSquare}
onPress={() => {
if (!isMobileSelectionModeEnabled) {
turnOnMobileSelectionMode();
}
toggleTransaction(selectedTransactionID);
setIsVisible(false);
}}
/>
<View style={bottomSafeAreaPaddingStyle}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enable edge-to-edge mode for this padded modal

On devices with a nonzero bottom safe-area inset, this wrapper adds the inset through useBottomSafeSafeAreaPaddingStyle, while the bottom-docked Modal still applies its default safe-area padding because enableEdgeToEdgeBottomSafeAreaPadding was not set. Opening the transaction long-press menu therefore produces double bottom spacing; enable edge-to-edge mode on this modal as done for the other migrated bottom-docked menus.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 05f009a

<MenuItem
title={translate('common.select')}
icon={expensifyIcons.CheckSquare}
onPress={() => {
if (!isMobileSelectionModeEnabled) {
turnOnMobileSelectionMode();
}
toggleTransaction(selectedTransactionID);
setIsVisible(false);
}}
/>
</View>
</Modal>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Modal from '@components/Modal';
import Text from '@components/Text';
import TextLink from '@components/TextLink';

import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand All @@ -30,14 +31,17 @@ function BaseOpenAppFailureModal({onRefreshAndTryAgainButtonPress}: BaseOpenAppF
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();

const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true, style: styles.p6});

return (
<Modal
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
isVisible={isOpenAppFailureModalOpen}
innerContainerStyle={styles.pv0}
onClose={() => setIsOpenAppFailureModalOpen(false)}
enableEdgeToEdgeBottomSafeAreaPadding
>
<View style={[styles.p6]}>
<View style={bottomSafeAreaPaddingStyle}>
<Header
title={translate('openAppFailureModal.title')}
textStyles={[styles.mb2]}
Expand Down
6 changes: 5 additions & 1 deletion src/components/PDFDownloadModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -90,15 +91,18 @@ function PDFDownloadModal({
context: loadingReasonContext,
};

const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true, style: [styles.flexRow, styles.m5]});

return (
<Modal
onClose={onClose}
onModalHide={onModalHide}
isVisible={isVisible}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={styles.pv0}
enableEdgeToEdgeBottomSafeAreaPadding
>
<View style={[styles.flexRow, styles.m5]}>
<View style={bottomSafeAreaPaddingStyle}>
<View style={[styles.flex1]}>
<View style={[styles.flexRow, styles.mb4]}>
<View style={[styles.flex1]}>
Expand Down
5 changes: 4 additions & 1 deletion src/components/ProactiveAppReviewModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -32,15 +33,17 @@ function ProactiveAppReviewModal({isVisible, onPositive, onNegative, onSkip}: Pr
const styles = useThemeStyles();
const illustrations = useMemoizedLazyIllustrations(['ToddWithPhones']);
const {translate} = useLocalize();
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true, style: styles.m5});

return (
<Modal
onClose={onSkip}
isVisible={isVisible}
type={shouldUseNarrowLayout ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={styles.pv0}
enableEdgeToEdgeBottomSafeAreaPadding
>
<View style={[styles.m5]}>
<View style={bottomSafeAreaPaddingStyle}>
{/* Todd with phones illustration */}
<View style={[styles.alignItemsCenter, styles.mb3]}>
<ImageSVG
Expand Down
5 changes: 4 additions & 1 deletion src/components/RequireTwoFactorAuthenticationModal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -47,15 +48,17 @@ function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description,
const StyleUtils = useStyleUtils();
const isReduceMotionEnabled = Accessibility.useReducedMotion();
const illustrations = useMemoizedLazyIllustrations(['Safe']);
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true});
return (
<Modal
onClose={onCancel}
isVisible={isVisible}
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.CONFIRM}
innerContainerStyle={{...styles.pb5, ...styles.pt0, ...styles.boxShadowNone}}
shouldEnableNewFocusManagement={shouldEnableNewFocusManagement}
enableEdgeToEdgeBottomSafeAreaPadding
>
<View>
<View style={bottomSafeAreaPaddingStyle}>
<View style={[styles.cardSectionIllustration, styles.alignItemsCenter, StyleUtils.getBackgroundColorStyle(LottieAnimations.Safe.backgroundColor)]}>
{isReduceMotionEnabled ? (
<ImageSVG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent';
import withViewportOffsetTop from '@components/withViewportOffsetTop';

import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import useOnyx from '@hooks/useOnyx';
import usePopoverPosition from '@hooks/usePopoverPosition';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -61,6 +62,7 @@ function FilterPopupButton({viewportOffsetTop, popoverWidth, wrapperStyle, popov
const {isSmallScreenWidth} = useResponsiveLayout();
const isFocused = useIsFocused();
const styles = useThemeStyles();
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true});
const StyleUtils = useStyleUtils();
const {windowHeight} = useWindowDimensions();
const triggerRef = useRef<View | null>(null);
Expand Down Expand Up @@ -148,8 +150,9 @@ function FilterPopupButton({viewportOffsetTop, popoverWidth, wrapperStyle, popov
shouldSkipRemeasurement
shouldDisplayBelowModals
shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false}
enableEdgeToEdgeBottomSafeAreaPadding
>
{popoverContent}
<View style={bottomSafeAreaPaddingStyle}>{popoverContent}</View>
</PopoverWithMeasuredContent>
)}
</View>
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/SearchList/SearchSelectAllMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function SearchSelectAllMenu({isSelectAllChecked, isIndeterminate, selectedItems
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
}}
enableEdgeToEdgeBottomSafeAreaPadding
/>
<Checkbox
ref={selectAllAnchorRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function SearchActionsBarCreateButton() {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
}}
enableEdgeToEdgeBottomSafeAreaPadding
/>
<Button
ref={createButtonRef}
Expand Down
18 changes: 12 additions & 6 deletions src/components/Search/primitives/useRowLongPressMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Modal from '@components/Modal';
import {useSearchRowSelectionActions} from '@components/Search/SearchContext';
import type {SearchListItem, TransactionListItemType} from '@components/Search/SearchList/ListItem/types';

import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';

Expand All @@ -13,6 +14,7 @@ import CONST from '@src/CONST';

import {useRoute} from '@react-navigation/native';
import React, {useCallback, useState} from 'react';
import {View} from 'react-native';

type UseRowLongPressMenuParams = {
/** Whether long press should be suppressed entirely. */
Expand Down Expand Up @@ -46,6 +48,7 @@ function useRowLongPressMenu({shouldPreventLongPressRow, isSmallScreenWidth, isM
const expensifyIcons = useMemoizedLazyExpensifyIcons(['CheckSquare']);
const {toggle} = useSearchRowSelectionActions();
const route = useRoute();
const bottomSafeAreaPaddingStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding: true});

const [isModalVisible, setIsModalVisible] = useState(false);
const [longPressedItem, setLongPressedItem] = useState<SearchListItem>();
Expand Down Expand Up @@ -99,13 +102,16 @@ function useRowLongPressMenu({shouldPreventLongPressRow, isSmallScreenWidth, isM
type={CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
onClose={() => setIsModalVisible(false)}
shouldPreventScrollOnFocus
enableEdgeToEdgeBottomSafeAreaPadding
>
<MenuItem
title={translate('common.select')}
icon={expensifyIcons.CheckSquare}
onPress={turnOnSelectionMode}
sentryLabel={CONST.SENTRY_LABEL.SEARCH.SELECTION_MODE_MENU_ITEM}
/>
<View style={bottomSafeAreaPaddingStyle}>
<MenuItem
title={translate('common.select')}
icon={expensifyIcons.CheckSquare}
onPress={turnOnSelectionMode}
sentryLabel={CONST.SENTRY_LABEL.SEARCH.SELECTION_MODE_MENU_ITEM}
/>
</View>
</Modal>
);

Expand Down
Loading
Loading