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 6f5921ae3a8..e1f5b6af696 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 @@ -238,6 +238,8 @@ void Binding::installFabricUIManager( reactNativeConfig_ = config; shouldCollateRemovesAndDeletes_ = reactNativeConfig_->getBool("react_fabric:enable_removedelete_collation_android"); + disablePreallocateViews_ = reactNativeConfig_->getBool("react_fabric:disabled_view_preallocation_android"); + auto toolbox = SchedulerToolbox{}; toolbox.contextContainer = contextContainer; toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction; @@ -602,7 +604,7 @@ void Binding::schedulerDidFinishTransaction( switch (mutation.type) { case ShadowViewMutation::Create: { - if (mutation.newChildShadowView.props->revision > 1 || + if (disablePreallocateViews_ || mutation.newChildShadowView.props->revision > 1 || deletedViewTags.find(mutation.newChildShadowView.tag) != deletedViewTags.end()) { mountItems[position++] = @@ -683,7 +685,7 @@ void Binding::schedulerDidFinishTransaction( mountItems[position++] = createInsertMountItem(localJavaUIManager, mutation); - if (mutation.newChildShadowView.props->revision > 1 || + if (disablePreallocateViews_ || mutation.newChildShadowView.props->revision > 1 || deletedViewTags.find(mutation.newChildShadowView.tag) != deletedViewTags.end()) { mountItems[position++] = @@ -780,6 +782,10 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( const SurfaceId surfaceId, const ShadowView &shadowView) { + if (disablePreallocateViews_) { + return; + } + jni::global_ref localJavaUIManager = getJavaUIManager(); if (!localJavaUIManager) { LOG(ERROR) << "Binding::schedulerDidRequestPreliminaryViewAllocation: JavaUIManager disappeared"; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 1840e023a7e..826b8fab714 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -105,6 +105,7 @@ class Binding : public jni::HybridClass, public SchedulerDelegate { std::shared_ptr reactNativeConfig_{nullptr}; bool shouldCollateRemovesAndDeletes_{false}; + bool disablePreallocateViews_{false}; }; } // namespace react