Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@ public final class com/facebook/react/bridge/NativeModuleRegistry {
public final fun getModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
public final fun hasModule (Ljava/lang/Class;)Z
public final fun hasModule (Ljava/lang/String;)Z
public final fun onBatchComplete ()V
}

public final class com/facebook/react/bridge/NoSuchKeyException : java/lang/RuntimeException {
Expand Down Expand Up @@ -4341,7 +4340,7 @@ public final class com/facebook/react/uimanager/UIManagerHelper {
public static final fun getUIManagerForReactTag (Lcom/facebook/react/bridge/ReactContext;I)Lcom/facebook/react/bridge/UIManager;
}

public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/bridge/ReactContextBaseJavaModule, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/OnBatchCompleteListener, com/facebook/react/bridge/UIManager {
public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/bridge/ReactContextBaseJavaModule, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManager {
public static final field NAME Ljava/lang/String;
public static final field TAG Ljava/lang/String;
public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Lcom/facebook/react/uimanager/ViewManagerResolver;I)V
Expand Down Expand Up @@ -4376,7 +4375,6 @@ public class com/facebook/react/uimanager/UIManagerModule : com/facebook/react/b
public fun measure (ILcom/facebook/react/bridge/Callback;)V
public fun measureInWindow (ILcom/facebook/react/bridge/Callback;)V
public fun measureLayout (IILcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V
public fun onBatchComplete ()V
public fun onHostDestroy ()V
public fun onHostPause ()V
public fun onHostResume ()V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,6 @@ private static class InstanceCallback {
mOuter = new WeakReference<>(outer);
}

public void onBatchComplete() {
CatalystInstanceImpl impl = mOuter.get();
if (impl != null) {
impl.mNativeModulesQueueThread.runOnQueue(
() -> {
impl.mNativeModuleRegistry.onBatchComplete();
});
}
}

public void incrementPendingJSCalls() {
CatalystInstanceImpl impl = mOuter.get();
if (impl != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,6 @@ public class NativeModuleRegistry(
}
}

public fun onBatchComplete() {
// The only native module that uses the onBatchComplete is the UI Manager. Hence, instead of
// iterating over all the modules for find this one instance, and then calling it, we
// short-circuit
// the search, and simply call OnBatchComplete on the UI Manager.
// With Fabric, UIManager would no longer be a NativeModule, so this call would simply go away
assertLegacyArchitecture(
"NativeModuleRegistry.onBatchComplete()",
LegacyArchitectureLogLevel.WARNING,
)
modules["UIManager"]?.let {
if (it.hasInstance()) {
(it.module as OnBatchCompleteListener).onBatchComplete()
}
}
}

public fun <T : NativeModule> hasModule(moduleInterface: Class<T>): Boolean {
val annotation = moduleInterface.getAnnotation(ReactModule::class.java)
requireNotNull(annotation) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.bridge.GuardedRunnable;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.OnBatchCompleteListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMarker;
Expand Down Expand Up @@ -89,7 +88,7 @@
@Deprecated(
since = "This class is part of Legacy Architecture and will be removed in a future release")
public class UIManagerModule extends ReactContextBaseJavaModule
implements OnBatchCompleteListener, LifecycleEventListener, UIManager {
implements LifecycleEventListener, UIManager {
static {
LegacyArchitectureLogger.assertLegacyArchitecture(
"UIManagerModule", LegacyArchitectureLogLevel.ERROR);
Expand Down Expand Up @@ -661,43 +660,6 @@ public void configureNextLayoutAnimation(ReadableMap config, Callback success, C
mUIImplementation.configureNextLayoutAnimation(config, success);
}

/**
* To implement the transactional requirement mentioned in the class javadoc, we only commit UI
* changes to the actual view hierarchy once a batch of JS->Java calls have been completed. We
* know this is safe because all JS->Java calls that are triggered by a Java->JS call (e.g. the
* delivery of a touch event or execution of 'renderApplication') end up in a single JS->Java
* transaction.
*
* <p>A better way to do this would be to have JS explicitly signal to this module when a UI
* transaction is done. Right now, though, this is how iOS does it, and we should probably update
* the JS and native code and make this change at the same time.
*
* <p>TODO(5279396): Make JS UI library explicitly notify the native UI module of the end of a UI
* transaction using a standard native call
*/
@Override
public void onBatchComplete() {
int batchId = mBatchId;
mBatchId++;

SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT, "onBatchCompleteUI")
.arg("BatchId", batchId)
.flush();
for (UIManagerListener listener : mUIManagerListeners) {
listener.willDispatchViewUpdates(this);
}
try {
// If there are no RootViews registered, there will be no View updates to dispatch.
// This is a hack to prevent this from being called when Fabric is used everywhere.
// This should no longer be necessary in Bridgeless Mode.
if (mUIImplementation.getRootViewNum() > 0) {
mUIImplementation.dispatchViewUpdates(batchId);
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT);
}
}

@Override
public EventDispatcher getEventDispatcher() {
return mEventDispatcher;
Expand Down