diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index b3aec67b671..9551e266a05 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -255,7 +255,9 @@ void Binding::installFabricUIManager( "react_fabric:enable_removedelete_collation_android"); collapseDeleteCreateMountingInstructions_ = reactNativeConfig_->getBool( "react_fabric:enabled_collapse_delete_create_mounting_instructions"); - ; + + disableVirtualNodePreallocation_ = reactNativeConfig_->getBool( + "react_fabric:disable_virtual_node_preallocation"); disablePreallocateViews_ = reactNativeConfig_->getBool( "react_fabric:disabled_view_preallocation_android"); @@ -862,6 +864,10 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics; + if (disableVirtualNodePreallocation_ && !isLayoutableShadowNode) { + return; + } + static auto preallocateView = jni::findClassStatic(UIManagerJavaDescriptor) ->getMethod, public SchedulerDelegate { bool shouldCollateRemovesAndDeletes_{false}; bool collapseDeleteCreateMountingInstructions_{false}; bool disablePreallocateViews_{false}; + bool disableVirtualNodePreallocation_{false}; }; } // namespace react