diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index f1f399c99da2..9d1536401e07 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4890,19 +4890,6 @@ public final class com/facebook/react/uimanager/events/TouchEventType$Companion public final fun getJSEventName (Lcom/facebook/react/uimanager/events/TouchEventType;)Ljava/lang/String; } -public class com/facebook/react/uimanager/layoutanimation/LayoutAnimationController { - public fun ()V - public fun applyLayoutUpdate (Landroid/view/View;IIII)V - public fun deleteView (Landroid/view/View;Lcom/facebook/react/uimanager/layoutanimation/LayoutAnimationListener;)V - public final fun initializeFromConfig (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;)V - public fun reset ()V - public fun shouldAnimateLayout (Landroid/view/View;)Z -} - -public abstract interface class com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener { - public abstract fun onAnimationEnd ()V -} - public final class com/facebook/react/uimanager/style/BackgroundImageLayer { public static final field Companion Lcom/facebook/react/uimanager/style/BackgroundImageLayer$Companion; public fun ()V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index 8ff0580e36c8..1ace964c5fb7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -31,8 +31,6 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger; import com.facebook.react.common.build.ReactBuildConfig; import com.facebook.react.touch.JSResponderHandler; -import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController; -import com.facebook.react.uimanager.layoutanimation.LayoutAnimationListener; import com.facebook.systrace.Systrace; import com.facebook.systrace.SystraceMessage; import com.facebook.yoga.YogaDirection; @@ -86,7 +84,6 @@ public class NativeViewHierarchyManager { private final ViewManagerRegistry mViewManagers; private final JSResponderHandler mJSResponderHandler = new JSResponderHandler(); private final RootViewManager mRootViewManager; - private final LayoutAnimationController mLayoutAnimator = new LayoutAnimationController(); private final RectF mBoundingBox = new RectF(); private volatile boolean mLayoutAnimationEnabled; @@ -265,9 +262,7 @@ public synchronized long getInstanceHandle(int reactTag) { } private void updateLayout(View viewToUpdate, int x, int y, int width, int height) { - if (mLayoutAnimationEnabled && mLayoutAnimator.shouldAnimateLayout(viewToUpdate)) { - mLayoutAnimator.applyLayoutUpdate(viewToUpdate, x, y, width, height); - } else { + if (!mLayoutAnimationEnabled) { viewToUpdate.layout(x, y, x + width, y + height); } } @@ -464,14 +459,7 @@ public synchronized void manageChildren( viewToManage, viewManager, indicesToRemove, viewsToAdd, tagsToDelete)); } - View viewToRemove = viewManager.getChildAt(viewToManage, indexToRemove); - - if (mLayoutAnimationEnabled - && mLayoutAnimator.shouldAnimateLayout(viewToRemove) - && arrayContains(tagsToDelete, viewToRemove.getId())) { - // The view will be removed and dropped by the 'delete' layout animation - // instead, so do nothing - } else { + if (!mLayoutAnimationEnabled) { viewManager.removeViewAt(viewToManage, indexToRemove); } @@ -492,26 +480,7 @@ && arrayContains(tagsToDelete, viewToRemove.getId())) { viewToManage, viewManager, indicesToRemove, viewsToAdd, tagsToDelete)); } - if (mLayoutAnimationEnabled && mLayoutAnimator.shouldAnimateLayout(viewToDestroy)) { - pendingDeletionTags.add(tagToDelete); - mLayoutAnimator.deleteView( - viewToDestroy, - new LayoutAnimationListener() { - @Override - public void onAnimationEnd() { - // This should be called only on the UI thread, because - // onAnimationEnd is called (indirectly) by Android View Animation. - UiThreadUtil.assertOnUiThread(); - - viewManager.removeView(viewToManage, viewToDestroy); - dropView(viewToDestroy); - pendingDeletionTags.remove(viewToDestroy.getId()); - if (pendingDeletionTags.isEmpty()) { - mPendingDeletionsForTag.remove(tag); - } - } - }); - } else { + if (!mLayoutAnimationEnabled) { dropView(viewToDestroy); } } @@ -828,11 +797,11 @@ public synchronized void clearJSResponder() { synchronized void configureLayoutAnimation( final ReadableMap config, final Callback onAnimationComplete) { - mLayoutAnimator.initializeFromConfig(config, onAnimationComplete); + // no-op } synchronized void clearLayoutAnimation() { - mLayoutAnimator.reset(); + // no-op } @Deprecated diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt deleted file mode 100644 index 6e7a8088ca2b..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -@file:Suppress("DEPRECATION") - -package com.facebook.react.uimanager.layoutanimation - -import android.view.View -import com.facebook.react.bridge.Callback -import com.facebook.react.bridge.ReadableMap -import com.facebook.react.common.annotations.internal.LegacyArchitecture -import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel -import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger -import javax.annotation.concurrent.NotThreadSafe - -/** - * Class responsible for animation layout changes, if a valid layout animation config has been - * supplied. If not animation is available, layout change is applied immediately instead of - * performing an animation. - */ -@NotThreadSafe -@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) -@Deprecated( - message = "This class is part of Legacy Architecture and will be removed in a future release", - level = DeprecationLevel.WARNING, -) -public open class LayoutAnimationController { - - public fun initializeFromConfig(config: ReadableMap?, completionCallback: Callback?) { - LegacyArchitectureLogger.assertLegacyArchitecture( - "LayoutAnimationController", - LegacyArchitectureLogLevel.ERROR, - ) - } - - public open fun reset() { - LegacyArchitectureLogger.assertLegacyArchitecture( - "LayoutAnimationController", - LegacyArchitectureLogLevel.ERROR, - ) - } - - public open fun shouldAnimateLayout(viewToAnimate: View?): Boolean { - LegacyArchitectureLogger.assertLegacyArchitecture( - "LayoutAnimationController", - LegacyArchitectureLogLevel.ERROR, - ) - return false - } - - /** - * Update layout of given view, via immediate update or animation depending on the current batch - * layout animation configuration supplied during initialization. Handles create and update - * animations. - * - * @param view the view to update layout of - * @param x the new X position for the view - * @param y the new Y position for the view - * @param width the new width value for the view - * @param height the new height value for the view - */ - public open fun applyLayoutUpdate(view: View, x: Int, y: Int, width: Int, height: Int) { - LegacyArchitectureLogger.assertLegacyArchitecture( - "LayoutAnimationController", - LegacyArchitectureLogLevel.ERROR, - ) - } - - /** - * Animate a view deletion using the layout animation configuration supplied during - * initialization. - * - * @param view The view to animate. - * @param listener Called once the animation is finished, should be used to completely remove the - * view. - */ - public open fun deleteView(view: View, listener: LayoutAnimationListener) { - LegacyArchitectureLogger.assertLegacyArchitecture( - "LayoutAnimationController", - LegacyArchitectureLogLevel.ERROR, - ) - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.kt deleted file mode 100644 index 39ff9dab0a23..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -@file:Suppress("DEPRECATION") - -package com.facebook.react.uimanager.layoutanimation - -import com.facebook.react.common.annotations.internal.LegacyArchitecture -import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel - -/** Listener invoked when a layout animation has completed. */ -@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR) -@Deprecated( - message = "This class is part of Legacy Architecture and will be removed in a future release", - level = DeprecationLevel.WARNING, -) -public fun interface LayoutAnimationListener { - public fun onAnimationEnd() -}