mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Check if view exists before skipping CREATE command
Summary: Updates early return in the CREATE command codepath that checks if the view already exists before allocating it. Normally the view state is expected to be created only if the view is preallocated, but empty view state is also created for the flattened nodes when they create an event emitter. By checking the view existence, we can ensure that view was indeed preallocated before, and skip for optimization purposes. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D34050884 fbshipit-source-id: 489fc1052fec9f71712ea729121ac8ef3e3f3d4e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
669cd0257c
commit
ebc856b2de
+2
-1
@@ -548,7 +548,8 @@ public class SurfaceMountingManager {
|
||||
// generated.
|
||||
// This represents a perf issue only, not a correctness issue. In the future we need to
|
||||
// refactor View preallocation to correct the currently incorrect assumptions.
|
||||
if (getNullableViewState(reactTag) != null) {
|
||||
ViewState viewState = getNullableViewState(reactTag);
|
||||
if (viewState != null && viewState.mView != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user