Skip to content

Commit cc71f9c

Browse files
Nick Lefeverfacebook-github-bot
authored andcommitted
Create tryDispatchMountItems runnable only when needed (#53196)
Summary: Pull Request resolved: #53196 In the FabricUIManager, the runnable created for scheduled mounts is only used if currently running on the UI thread. With this diff the runnable only gets created when needed. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D79969412 fbshipit-source-id: ee78890322af8580357389aad8357f7c0d18490f
1 parent 6738dbc commit cc71f9c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -935,14 +935,14 @@ private void scheduleMountItem(
935935
if (shouldSchedule) {
936936
Assertions.assertNotNull(mountItem, "MountItem is null");
937937
mMountItemDispatcher.addMountItem(mountItem);
938-
Runnable runnable =
939-
new GuardedRunnable(mReactApplicationContext) {
940-
@Override
941-
public void runGuarded() {
942-
mMountItemDispatcher.tryDispatchMountItems();
943-
}
944-
};
945938
if (UiThreadUtil.isOnUiThread()) {
939+
Runnable runnable =
940+
new GuardedRunnable(mReactApplicationContext) {
941+
@Override
942+
public void runGuarded() {
943+
mMountItemDispatcher.tryDispatchMountItems();
944+
}
945+
};
946946
runnable.run();
947947
}
948948
}

0 commit comments

Comments
 (0)