mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Annotate LegacyArchitecture classes for com/facebook/react/uimanager package (#49764)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49764 Annotate LegacyArchitecture classes for com/facebook/react/uimanager package changelog: [internal] internal Reviewed By: rshest Differential Revision: D70441495 fbshipit-source-id: fd3e5b3a40dffc31197df2153cde528bc723a2ab
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8254758f74
commit
25d501df7e
+2
@@ -8,8 +8,10 @@
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.view.View
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.yoga.YogaDirection
|
||||
|
||||
@LegacyArchitecture
|
||||
internal object LayoutDirectionUtil {
|
||||
@JvmStatic
|
||||
fun toAndroidFromYoga(direction: YogaDirection): Int =
|
||||
|
||||
+2
@@ -12,6 +12,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropGroup;
|
||||
@@ -34,6 +35,7 @@ import com.facebook.yoga.YogaWrap;
|
||||
* may or may not be embedded in a parent text. There are better solutions that should probably be
|
||||
* explored, namely using the VirtualText class in JS and setting the correct set of validAttributes
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public class LayoutShadowNode extends ReactShadowNodeImpl {
|
||||
|
||||
/** A Mutable version of com.facebook.yoga.YogaValue */
|
||||
|
||||
+3
-1
@@ -7,10 +7,12 @@
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
|
||||
// Common conditionals:
|
||||
// - `kind == PARENT` checks whether the node can host children in the native tree.
|
||||
// - `kind != NONE` checks whether the node appears in the native tree.
|
||||
|
||||
@LegacyArchitecture
|
||||
internal enum class NativeKind {
|
||||
// Node is in the native hierarchy and the HierarchyOptimizer should assume it can host children
|
||||
// (e.g. because it's a ViewGroup). Note that it's okay if the node doesn't support children. When
|
||||
|
||||
+2
@@ -26,6 +26,7 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.touch.JSResponderHandler;
|
||||
import com.facebook.react.uimanager.layoutanimation.LayoutAnimationController;
|
||||
@@ -64,6 +65,7 @@ import javax.annotation.concurrent.NotThreadSafe;
|
||||
* <p>TODO(5483031): Only dispatch updates when shadow views have changed
|
||||
*/
|
||||
@NotThreadSafe
|
||||
@LegacyArchitecture
|
||||
public class NativeViewHierarchyManager {
|
||||
|
||||
private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
|
||||
|
||||
+2
@@ -13,6 +13,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
|
||||
/**
|
||||
* Class responsible for optimizing the native view hierarchy while still respecting the final UI
|
||||
@@ -45,6 +46,7 @@ import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
* manageChildren calls for various parent views may be issued to the native view hierarchy
|
||||
* depending on where the views being added/removed are attached in the optimized hierarchy
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public class NativeViewHierarchyOptimizer {
|
||||
|
||||
private static final String TAG = "NativeViewHierarchyOptimizer";
|
||||
|
||||
+3
@@ -7,9 +7,12 @@
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
|
||||
/**
|
||||
* Exception thrown when a class tries to access a native view by a tag that has no native view
|
||||
* associated with it.
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
internal class NoSuchNativeViewException(detailMessage: String) :
|
||||
IllegalViewOperationException(detailMessage)
|
||||
|
||||
+2
@@ -12,10 +12,12 @@ import androidx.core.util.Pools;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
|
||||
/** Event used to notify JS component about changes of its position or dimensions */
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
@LegacyArchitecture
|
||||
public class OnLayoutEvent extends Event<OnLayoutEvent> {
|
||||
|
||||
private static final Pools.SynchronizedPool<OnLayoutEvent> EVENTS_POOL =
|
||||
|
||||
+2
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.yoga.YogaAlign;
|
||||
import com.facebook.yoga.YogaBaselineFunction;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
@@ -44,6 +45,7 @@ import com.facebook.yoga.YogaWrap;
|
||||
* separately native children (e.g. {@link #getNativeChildCount()}). See {@link
|
||||
* NativeViewHierarchyOptimizer} for more information.
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public interface ReactShadowNode<T extends ReactShadowNode> {
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -9,6 +9,7 @@ package com.facebook.react.uimanager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
|
||||
import com.facebook.yoga.YogaAlign;
|
||||
import com.facebook.yoga.YogaBaselineFunction;
|
||||
@@ -54,6 +55,7 @@ import java.util.Arrays;
|
||||
* NativeViewHierarchyOptimizer} for more information.
|
||||
*/
|
||||
@ReactPropertyHolder
|
||||
@LegacyArchitecture
|
||||
public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl> {
|
||||
|
||||
private static final YogaConfig sYogaConfig;
|
||||
|
||||
+2
@@ -7,10 +7,12 @@
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.yoga.YogaConfig
|
||||
import com.facebook.yoga.YogaConfigFactory
|
||||
import com.facebook.yoga.YogaErrata
|
||||
|
||||
@LegacyArchitecture
|
||||
internal object ReactYogaConfigProvider {
|
||||
|
||||
val yogaConfig: YogaConfig by
|
||||
|
||||
+2
@@ -11,11 +11,13 @@ import android.util.SparseArray;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.View;
|
||||
import com.facebook.react.common.SingleThreadAsserter;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
|
||||
/**
|
||||
* Simple container class to keep track of {@link ReactShadowNode}s associated with a particular
|
||||
* UIManagerModule instance.
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
class ShadowNodeRegistry {
|
||||
|
||||
private final SparseArray<ReactShadowNode> mTagsToCSSNodes;
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
@@ -38,6 +39,7 @@ import java.util.Map;
|
||||
* A class that is used to receive React commands from JS and translate them into a shadow node
|
||||
* hierarchy that is then mapped to a native view hierarchy.
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public class UIImplementation {
|
||||
protected Object uiImplementationThreadLock = new Object();
|
||||
|
||||
|
||||
+2
@@ -39,6 +39,7 @@ import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.common.ViewUtil;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
@@ -82,6 +83,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
* Don't dispatch the view hierarchy at the end of a batch if no UI changes occurred
|
||||
*/
|
||||
@ReactModule(name = UIManagerModule.NAME)
|
||||
@LegacyArchitecture
|
||||
public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
implements OnBatchCompleteListener, LifecycleEventListener, UIManager {
|
||||
public static final String TAG = UIManagerModule.class.getSimpleName();
|
||||
|
||||
+3
@@ -7,8 +7,11 @@
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
|
||||
/** Listener used to hook into the UIManager update process. */
|
||||
@Deprecated("Use UIManagerListener instead. This will be deleted in some future release.")
|
||||
@LegacyArchitecture
|
||||
public interface UIManagerModuleListener {
|
||||
/**
|
||||
* Called right before view updates are dispatched at the end of a batch. This is useful if a
|
||||
|
||||
+2
@@ -25,6 +25,7 @@ import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import com.facebook.react.modules.core.ReactChoreographer;
|
||||
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
|
||||
import com.facebook.systrace.Systrace;
|
||||
@@ -45,6 +46,7 @@ import java.util.Map;
|
||||
* <p>TODO(7135923): Pooling of operation objects TODO(5694019): Consider a better data structure
|
||||
* for operations queue to save on allocations
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public class UIViewOperationQueue {
|
||||
|
||||
public static final int DEFAULT_MIN_TIME_LEFT_IN_FRAME_FOR_NONBATCHED_OPERATION_MS = 8;
|
||||
|
||||
+2
@@ -7,12 +7,14 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Data structure that couples view tag to it's index in parent view. Used for managing children
|
||||
* operation.
|
||||
*/
|
||||
@LegacyArchitecture
|
||||
public class ViewAtIndex {
|
||||
public static Comparator<ViewAtIndex> COMPARATOR =
|
||||
new Comparator<ViewAtIndex>() {
|
||||
|
||||
+2
@@ -8,9 +8,11 @@
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import com.facebook.react.common.ClearableSynchronizedPool
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
import com.facebook.yoga.YogaNode
|
||||
|
||||
/** Static holder for a recycling pool of YogaNodes. */
|
||||
@LegacyArchitecture
|
||||
internal object YogaNodePool {
|
||||
|
||||
private val pool: ClearableSynchronizedPool<YogaNode> by
|
||||
|
||||
+3
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.react.uimanager.debug
|
||||
|
||||
import com.facebook.react.common.annotations.internal.LegacyArchitecture
|
||||
|
||||
/**
|
||||
* A listener that is notified about view hierarchy update events. This listener should only be used
|
||||
* for debug purposes and should not affect application state.
|
||||
@@ -16,6 +18,7 @@ package com.facebook.react.uimanager.debug
|
||||
*/
|
||||
@Deprecated(
|
||||
"NotThreadSafeViewHierarchyUpdateDebugListener will be deleted in the new architecture.")
|
||||
@LegacyArchitecture
|
||||
internal interface NotThreadSafeViewHierarchyUpdateDebugListener {
|
||||
/** Called when `UIManagerModule` enqueues a UI batch to be dispatched to the main thread. */
|
||||
fun onViewHierarchyUpdateEnqueued()
|
||||
|
||||
Reference in New Issue
Block a user