diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 1c1ddf86c85..4e8b9a8fe19 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -2488,7 +2488,7 @@ public class com/facebook/react/fabric/BindingImpl : com/facebook/react/fabric/B public fun unregisterSurface (Lcom/facebook/react/fabric/SurfaceHandlerBinding;)V } -public class com/facebook/react/fabric/ComponentFactory { +public final class com/facebook/react/fabric/ComponentFactory { public fun ()V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java deleted file mode 100644 index f0be02df1e7..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java +++ /dev/null @@ -1,32 +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.fabric; - -import androidx.annotation.NonNull; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.jni.HybridData; -import com.facebook.proguard.annotations.DoNotStrip; - -@Nullsafe(Nullsafe.Mode.LOCAL) -@DoNotStrip -public class ComponentFactory { - - static { - FabricSoLoader.staticInit(); - } - - @NonNull @DoNotStrip private final HybridData mHybridData; - - @DoNotStrip - private static native HybridData initHybrid(); - - @DoNotStrip - public ComponentFactory() { - mHybridData = initHybrid(); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.kt new file mode 100644 index 00000000000..bd863d6cd55 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.kt @@ -0,0 +1,25 @@ +/* + * 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.fabric + +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStripAny + +@DoNotStripAny +public class ComponentFactory { + + @Suppress("NoHungarianNotation") private val mHybridData: HybridData = initHybrid() + + private companion object { + init { + FabricSoLoader.staticInit() + } + + @JvmStatic private external fun initHybrid(): HybridData + } +}