Skip to content

Commit 5c31ef9

Browse files
authored
fix: adjust surface wrapper opacity (#3709)
1 parent 22989b6 commit 5c31ef9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/Banner.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ const Banner = ({
156156

157157
const { scale } = theme.animation;
158158

159+
const opacity = position.interpolate({
160+
inputRange: [0, 0.1, 1],
161+
outputRange: [0, 1, 1],
162+
});
163+
159164
React.useEffect(() => {
160165
if (visible) {
161166
// show
@@ -196,7 +201,7 @@ const Banner = ({
196201
return (
197202
<Surface
198203
{...rest}
199-
style={[!theme.isV3 && styles.elevation, style]}
204+
style={[!theme.isV3 && styles.elevation, { opacity }, style]}
200205
theme={theme}
201206
{...(theme.isV3 && { elevation })}
202207
>

src/components/__tests__/__snapshots__/Banner.test.tsx.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ exports[`render visible banner, with custom theme 1`] = `
4747
Object {
4848
"backgroundColor": "rgb(247, 243, 249)",
4949
"flex": undefined,
50+
"opacity": 1,
5051
}
5152
}
5253
testID="surface"
@@ -338,6 +339,7 @@ exports[`renders hidden banner, without action buttons and without image 1`] = `
338339
Object {
339340
"backgroundColor": "rgb(247, 243, 249)",
340341
"flex": undefined,
342+
"opacity": 0,
341343
}
342344
}
343345
testID="surface"
@@ -486,6 +488,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
486488
Object {
487489
"backgroundColor": "rgb(247, 243, 249)",
488490
"flex": undefined,
491+
"opacity": 1,
489492
}
490493
}
491494
testID="surface"
@@ -799,6 +802,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
799802
Object {
800803
"backgroundColor": "rgb(247, 243, 249)",
801804
"flex": undefined,
805+
"opacity": 1,
802806
}
803807
}
804808
testID="surface"
@@ -1244,6 +1248,7 @@ exports[`renders visible banner, without action buttons and with image 1`] = `
12441248
Object {
12451249
"backgroundColor": "rgb(247, 243, 249)",
12461250
"flex": undefined,
1251+
"opacity": 1,
12471252
}
12481253
}
12491254
testID="surface"
@@ -1402,6 +1407,7 @@ exports[`renders visible banner, without action buttons and without image 1`] =
14021407
Object {
14031408
"backgroundColor": "rgb(247, 243, 249)",
14041409
"flex": undefined,
1410+
"opacity": 1,
14051411
}
14061412
}
14071413
testID="surface"

0 commit comments

Comments
 (0)