Skip to content

Commit 131844f

Browse files
Andrei Shikovfacebook-github-bot
Andrei Shikov
authored andcommitted
Add feature flag to disable pre-allocation on clone
Summary: Disables preallocation for cloned nodes, switching to create during commit for those cases instead. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D34555621 fbshipit-source-id: 21fc834cea318ca299aa37a9aab28a2f2a9675b5
1 parent f47082b commit 131844f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ void Binding::installFabricUIManager(
367367
disableRevisionCheckForPreallocation_ =
368368
config->getBool("react_fabric:disable_revision_check_for_preallocation");
369369

370+
disablePreallocationOnClone_ = config->getBool(
371+
"react_native_new_architecture:disable_preallocation_on_clone_android");
372+
370373
if (enableFabricLogs_) {
371374
LOG(WARNING) << "Binding::installFabricUIManager() was called (address: "
372375
<< this << ").";
@@ -505,6 +508,9 @@ void Binding::schedulerDidCloneShadowNode(
505508
SurfaceId surfaceId,
506509
ShadowNode const &oldShadowNode,
507510
ShadowNode const &newShadowNode) {
511+
if (disablePreallocationOnClone_) {
512+
return;
513+
}
508514
// This is only necessary if view preallocation was skipped during
509515
// createShadowNode
510516

ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class Binding : public jni::HybridClass<Binding>,
156156
bool enableFabricLogs_{false};
157157
bool disableRevisionCheckForPreallocation_{false};
158158
bool dispatchPreallocationInBackground_{false};
159+
bool disablePreallocationOnClone_{false};
159160
};
160161

161162
} // namespace react

0 commit comments

Comments
 (0)