diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index df25eae418d..da5747ec701 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -716,7 +716,7 @@ public class com/facebook/react/bridge/ColorPropConverter { public static fun resolveResourcePath (Landroid/content/Context;Ljava/lang/String;)Ljava/lang/Integer; } -public class com/facebook/react/bridge/CxxCallbackImpl : com/facebook/jni/HybridClassBase, com/facebook/react/bridge/Callback { +public final class com/facebook/react/bridge/CxxCallbackImpl : com/facebook/jni/HybridClassBase, com/facebook/react/bridge/Callback { public fun invoke ([Ljava/lang/Object;)V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java deleted file mode 100644 index 1f5f9326fe0..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java +++ /dev/null @@ -1,28 +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.bridge; - -import static com.facebook.react.bridge.Arguments.*; - -import com.facebook.jni.HybridClassBase; -import com.facebook.proguard.annotations.DoNotStrip; - -/** Callback impl that calls directly into the cxx bridge. Created from C++. */ -@DoNotStrip -public class CxxCallbackImpl extends HybridClassBase implements Callback { - - @DoNotStrip - private CxxCallbackImpl() {} - - @Override - public void invoke(Object... args) { - nativeInvoke(fromJavaArgs(args)); - } - - private native void nativeInvoke(NativeArray arguments); -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.kt new file mode 100644 index 00000000000..509e3182830 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.kt @@ -0,0 +1,21 @@ +/* + * 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.bridge + +import com.facebook.jni.HybridClassBase +import com.facebook.proguard.annotations.DoNotStrip + +/** Callback impl that calls directly into the cxx bridge. Created from C++. */ +@DoNotStrip +public class CxxCallbackImpl @DoNotStrip private constructor() : HybridClassBase(), Callback { + override fun invoke(vararg args: Any?) { + nativeInvoke(Arguments.fromJavaArgs(args)) + } + + private external fun nativeInvoke(arguments: NativeArray) +}