Skip to content

Commit

Permalink
fix: adjust surface wrapper opacity (#3709)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Mar 6, 2023
1 parent 22989b6 commit 5c31ef9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ const Banner = ({

const { scale } = theme.animation;

const opacity = position.interpolate({
inputRange: [0, 0.1, 1],
outputRange: [0, 1, 1],
});

React.useEffect(() => {
if (visible) {
// show
Expand Down Expand Up @@ -196,7 +201,7 @@ const Banner = ({
return (
<Surface
{...rest}
style={[!theme.isV3 && styles.elevation, style]}
style={[!theme.isV3 && styles.elevation, { opacity }, style]}
theme={theme}
{...(theme.isV3 && { elevation })}
>
Expand Down
6 changes: 6 additions & 0 deletions src/components/__tests__/__snapshots__/Banner.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ exports[`render visible banner, with custom theme 1`] = `
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 1,
}
}
testID="surface"
Expand Down Expand Up @@ -338,6 +339,7 @@ exports[`renders hidden banner, without action buttons and without image 1`] = `
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 0,
}
}
testID="surface"
Expand Down Expand Up @@ -486,6 +488,7 @@ exports[`renders visible banner, with action buttons and with image 1`] = `
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 1,
}
}
testID="surface"
Expand Down Expand Up @@ -799,6 +802,7 @@ exports[`renders visible banner, with action buttons and without image 1`] = `
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 1,
}
}
testID="surface"
Expand Down Expand Up @@ -1244,6 +1248,7 @@ exports[`renders visible banner, without action buttons and with image 1`] = `
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 1,
}
}
testID="surface"
Expand Down Expand Up @@ -1402,6 +1407,7 @@ exports[`renders visible banner, without action buttons and without image 1`] =
Object {
"backgroundColor": "rgb(247, 243, 249)",
"flex": undefined,
"opacity": 1,
}
}
testID="surface"
Expand Down

0 comments on commit 5c31ef9

Please sign in to comment.