Repository navigation
fix: skipEntering being applied to all entering animations - #7812
Merged
Merged
Conversation
MatiPl01
marked this pull request as ready for review
July 16, 2025 14:35
MatiPl01
commented
Jul 16, 2025
21 tasks done
bartlomiejbloniarz
approved these changes
Jul 16, 2025
MatiPl01
added this pull request to the merge queue
Jul 16, 2025
MatiPl01
added a commit
that referenced
this pull request
Jul 17, 2025
## Summary This PR is a cherry-pick of changes applied in the #7788 and #7812 PRs with some adjustments for proper Paper support. ## Example recordings ### Paper Worked fine before as well. | Before | After | |-|-| | <video src="https://github.com/user-attachments/assets/39eff5ad-d28e-4489-b6ba-5149add35970" /> | <video src="https://github.com/user-attachments/assets/f5c33982-595e-4a64-b3f5-ccb7c4e5d4ce" /> | ### Fabric Exiting animations could not be changed after the view was mounted. It had to be remounted to apply the new exiting prop value. | Before | After | |-|-| | <video src="https://github.com/user-attachments/assets/822c6c62-088b-4f6d-977c-3d511c354d7f" /> | <video src="https://github.com/user-attachments/assets/0086903f-4a4f-4db3-8737-415c57dd290a" /> | ## Test example <details> <summary>Code snippet</summary> ```tsx import React, { useState } from 'react'; import { Button, StyleSheet, View } from 'react-native'; import Animated, { FadeIn, FadeOutDown, LinearTransition, } from 'react-native-reanimated'; export default function EmptyExample() { const [exitingEnabled, setExitingEnabled] = useState(true); const [layoutEnabled, setLayoutEnabled] = useState(true); const [show, setShow] = useState(true); const [pos, setPos] = useState(0); return ( <View style={styles.container}> <Button title="Toggle show" onPress={() => setShow(!show)} /> <Button title="Toggle pos" onPress={() => setPos(Math.random() * 100)} /> <Button title={`Toggle exiting: ${exitingEnabled}`} onPress={() => setExitingEnabled(!exitingEnabled)} /> <Button title={`Toggle layout: ${layoutEnabled}`} onPress={() => setLayoutEnabled(!layoutEnabled)} /> {show && ( <Animated.View entering={FadeIn} exiting={exitingEnabled ? FadeOutDown : undefined} layout={layoutEnabled ? LinearTransition : undefined} style={{ top: pos, width: 100, height: 100, backgroundColor: 'red', }} /> )} </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }); ``` </details>
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Aug 26, 2025
## Summary This PR fixes #8046. With the previous approach introduced in #6864, we didn't configure layout animations when reduce motion was enabled, which was problematic because in this case, callbacks weren't called at the end of animations. This PR restores layout animation configuration while still respecting the reduce motion config. I've tested these changes against #6864 and #7812, and both are working properly. https://github.com/user-attachments/assets/48a6e913-b53e-41e8-8a15-842d2ab7511a ## Test plan <details> <summary>code</summary> ```js import React from 'react'; import { Button, StyleSheet, View } from 'react-native'; import Animated, { BounceInLeft, FadeOutRight, Layout, } from 'react-native-reanimated'; export default function BasicLayoutAnimation() { const [state, setState] = React.useState(false); const [visible, setVisible] = React.useState(true); return ( <View style={styles.container}> <Button onPress={() => setVisible(!visible)} title="Create/Remove" /> <Button onPress={() => setState(!state)} title="Update" /> {visible && ( <Animated.View entering={BounceInLeft.withCallback(() => console.log('entering'))} layout={Layout.springify().withCallback(() => console.log('layout'))} exiting={FadeOutRight.duration(500).withCallback(() => console.log('exiting'))} style={[ styles.box, { marginLeft: state ? 200 : 0, backgroundColor: state ? 'red' : 'blue', }, ]} /> )} </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', marginTop: 300, }, box: { width: 100, height: 100, }, }); ``` </details>
MatiPl01
pushed a commit
that referenced
this pull request
Aug 26, 2025
## Summary This PR fixes #8046. With the previous approach introduced in #6864, we didn't configure layout animations when reduce motion was enabled, which was problematic because in this case, callbacks weren't called at the end of animations. This PR restores layout animation configuration while still respecting the reduce motion config. I've tested these changes against #6864 and #7812, and both are working properly. https://github.com/user-attachments/assets/48a6e913-b53e-41e8-8a15-842d2ab7511a ## Test plan <details> <summary>code</summary> ```js import React from 'react'; import { Button, StyleSheet, View } from 'react-native'; import Animated, { BounceInLeft, FadeOutRight, Layout, } from 'react-native-reanimated'; export default function BasicLayoutAnimation() { const [state, setState] = React.useState(false); const [visible, setVisible] = React.useState(true); return ( <View style={styles.container}> <Button onPress={() => setVisible(!visible)} title="Create/Remove" /> <Button onPress={() => setState(!state)} title="Update" /> {visible && ( <Animated.View entering={BounceInLeft.withCallback(() => console.log('entering'))} layout={Layout.springify().withCallback(() => console.log('layout'))} exiting={FadeOutRight.duration(500).withCallback(() => console.log('exiting'))} style={[ styles.box, { marginLeft: state ? 200 : 0, backgroundColor: state ? 'red' : 'blue', }, ]} /> )} </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', marginTop: 300, }, box: { width: 100, height: 100, }, }); ``` </details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the issue introduced in the #7788 PR caused by the invalid entering animation configuration. The proper entering animation config was passed only when
skipEnteringwas set totrue, instead of being passed when it is set tofalseand entering should not be skipped.Example recordings
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-07-16.at.16.29.31.mp4
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-07-16.at.16.30.13.mp4
Test plan
Source code