react-native-reanimated: Layout "exiting" animation not working on first execution on iOS
Description
After upgrading to reanimated > rc-7, on iOS the first time we perform an exiting
animation, it is not executed.
iOS: (the first fadeout is immediate) https://github.com/software-mansion/react-native-reanimated/assets/93535783/e3377e9e-3f3d-4504-8b4f-49899e67323a
Code:
const Component: FC = () => {
const [isLoading, setIsLoading] = useState(true);
return (
<View style={{ flex: 1, marginTop: 200 }}>
<Button
text='ciao'
onPress={() => {
setIsLoading(!isLoading);
}}
/>
{isLoading ? (
<AnimatedWrapper exiting={FadeOut.duration(2000)}>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
<Text>ciao</Text>
</AnimatedWrapper>
) : null}
</View>
);
};
Steps to reproduce
I did my best to create a reproducible but everything works fine in a demo project.
On the incriminated project, I see that on iOS the FadeOut worklet
is not called when we press the button to hide the list for the first time.
Steps:
- Pressing the button “ciao” should FadeOut the list of “ciao”
- Pressing the button “ciao” a second time should bring the list back visible
- etc…
I understand that could be nice to have reproducible but unfortunately, I couldn’t reproduce on a new project. I’m looking for clues to understand what kind of dependency is breaking things.
I tried upgrading the react-navigation libraries but without any success.
I tried to build the same component on the same app but on the StoryBook and the problem is not visible.
I appreciate any hint or any suggestion on further analysis that I can do.
Snack or a link to a repository
“”
Reanimated version
3.1.0
React Native version
0.70.6
Platforms
Android, iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 11
- Comments: 30 (2 by maintainers)
Adding z-index on style of Animated.View resolved issue for me.
Any updates on this issue?
I also have the same problem. Exiting animation doesn’t work on iOS but it works on Android.
Same issue.
Any updates on this?
Experiencing the same problem here. Entering works on first render, subsequent remounts of component does not show exit animation nor new enter animation when it returns.
Still the same issue, my custom exiting animation works on Android, not ios. My entire app is wrapped in
SafeAreaView
import from react-native andcreateNativeStackNavigator
Adding Z index did not fix it for me either.
Also, the exiting animation only doesn’t work on the initial run, but I need it to work on the initial render
same issue
I am experiencing the same issue.
Confirmed just now it works.
Oh! And the original post is not on Expo.
I should probably open another issue then. Even though there are similarities, it’s probably a different problem. Can you put back the labels “missing repro”?
Thanks. Sorry about the confusion.
a temp workaround that might not work for all cases
i’m on 3.5.1 btw
just upgraded from 2.14 to 3.3.0 - got the same issue, layout exiting animation doesn’t work, the animated view disappears instantly on unmount. I don’t use SafeAreaContext, but i use native stack navigator from react-navigation. If i replace all
createNativeStackNavigator
withcreateStackNavigator
- the issue goes away, but it’s not an acceptable workaround