Skip to content

Commit f62ec5e

Browse files
authored
Merge pull request #61462 from linhvovan29546/fix/61003-blank-background-on-desktop-when-use-new-bottom-modal
fix: apply backdrop opacity when using the new modal on desktop
2 parents 9586baf + c9cbb3a commit f62ec5e

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/components/Modal/BottomDockedModal/Backdrop/index.web.tsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {BackdropProps} from '@components/Modal/BottomDockedModal/types';
55
import {PressableWithoutFeedback} from '@components/Pressable';
66
import useLocalize from '@hooks/useLocalize';
77
import useThemeStyles from '@hooks/useThemeStyles';
8+
import variables from '@styles/variables';
89
import CONST from '@src/CONST';
910

1011
const easing = Easing.bezier(0.76, 0.0, 0.24, 1.0).factory();
@@ -15,6 +16,7 @@ function Backdrop({
1516
onBackdropPress,
1617
animationInTiming = CONST.MODAL.ANIMATION_TIMING.DEFAULT_IN,
1718
animationOutTiming = CONST.MODAL.ANIMATION_TIMING.DEFAULT_OUT,
19+
backdropOpacity = variables.overlayOpacity,
1820
}: BackdropProps) {
1921
const styles = useThemeStyles();
2022
const {translate} = useLocalize();
@@ -43,6 +45,13 @@ function Backdrop({
4345
return FadeOut.duration(animationOutTiming);
4446
}, [animationOutTiming]);
4547

48+
const backdropStyle = useMemo(
49+
() => ({
50+
opacity: backdropOpacity,
51+
}),
52+
[backdropOpacity],
53+
);
54+
4655
if (!customBackdrop) {
4756
return (
4857
<PressableWithoutFeedback
@@ -51,7 +60,7 @@ function Backdrop({
5160
onPress={onBackdropPress}
5261
>
5362
<Animated.View
54-
style={[styles.modalBackdrop, style]}
63+
style={[styles.modalBackdrop, backdropStyle, style]}
5564
entering={Entering}
5665
exiting={Exiting}
5766
/>
@@ -64,7 +73,7 @@ function Backdrop({
6473
entering={Entering}
6574
exiting={Exiting}
6675
>
67-
<View style={[styles.modalBackdrop, style]}>{!!customBackdrop && customBackdrop}</View>
76+
<View style={[styles.modalBackdrop, backdropStyle, style]}>{!!customBackdrop && customBackdrop}</View>
6877
</Animated.View>
6978
);
7079
}

src/components/Modal/BottomDockedModal/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ function BottomDockedModal({
132132
width: deviceWidthProp ?? deviceWidth,
133133
height: deviceHeightProp ?? deviceHeight,
134134
backgroundColor: backdropColor,
135-
...(getPlatform() === CONST.PLATFORM.WEB ? {opacity: backdropOpacity} : {}),
136135
};
137-
}, [deviceHeightProp, deviceWidthProp, deviceWidth, deviceHeight, backdropColor, backdropOpacity]);
136+
}, [deviceHeightProp, deviceWidthProp, deviceWidth, deviceHeight, backdropColor]);
138137

139138
const onOpenCallBack = useCallback(() => {
140139
setIsTransitioning(false);
@@ -178,6 +177,7 @@ function BottomDockedModal({
178177
animationInTiming={animationInTiming}
179178
animationOutTiming={animationOutTiming}
180179
animationInDelay={animationInDelay}
180+
backdropOpacity={backdropOpacity}
181181
/>
182182
);
183183

src/components/Modal/BottomDockedModal/types.ts

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ type BackdropProps = {
135135

136136
/** Timing of animation on exit */
137137
animationOutTiming?: number;
138+
139+
/** Opacity of the backdrop */
140+
backdropOpacity?: number;
138141
};
139142

140143
type ContainerProps = {

0 commit comments

Comments
 (0)