Skip to content

Commit 7d5a59f

Browse files
authored
Merge pull request Expensify#66609 from software-mansion-labs/fix/multiple-right-docked-backdrops
Fix multiple modal backdrops appearing when opening right-docked modals from RHP
2 parents 279235e + e235168 commit 7d5a59f

10 files changed

Lines changed: 8 additions & 20 deletions

File tree

src/components/CategorySelector/CategorySelectorModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function CategorySelectorModal({policyID, isVisible, currentCategory, onCategory
3636
isVisible={isVisible}
3737
onClose={onClose}
3838
onModalHide={onClose}
39-
hideModalContentWhileAnimating
40-
useNativeDriver
4139
enableEdgeToEdgeBottomSafeAreaPadding
4240
shouldUseReanimatedModal
4341
>

src/components/CountryPicker/CountrySelectorModal.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@ function CountrySelectorModal({isVisible, currentCountry, onCountrySelected, onC
6363
isVisible={isVisible}
6464
onClose={onClose}
6565
onModalHide={onClose}
66-
hideModalContentWhileAnimating
67-
useNativeDriver
6866
onBackdropPress={onBackdropPress}
6967
shouldUseReanimatedModal
70-
backdropOpacity={0}
7168
>
7269
<ScreenWrapper
7370
style={[styles.pb0]}

src/components/CurrencyPicker.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ function CurrencyPicker({
102102
isVisible={isPickerVisible}
103103
onClose={hidePickerModal}
104104
onModalHide={hidePickerModal}
105-
hideModalContentWhileAnimating
106105
shouldEnableNewFocusManagement
107-
useNativeDriver
108106
onBackdropPress={Navigation.dismissModal}
109107
shouldUseModalPaddingStyle={false}
110108
shouldHandleNavigationBack

src/components/DatePicker/CalendarPicker/YearPickerModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear
5252
isVisible={isVisible}
5353
onClose={() => onClose?.()}
5454
onModalHide={onClose}
55-
hideModalContentWhileAnimating
56-
useNativeDriver
5755
shouldHandleNavigationBack
5856
shouldUseCustomBackdrop
5957
onBackdropPress={onClose}

src/components/Modal/BaseModal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function BaseModal(
112112
// We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to apply correct modal width
113113
const canUseTouchScreen = canUseTouchScreenCheck();
114114
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
115-
const {isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout();
115+
const {isSmallScreenWidth, shouldUseNarrowLayout, isInNarrowPaneModal} = useResponsiveLayout();
116+
116117
const {sidePanelOffset} = useSidePanel();
117118
const sidePanelStyle = !shouldUseReanimatedModal && shouldApplySidePanelOffset && !isSmallScreenWidth ? {paddingRight: sidePanelOffset.current} : undefined;
118119
const sidePanelReanimatedStyle =
@@ -344,6 +345,11 @@ function BaseModal(
344345
const {originalValues} = useContext(ScreenWrapperOfflineIndicatorContext);
345346
const offlineIndicatorContextValue = useMemo(() => (isInNarrowPane ? (originalValues ?? {}) : {}), [isInNarrowPane, originalValues]);
346347

348+
const backdropOpacityAdjusted =
349+
hideBackdrop || (type === CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED && !isSmallScreenWidth && (isInNarrowPane || isInNarrowPaneModal)) // right_docked modals shouldn't add backdrops when opened in same-width RHP
350+
? 0
351+
: backdropOpacity;
352+
347353
return (
348354
<ModalContext.Provider value={modalContextValue}>
349355
<ScreenWrapperOfflineIndicatorContext.Provider value={offlineIndicatorContextValue}>
@@ -376,7 +382,7 @@ function BaseModal(
376382
swipeThreshold={swipeThreshold}
377383
isVisible={isVisible}
378384
backdropColor={theme.overlay}
379-
backdropOpacity={!shouldUseCustomBackdrop && hideBackdrop ? 0 : backdropOpacity}
385+
backdropOpacity={backdropOpacityAdjusted}
380386
backdropTransitionOutTiming={0}
381387
hasBackdrop={hasBackdrop ?? fullscreen}
382388
coverScreen={fullscreen}

src/components/StatePicker/StateSelectorModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ function StateSelectorModal({isVisible, currentState, onStateSelected, onClose,
6767
isVisible={isVisible}
6868
onClose={onClose}
6969
onModalHide={onClose}
70-
hideModalContentWhileAnimating
71-
useNativeDriver
7270
onBackdropPress={onBackdropPress}
7371
shouldUseReanimatedModal
7472
>

src/pages/workspace/WorkspaceMemberRoleSelectionModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ function WorkspaceMemberDetailsRoleSelectionModal({isVisible, items, onRoleChang
4242
isVisible={isVisible}
4343
onClose={() => onClose?.()}
4444
onModalHide={onClose}
45-
hideModalContentWhileAnimating
46-
useNativeDriver
4745
enableEdgeToEdgeBottomSafeAreaPadding
4846
shouldUseReanimatedModal
4947
>

src/pages/workspace/categories/ExpenseLimitTypeSelector/ExpenseLimitTypeSelectorModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ function ExpenseLimitTypeSelectorModal({isVisible, currentExpenseLimitType, onEx
4444
isVisible={isVisible}
4545
onClose={onClose}
4646
onModalHide={onClose}
47-
hideModalContentWhileAnimating
48-
useNativeDriver
4947
enableEdgeToEdgeBottomSafeAreaPadding
5048
shouldUseReanimatedModal
5149
>

src/pages/workspace/distanceRates/UnitSelector/UnitSelectorModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ function UnitSelectorModal({isVisible, currentUnit, onUnitSelected, onClose, lab
3434
isVisible={isVisible}
3535
onClose={onClose}
3636
onModalHide={onClose}
37-
hideModalContentWhileAnimating
38-
useNativeDriver
3937
shouldUseReanimatedModal
4038
>
4139
<ScreenWrapper

src/styles/utils/generators/ModalStyleUtils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ const createModalStyleUtils: StyleUtilGenerator<GetModalStylesStyleUtil> = ({the
313313
};
314314
}
315315

316-
hideBackdrop = true;
317316
swipeDirection = undefined;
318317
shouldAddBottomSafeAreaPadding = true;
319318
shouldAddTopSafeAreaPadding = true;

0 commit comments

Comments
 (0)