From aa58216b6de09d471fa94d42bd668e61043fc4f2 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 23 Nov 2024 21:36:35 +0000 Subject: Fix jumpy web animation for modal backdrop (#6673) --- src/components/Dialog/index.web.tsx | 43 +++++++++++++++++---------- src/components/ProfileHoverCard/index.web.tsx | 4 +-- src/style.css | 4 +-- 3 files changed, 31 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index 41a39ffda..6b92eee3e 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -7,7 +7,6 @@ import { View, ViewStyle, } from 'react-native' -import Animated, {FadeIn, FadeInDown} from 'react-native-reanimated' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {DismissableLayer} from '@radix-ui/react-dismissable-layer' @@ -42,7 +41,6 @@ export function Outer({ onClose, }: React.PropsWithChildren) { const {_} = useLingui() - const t = useTheme() const {gtMobile} = useBreakpoints() const [isOpen, setIsOpen] = React.useState(false) const {setDialogIsOpen} = useDialogStateControlContext() @@ -118,16 +116,7 @@ export function Outer({ gtMobile ? a.p_lg : a.p_md, {overflowY: 'auto'}, ]}> - - + - true} onTouchEnd={stopPropagation} - entering={FadeInDown.duration(100)} - // exiting={FadeOut.duration(100)} style={flatten([ a.relative, a.rounded_md, @@ -188,6 +175,8 @@ export function Inner({ shadowColor: t.palette.black, shadowOpacity: t.name === 'light' ? 0.1 : 0.4, shadowRadius: 30, + // @ts-ignore web only + animation: 'fadeIn ease-out 0.1s', }, flatten(style), ])}> @@ -201,7 +190,7 @@ export function Inner({ {children} - + ) } @@ -268,3 +257,25 @@ export function Close() { export function Handle() { return null } + +function Backdrop() { + const t = useTheme() + return ( + + + + ) +} diff --git a/src/components/ProfileHoverCard/index.web.tsx b/src/components/ProfileHoverCard/index.web.tsx index 4cda42fdb..3e58ced90 100644 --- a/src/components/ProfileHoverCard/index.web.tsx +++ b/src/components/ProfileHoverCard/index.web.tsx @@ -302,8 +302,8 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) { const animationStyle = { animation: currentState.stage === 'hiding' - ? `avatarHoverFadeOut ${HIDE_DURATION}ms both` - : `avatarHoverFadeIn ${SHOW_DURATION}ms both`, + ? `fadeOut ${HIDE_DURATION}ms both` + : `fadeIn ${SHOW_DURATION}ms both`, } return ( diff --git a/src/style.css b/src/style.css index 6f908c288..f6e9a6e6c 100644 --- a/src/style.css +++ b/src/style.css @@ -184,7 +184,7 @@ input:focus { animation: rotate 500ms linear infinite; } -@keyframes avatarHoverFadeIn { +@keyframes fadeIn { from { opacity: 0; } @@ -193,7 +193,7 @@ input:focus { } } -@keyframes avatarHoverFadeOut { +@keyframes fadeOut { from { opacity: 1; } -- cgit 1.4.1