Don't PreAllocate virtual views

Summary:
Virtual views that are flattened and don't "FormsView" on-screen should not be preallocated.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28811419

fbshipit-source-id: 949dcbf4cf3791355c58af785603b35fa50f3f02
This commit is contained in:
Joshua Gross
2021-06-02 12:49:49 -07:00
committed by Facebook GitHub Bot
parent fc2153cc43
commit 8ca18f0b60
3 changed files with 8 additions and 1 deletions
@@ -561,6 +561,9 @@ void Binding::installFabricUIManager(
disablePreallocateViews_ = reactNativeConfig_->getBool(
"react_fabric:disabled_view_preallocation_android");
disableVirtualNodePreallocation_ = reactNativeConfig_->getBool(
"react_fabric:disable_virtual_node_preallocation");
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
@@ -1141,7 +1144,8 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation(
bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics;
if (disableVirtualNodePreallocation_ && !isLayoutableShadowNode) {
if (disableVirtualNodePreallocation_ &&
!shadowView.traits.check(ShadowNodeTraits::Trait::FormsView)) {
return;
}