From 949d52502f7940ef847b7aa0cdaf580aa49e9863 Mon Sep 17 00:00:00 2001 From: Stefano Acerbetti Date: Fri, 25 Mar 2022 17:42:26 -0700 Subject: [PATCH] Fix initial state with the component hidden This utility works great when the initial state is visible, but not when is hidden. This provide a clean fix for that scenario --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index d10cb74..2d57a8e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -20,7 +20,7 @@ function Fade(props: FadeProps) { } } - const opacityValue = useSharedValue(1); + const opacityValue = useSharedValue(visible ? 1 : 0); const translationValue = useSharedValue(getInitialTranslationValue()); const opacityStyle = useAnimatedStyle(() => {