Skip to content

Commit 117f3c9

Browse files
javachemeta-codesync[bot]
authored andcommitted
Return null from resolveView for stopped surfaces (#55737)
Summary: Pull Request resolved: #55737 `FabricUIManager.resolveView` can throw `IllegalViewOperationException` when called with a tag belonging to a stopped surface. This happens because `getSurfaceManagerForView` returns a stopped `SurfaceMountingManager` (via `tagSetForStoppedSurface`), but `getView` then throws since `tagToViewState` was cleared during `stopSurface()`. Add an `isStopped()` check before calling `getView`, returning `null` instead. This follows the same pattern already used by `measure()` and `measureText()` in the same file. Changelog: [Internal] Fixes T257147576. Reviewed By: cortinico Differential Revision: D94347789 fbshipit-source-id: 0f68e0ffc8b2c891aa33c408e427acd7e1e5b829
1 parent 8230f3b commit 117f3c9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,10 @@ public void updateRootLayoutSpecs(
10591059
UiThreadUtil.assertOnUiThread();
10601060

10611061
SurfaceMountingManager surfaceManager = mMountingManager.getSurfaceManagerForView(reactTag);
1062-
return surfaceManager == null ? null : surfaceManager.getView(reactTag);
1062+
if (surfaceManager == null || surfaceManager.isStopped()) {
1063+
return null;
1064+
}
1065+
return surfaceManager.getView(reactTag);
10631066
}
10641067

10651068
@Override

0 commit comments

Comments
 (0)