Issue with scaling on Animated.ScrollView after scaling-based exit animation #6829
Labels
Platform: iOS
This issue is specific to iOS
Repro provided
A reproduction with a snippet of code, snack or repo is provided
Description
When using a scale-based exit animations (such as
ZoomOut
or any other scale-based animations) on anAnimated.ScrollView
, there seems to be an issue where the scale value from the exit animation is cached (?), causing incorrect scaling behavior when the component is remounted. Specifically, after theZoomOut
animation has been executed, the subsequentZoomIn
animation does not scale the component up from the correct initial value when the visibility is toggled back on. Instead, it seems to start from the last scale value applied during the exit animation, resulting in the component not scaling properly.This issue contrasts with other animated components, such as
Animated.View
, which correctly triggers both theZoomIn
andZoomOut
animations multiple times without retaining the incorrect scale value from the previous exit animation.Expected Behavior
The
ZoomIn
animation should scale the component correctly from its initial state every time theAnimated.ScrollView
becomes visible, regardless of whether aZoomOut
, or any other scale-based exit animations such as custom exit animations, has been triggered previously.Actual Behavior
The
ZoomIn
animation fails to scale the component up from the expected initial state ifZoomOut
has been triggered before. Instead, it uses the last scale value set during the exit animation as the starting value, leading to a progressively smaller component on each toggle. For instance, if the component exits at a scale of 0.8, the next time it enters, it starts from 0.8, which makes the component appear smaller with each visibility toggle.Code Example
Working code example can be tested in iOS in this snack.
Screen Recording
Animated.View ✅
AnimatedView.mp4
Animated.ScrollView 🐞
AnimatedScrollView.mp4
Steps to reproduce
Animated.ScrollView
withZoomIn
for entry andZoomOut
for exit animations.Animated.ScrollView
using a button or another method (test this in an native environment, I have been testing in iOS)ZoomOut
exit animation runs, toggle the visibility again.ZoomIn
animation does not scale the component correctly.Snack or a link to a repository
https://snack.expo.dev/qrAntko0DsnZ0wppqbKKY
Reanimated version
3.6.1
React Native version
0.76.3
Platforms
iOS
JavaScript runtime
None
Workflow
Expo Go
Architecture
None
Build type
None
Device
iOS simulator
Device model
iPhone 15 Pro
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: