Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust surface wrapper opacity #3709

Merged
merged 1 commit into from
Mar 6, 2023
Merged
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
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