Open History to see the last commit
1diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
2index 86035915aa330d2011e7c3027ae315c689e40f58..3d43e949550e1bc1311c38d11a7920c237a41018 100644
3--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
4+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
5@@ -22,6 +22,7 @@ struct LayoutAnimation {
6 Tag parentTag;
7 std::optional<double> opacity;
8 bool isViewAlreadyMounted = false;
9+ bool isExitingWhenSettled = false;
10 int count = 1;
11 LayoutAnimation &operator=(const LayoutAnimation &other) = default;
13diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
14index bc62f8fc31a1d3b08353df514bf4f954c6279ceb..0c16264538a13ae8b7bd4fd11e1227d8580c5c65 100644
15--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
16+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
17@@ -290,6 +290,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Experimental::endLayoutAnimation(
18 if (--layoutAnimation.count > 0) {
19 return {};
20 }
21+ layoutAnimation.isExitingWhenSettled = shouldRemove;
22 maybeSettledAnimationTags_.insert(tag);
23 auto surfaceId = layoutAnimation.finalView.surfaceId;
25@@ -407,7 +408,8 @@ void LayoutAnimationsProxy_Experimental::addOngoingAnimations(SurfaceId surfaceI
27 const auto layoutAnimationIt = layoutAnimations_.find(tag);
29- if (layoutAnimationIt == layoutAnimations_.end() || layoutAnimationIt->second.isSettled()) {
30+ if (layoutAnimationIt == layoutAnimations_.end() ||
31+ (layoutAnimationIt->second.isSettled() && layoutAnimationIt->second.isExitingWhenSettled)) {
32 continue;
33 }
35@@ -554,6 +556,8 @@ void LayoutAnimationsProxy_Experimental::maybeCancelAnimation(const int tag) con
36 }
37 if (layoutAnimationIt->second.isSettled()) {
38 // Already settled - cleanupAnimations will erase it together with its updateMap entry.
39+ // Do not flush a pending Update after the caller queues this view for removal.
40+ layoutAnimationIt->second.isExitingWhenSettled = true;
41 return;
42 }
43 layoutAnimations_.erase(layoutAnimationIt);
44diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
45index 9402e3e5ba4859ed344901b8b5884b9f708dd82b..2b1e4294ef798b7b6aabd04cc6663aae8297d034 100644
46--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
47+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
48@@ -119,6 +119,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
49 if (--layoutAnimation.count > 0) {
50 return {};
51 }
52+ layoutAnimation.isExitingWhenSettled = shouldRemove;
53 maybeSettledAnimationTags_.insert(tag);
54 auto surfaceId = layoutAnimation.finalView.surfaceId;
56@@ -414,12 +415,7 @@ void LayoutAnimationsProxy_Legacy::addOngoingAnimations(SurfaceId surfaceId, Sha
57 auto layoutAnimationIt = layoutAnimations_.find(tag);
59 if (layoutAnimationIt == layoutAnimations_.end() ||
60- // A settled animation is normally cleaned up without applying further
61- // updates. The exception is a flaky entering animation whose opacity was
62- // never restored (the view wasn't mounted in time) - we still need to
63- // apply that pending opacity, otherwise the view stays invisible. Only
64- // entering animations carry an opacity value.
65- (layoutAnimationIt->second.isSettled() && !layoutAnimationIt->second.opacity.has_value())) {
66+ (layoutAnimationIt->second.isSettled() && layoutAnimationIt->second.isExitingWhenSettled)) {
67 continue;
68 }