diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java deleted file mode 100644 index 63a3e0c38c5..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java +++ /dev/null @@ -1,48 +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.events; - -import android.annotation.SuppressLint; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.jni.HybridData; -import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.fabric.FabricSoLoader; -import com.facebook.react.uimanager.events.BatchEventDispatchedListener; - -/** - * Class that acts as a proxy between the list of EventBeats registered in C++ and the Android side. - */ -@Nullsafe(Nullsafe.Mode.LOCAL) -@SuppressLint("MissingNativeLoadLibrary") -public final class EventBeatManager implements BatchEventDispatchedListener { - - static { - FabricSoLoader.staticInit(); - } - - @DoNotStrip private final HybridData mHybridData; - - private static native HybridData initHybrid(); - - private native void tick(); - - @Deprecated(forRemoval = true, since = "Deprecated on v0.72.0 Use EventBeatManager() instead") - public EventBeatManager(ReactApplicationContext reactApplicationContext) { - this(); - } - - public EventBeatManager() { - mHybridData = initHybrid(); - } - - @Override - public void onBatchEventDispatched() { - tick(); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.kt new file mode 100644 index 00000000000..62f09aa30d9 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.kt @@ -0,0 +1,43 @@ +/* + * 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.events + +import android.annotation.SuppressLint +import com.facebook.jni.HybridData +import com.facebook.proguard.annotations.DoNotStrip +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.fabric.FabricSoLoader +import com.facebook.react.uimanager.events.BatchEventDispatchedListener + +/** + * Class that acts as a proxy between the list of EventBeats registered in C++ and the Android side. + */ +@SuppressLint("MissingNativeLoadLibrary") +@DoNotStrip +public final class EventBeatManager() : BatchEventDispatchedListener { + + @Suppress("NoHungarianNotation") @DoNotStrip private val mHybridData: HybridData = initHybrid() + + private external fun tick() + + @Deprecated("Deprecated on v0.72.0 Use EventBeatManager() instead") + @Suppress("UNUSED_PARAMETER") + public constructor(reactApplicationContext: ReactApplicationContext?) : this() + + override public fun onBatchEventDispatched() { + tick() + } + + private companion object { + init { + FabricSoLoader.staticInit() + } + + @JvmStatic private external fun initHybrid(): HybridData + } +}