diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index bfb7c6353ad..636a24b9a49 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4106,22 +4106,6 @@ public final class com/facebook/react/uimanager/DisplayMetricsHolder { public static final fun setWindowDisplayMetrics (Landroid/util/DisplayMetrics;)V } -public class com/facebook/react/uimanager/FabricViewStateManager { - public fun ()V - public fun getStateData ()Lcom/facebook/react/bridge/ReadableMap; - public fun hasStateWrapper ()Z - public fun setState (Lcom/facebook/react/uimanager/FabricViewStateManager$StateUpdateCallback;)V - public fun setStateWrapper (Lcom/facebook/react/uimanager/StateWrapper;)V -} - -public abstract interface class com/facebook/react/uimanager/FabricViewStateManager$HasFabricViewStateManager { - public abstract fun getFabricViewStateManager ()Lcom/facebook/react/uimanager/FabricViewStateManager; -} - -public abstract interface class com/facebook/react/uimanager/FabricViewStateManager$StateUpdateCallback { - public abstract fun getStateUpdate ()Lcom/facebook/react/bridge/WritableMap; -} - public final class com/facebook/react/uimanager/FloatUtil { public static final field INSTANCE Lcom/facebook/react/uimanager/FloatUtil; public static final fun floatsEqual (FF)Z diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java deleted file mode 100644 index 73dd4b98c1e..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java +++ /dev/null @@ -1,98 +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. - */ - -package com.facebook.react.uimanager; - -import androidx.annotation.Nullable; -import com.facebook.common.logging.FLog; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.bridge.WritableMap; - -/** - * This is a helper base class for ViewGroups that use Fabric State. - * - *

Reason to use this: UpdateState calls from the View layer to the Fabric core can fail, and - * optionally Fabric will call a "failure callback" if that happens. This class abstracts that and - * makes it easier ensure that State in Fabric is always up-to-date. - * - *

1. Whenever ViewManager.updateState is called, call View.setStateWrapper. 2. Instead of - * calling StateWrapper.updateState directly, call View.setState and it will automatically keep - * retrying the UpdateState call until it succeeds; or you call setState again; or the View layer is - * updated with a newer StateWrapper. - */ -@Nullsafe(Nullsafe.Mode.LOCAL) -@Deprecated( - since = - "Deprecated class since v0.73.0, please use com.facebook.react.uimanager.StateWrapper" - + " instead.", - forRemoval = true) -public class FabricViewStateManager { - private static final String TAG = "FabricViewStateManager"; - - @Deprecated - public interface HasFabricViewStateManager { - FabricViewStateManager getFabricViewStateManager(); - } - - @Deprecated - public interface StateUpdateCallback { - WritableMap getStateUpdate(); - } - - @Nullable private StateWrapper mStateWrapper = null; - - @Deprecated - public void setStateWrapper(StateWrapper stateWrapper) { - mStateWrapper = stateWrapper; - } - - @Deprecated - public boolean hasStateWrapper() { - return mStateWrapper != null; - } - - private void setState( - @Nullable final StateWrapper stateWrapper, - final StateUpdateCallback stateUpdateCallback, - final int numTries) { - // The StateWrapper will change, breaking the async loop, whenever the UpdateState MountItem - // is executed. - // The caller is responsible for detecting if data is up-to-date, and doing nothing, or - // detecting if state is stale and calling setState again. - if (stateWrapper == null) { - FLog.e(TAG, "setState called without a StateWrapper"); - return; - } - if (stateWrapper != mStateWrapper) { - return; - } - // We bail out after an arbitrary number of tries. In practice this should never go higher - // than 2 or 3, but there's nothing guaranteeing that. - if (numTries > 60) { - return; - } - - @Nullable WritableMap stateUpdate = stateUpdateCallback.getStateUpdate(); - if (stateUpdate == null) { - return; - } - - // TODO: State update cannot fail; remove `failureRunnable` and custom retrying logic. - stateWrapper.updateState(stateUpdate); - } - - @Deprecated - public void setState(final StateUpdateCallback stateUpdateCallback) { - setState(mStateWrapper, stateUpdateCallback, 0); - } - - @Deprecated - public @Nullable ReadableMap getStateData() { - return mStateWrapper != null ? mStateWrapper.getStateData() : null; - } -}