From 2d7b59c669e533d5d0c2753b0e95dd89b8f33afb Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 9 Apr 2025 00:56:52 -0700 Subject: [PATCH] Make class internal - com.facebook.react.animated.AnimatedNode Summary: This diff makes the following file internal - AnimatedNode as part of our ongoing effort of reducing the API surface. This class has no meaningful usages in OSS so we can safely make it internaly: https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.animated.AnimatedNode Changelog: [Internal] [Changed] - Reviewed By: arushikesarwani94 Differential Revision: D72647209 fbshipit-source-id: 175406ed007abecaae0fa46aa8bdc8cfc938c3b3 --- .../ReactAndroid/api/ReactAndroid.api | 17 -------------- .../facebook/react/animated/AnimatedNode.kt | 22 +++++++++---------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 63779a89345..4118a337203 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -439,23 +439,6 @@ public abstract interface class com/facebook/react/ViewManagerOnDemandReactPacka public abstract fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection; } -public abstract class com/facebook/react/animated/AnimatedNode { - public static final field Companion Lcom/facebook/react/animated/AnimatedNode$Companion; - public static final field DEFAULT_ANIMATED_NODE_CHILD_COUNT I - public static final field INITIAL_BFS_COLOR I - public fun ()V - public final fun addChild (Lcom/facebook/react/animated/AnimatedNode;)V - public fun onAttachedToNode (Lcom/facebook/react/animated/AnimatedNode;)V - public fun onDetachedFromNode (Lcom/facebook/react/animated/AnimatedNode;)V - public abstract fun prettyPrint ()Ljava/lang/String; - public final fun prettyPrintWithChildren ()Ljava/lang/String; - public final fun removeChild (Lcom/facebook/react/animated/AnimatedNode;)V - public fun update ()V -} - -public final class com/facebook/react/animated/AnimatedNode$Companion { -} - public final class com/facebook/react/animated/NativeAnimatedModule : com/facebook/fbreact/specs/NativeAnimatedModuleSpec, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManagerListener { public static final field ANIMATED_MODULE_DEBUG Z public static final field Companion Lcom/facebook/react/animated/NativeAnimatedModule$Companion; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.kt index 8f698cbe4b1..3759555142e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.kt @@ -10,11 +10,11 @@ package com.facebook.react.animated import java.util.ArrayList /** Base class for all Animated.js library node types that can be created on the "native" side. */ -public abstract class AnimatedNode { +internal abstract class AnimatedNode { - public companion object { - public const val INITIAL_BFS_COLOR: Int = 0 - public const val DEFAULT_ANIMATED_NODE_CHILD_COUNT: Int = 1 + companion object { + const val INITIAL_BFS_COLOR: Int = 0 + const val DEFAULT_ANIMATED_NODE_CHILD_COUNT: Int = 1 } // TODO: T196787278 Reduce the visibility of these fields to package once we have @@ -27,7 +27,7 @@ public abstract class AnimatedNode { @JvmField internal var BFSColor: Int = INITIAL_BFS_COLOR @JvmField internal var tag: Int = -1 - public fun addChild(child: AnimatedNode): Unit { + fun addChild(child: AnimatedNode): Unit { val currentChildren = children ?: ArrayList(DEFAULT_ANIMATED_NODE_CHILD_COUNT).also { children = it } @@ -36,7 +36,7 @@ public abstract class AnimatedNode { child.onAttachedToNode(this) } - public fun removeChild(child: AnimatedNode): Unit { + fun removeChild(child: AnimatedNode): Unit { val currentChildren = children ?: return child.onDetachedFromNode(this) currentChildren.remove(child) @@ -48,24 +48,24 @@ public abstract class AnimatedNode { * is important to also override [onDetachedFromNode] to clear that reference once current node * gets detached. */ - public open fun onAttachedToNode(parent: AnimatedNode): Unit = Unit + open fun onAttachedToNode(parent: AnimatedNode): Unit = Unit /** See [onAttachedToNode] */ - public open fun onDetachedFromNode(parent: AnimatedNode): Unit = Unit + open fun onDetachedFromNode(parent: AnimatedNode): Unit = Unit /** * This method will be run on each node at most once every repetition of the animation loop. It * will be executed on a node only when all the node's parent has already been updated. Therefore * it can be used to calculate node's value. */ - public open fun update(): Unit = Unit + open fun update(): Unit = Unit /** * Pretty-printer for the AnimatedNode. Only called in production pre-crash for debug diagnostics. */ - public abstract fun prettyPrint(): String + abstract fun prettyPrint(): String - public fun prettyPrintWithChildren(): String { + fun prettyPrintWithChildren(): String { val currentChildren = children?.joinToString(" ") return prettyPrint() +