diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 656519cb86c..ff804236865 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1911,7 +1911,6 @@ public class com/facebook/react/config/ReactFeatureFlags { public static field enableViewRecycling Z public static field excludeYogaFromRawProps Z public static field fixStoppedSurfaceTagSetLeak Z - public static field reduceDeleteCreateMutationLayoutAnimation Z public static field rejectTurboModulePromiseOnNativeError Z public static field traceTurboModulePromiseRejections Z public static field unstable_bridgelessArchitectureMemoryPressureHackyBoltsFix Z diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index a244b1746f9..dc656c3143b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -106,12 +106,6 @@ public class ReactFeatureFlags { */ public static boolean enableRemoveDeleteTreeInstruction = false; - /** - * Allow fix in layout animation to drop delete...create mutations which could cause missing view - * state in Fabric SurfaceMountingManager. - */ - public static boolean reduceDeleteCreateMutationLayoutAnimation = true; - /** Report mount operations from the host platform to notify mount hooks. */ public static boolean enableMountHooks = false; diff --git a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 1720c23d5e0..db99dd64fd1 100644 --- a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -145,11 +145,6 @@ void LayoutAnimationKeyFrameManager::setComponentDescriptorRegistry( componentDescriptorRegistry_ = componentDescriptorRegistry; } -void LayoutAnimationKeyFrameManager::setReduceDeleteCreateMutation( - const bool reduceDeleteCreateMutation) { - reduceDeleteCreateMutation_ = reduceDeleteCreateMutation; -} - bool LayoutAnimationKeyFrameManager::shouldAnimateFrame() const { std::scoped_lock lock(currentAnimationMutex_); return currentAnimation_ || !inflightAnimations_.empty(); @@ -734,40 +729,6 @@ LayoutAnimationKeyFrameManager::pullTransaction( auto finalConflictingMutations = ShadowViewMutationList{}; for (auto& keyFrame : conflictingAnimations) { - // Special-case: if the next conflicting animation contain "delete", - // while the final mutation has the same tag with "create", we should - // remove both the delete and create as they have no effect when - // combined in the same frame. The Fabric mount layer assumes no such - // combinations in the final mutations either. - if (reduceDeleteCreateMutation_) { - for (auto itMutation = immediateMutations.begin(); - itMutation != immediateMutations.end();) { - auto& mutation = *itMutation; - bool hasCreateMutationDeletedWithSameTag = false; - if (mutation.newChildShadowView.tag == keyFrame.tag && - mutation.type == ShadowViewMutation::Create) { - for (auto itKeyFrame = keyFrame.finalMutationsForKeyFrame.begin(); - itKeyFrame != keyFrame.finalMutationsForKeyFrame.end();) { - auto& conflictFinalMutation = *itKeyFrame; - if (conflictFinalMutation.type == ShadowViewMutation::Delete) { - itKeyFrame = - keyFrame.finalMutationsForKeyFrame.erase(itKeyFrame); - hasCreateMutationDeletedWithSameTag = true; - break; - } else { - itKeyFrame++; - } - } - } - - if (hasCreateMutationDeletedWithSameTag) { - itMutation = immediateMutations.erase(itMutation); - } else { - itMutation++; - } - } - } - // Special-case: if we have some (1) ongoing UPDATE animation, // (2) it conflicted with a new MOVE operation (REMOVE+INSERT) // without another corresponding UPDATE, we should re-queue the diff --git a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h index 1ee64f871f0..04b5acc45ed 100644 --- a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +++ b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h @@ -55,8 +55,6 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, void setComponentDescriptorRegistry(const SharedComponentDescriptorRegistry& componentDescriptorRegistry) override; - void setReduceDeleteCreateMutation(bool reduceDeleteCreateMutation) override; - // TODO: add SurfaceId to this API as well bool shouldAnimateFrame() const override; @@ -145,7 +143,6 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, mutable LayoutAnimationStatusDelegate* layoutAnimationStatusDelegate_{}; mutable std::mutex surfaceIdsToStopMutex_; mutable std::unordered_set surfaceIdsToStop_{}; - bool reduceDeleteCreateMutation_{false}; // Function that returns current time in milliseconds std::function now_; diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp index 55e286d9434..3c08d80aa3d 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -129,14 +129,17 @@ Scheduler::Scheduler( uiManager->registerCommitHook(*commitHook); } + if (animationDelegate != nullptr) { + animationDelegate->setComponentDescriptorRegistry( + componentDescriptorRegistry_); + } + uiManager_->setAnimationDelegate(animationDelegate); + #ifdef ANDROID removeOutstandingSurfacesOnDestruction_ = true; - reduceDeleteCreateMutationLayoutAnimation_ = reactNativeConfig_->getBool( - "react_fabric:reduce_delete_create_mutation_layout_animation_android"); #else removeOutstandingSurfacesOnDestruction_ = reactNativeConfig_->getBool( "react_fabric:remove_outstanding_surfaces_on_destruction_ios"); - reduceDeleteCreateMutationLayoutAnimation_ = true; #endif #ifdef ANDROID @@ -159,14 +162,6 @@ Scheduler::Scheduler( CoreFeatures::enableReportEventPaintTime = reactNativeConfig_->getBool( "rn_responsiveness_performance:enable_paint_time_reporting"); - - if (animationDelegate != nullptr) { - animationDelegate->setComponentDescriptorRegistry( - componentDescriptorRegistry_); - animationDelegate->setReduceDeleteCreateMutation( - reduceDeleteCreateMutationLayoutAnimation_); - } - uiManager_->setAnimationDelegate(animationDelegate); } Scheduler::~Scheduler() { diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h index 80dc57ce3ec..fad55ae309b 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h @@ -36,14 +36,6 @@ class UIManagerAnimationDelegate { virtual void setComponentDescriptorRegistry( const SharedComponentDescriptorRegistry& componentDescriptorRegistry) = 0; - /** - * Set Animation flags for dropping delete and create mutations - * - * @param reduceDeleteCreateMutation - */ - virtual void setReduceDeleteCreateMutation( - bool reduceDeleteCreateMutation) = 0; - /** * Only needed on Android to drive animations. */