mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java (#45733)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45733 Reviewed By: cortinico Differential Revision: D60233799 fbshipit-source-id: 61ebdb2833edbb29e7e4648e5c2ad2d560a47966
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b32f447f89
commit
1bf89daf03
-48
@@ -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();
|
||||
}
|
||||
}
|
||||
+43
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user