Files
t3code/patches/[email protected]
T

70 lines
3.8 KiB
Diff

diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
index 20d042b00e4655a6647eff1a9a0890fae7e45175..fd08d36fd6c1f79adcfa0dc675420e42a9815d25 100644
--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h
@@ -22,6 +22,7 @@ struct LayoutAnimation {
Tag parentTag;
std::optional<double> opacity;
bool isViewAlreadyMounted = false;
+ bool isExitingWhenSettled = false;
int count = 1;
LayoutAnimation &operator=(const LayoutAnimation &other) = default;
diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
index 0f08622518910486bb724b664e0a5dd692470b18..9f71dbc301e77656ab0c5dc453ade03eea7649f8 100644
--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp
@@ -353,6 +353,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Experimental::endLayoutAnimation(
if (--layoutAnimation.count > 0) {
return {};
}
+ layoutAnimation.isExitingWhenSettled = shouldRemove;
maybeSettledAnimationTags_.insert(tag);
auto surfaceId = layoutAnimation.finalView.surfaceId;
@@ -478,7 +479,8 @@ void LayoutAnimationsProxy_Experimental::addOngoingAnimations(SurfaceId surfaceI
const auto layoutAnimationIt = layoutAnimations_.find(tag);
- if (layoutAnimationIt == layoutAnimations_.end() || layoutAnimationIt->second.isSettled()) {
+ if (layoutAnimationIt == layoutAnimations_.end() ||
+ (layoutAnimationIt->second.isSettled() && layoutAnimationIt->second.isExitingWhenSettled)) {
continue;
}
@@ -635,6 +637,8 @@ void LayoutAnimationsProxy_Experimental::maybeCancelAnimation(const int tag) con
}
if (layoutAnimationIt->second.isSettled()) {
// Already settled - cleanupAnimations will erase it together with its updateMap entry.
+ // Do not flush a pending Update after the caller queues this view for removal.
+ layoutAnimationIt->second.isExitingWhenSettled = true;
return;
}
layoutAnimations_.erase(layoutAnimationIt);
diff --git a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
index f9711f4eb6185ea99e08280ff90edd45e4152e12..ca812666ca54ec55d9d4409910b21ae97c721f2f 100644
--- a/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
+++ b/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp
@@ -228,6 +228,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
if (--layoutAnimation.count > 0) {
return {};
}
+ layoutAnimation.isExitingWhenSettled = shouldRemove;
maybeSettledAnimationTags_.insert(tag);
auto surfaceId = layoutAnimation.finalView.surfaceId;
@@ -531,12 +532,7 @@ void LayoutAnimationsProxy_Legacy::addOngoingAnimations(SurfaceId surfaceId, Sha
auto layoutAnimationIt = layoutAnimations_.find(tag);
if (layoutAnimationIt == layoutAnimations_.end() ||
- // A settled animation is normally cleaned up without applying further
- // updates. The exception is a flaky entering animation whose opacity was
- // never restored (the view wasn't mounted in time) - we still need to
- // apply that pending opacity, otherwise the view stays invisible. Only
- // entering animations carry an opacity value.
- (layoutAnimationIt->second.isSettled() && !layoutAnimationIt->second.opacity.has_value())) {
+ (layoutAnimationIt->second.isSettled() && layoutAnimationIt->second.isExitingWhenSettled)) {
continue;
}