@@ -329,7 +329,7 @@ jsi::Value UIManagerBinding::get(
329329
330330 // Semantic: Clones the node with *same* props and *empty* children.
331331 if (methodName == " cloneNodeWithNewChildren" ) {
332- auto paramCount = 1 ;
332+ auto paramCount = 2 ;
333333 return jsi::Function::createFromHostFunction (
334334 runtime,
335335 name,
@@ -345,7 +345,8 @@ jsi::Value UIManagerBinding::get(
345345 runtime,
346346 uiManager->cloneNode (
347347 *shadowNodeFromValue (runtime, arguments[0 ]),
348- ShadowNode::emptySharedShadowNodeSharedList ()));
348+ count > 1 ? shadowNodeListFromValue (runtime, arguments[1 ])
349+ : ShadowNode::emptySharedShadowNodeSharedList ()));
349350 });
350351 }
351352
@@ -363,7 +364,7 @@ jsi::Value UIManagerBinding::get(
363364 size_t count) -> jsi::Value {
364365 validateArgumentCount (runtime, methodName, paramCount, count);
365366
366- const auto & rawProps = RawProps (runtime, arguments[1 ]);
367+ RawProps rawProps (runtime, arguments[1 ]);
367368 return valueFromShadowNode (
368369 runtime,
369370 uiManager->cloneNode (
@@ -375,7 +376,7 @@ jsi::Value UIManagerBinding::get(
375376
376377 // Semantic: Clones the node with *given* props and *empty* children.
377378 if (methodName == " cloneNodeWithNewChildrenAndProps" ) {
378- auto paramCount = 2 ;
379+ auto paramCount = 3 ;
379380 return jsi::Function::createFromHostFunction (
380381 runtime,
381382 name,
@@ -387,12 +388,16 @@ jsi::Value UIManagerBinding::get(
387388 size_t count) -> jsi::Value {
388389 validateArgumentCount (runtime, methodName, paramCount, count);
389390
390- const auto & rawProps = RawProps (runtime, arguments[1 ]);
391+ bool hasChildrenArg = count == 3 ;
392+
393+ RawProps rawProps (runtime, arguments[hasChildrenArg ? 2 : 1 ]);
391394 return valueFromShadowNode (
392395 runtime,
393396 uiManager->cloneNode (
394397 *shadowNodeFromValue (runtime, arguments[0 ]),
395- ShadowNode::emptySharedShadowNodeSharedList (),
398+ hasChildrenArg
399+ ? shadowNodeListFromValue (runtime, arguments[1 ])
400+ : ShadowNode::emptySharedShadowNodeSharedList (),
396401 &rawProps));
397402 });
398403 }
@@ -417,6 +422,7 @@ jsi::Value UIManagerBinding::get(
417422 });
418423 }
419424
425+ // TODO: remove when passChildrenWhenCloningPersistedNodes is rolled out
420426 if (methodName == " createChildSet" ) {
421427 return jsi::Function::createFromHostFunction (
422428 runtime,
@@ -432,6 +438,7 @@ jsi::Value UIManagerBinding::get(
432438 });
433439 }
434440
441+ // TODO: remove when passChildrenWhenCloningPersistedNodes is rolled out
435442 if (methodName == " appendChildToSet" ) {
436443 auto paramCount = 2 ;
437444 return jsi::Function::createFromHostFunction (
@@ -475,17 +482,13 @@ jsi::Value UIManagerBinding::get(
475482 if (!uiManager->backgroundExecutor_ ||
476483 (runtimeSchedulerBinding &&
477484 runtimeSchedulerBinding->getIsSynchronous ())) {
478- auto weakShadowNodeList =
479- weakShadowNodeListFromValue (runtime, arguments[1 ]);
480485 auto shadowNodeList =
481- shadowNodeListFromWeakList (weakShadowNodeList);
482- if (shadowNodeList) {
483- uiManager->completeSurface (
484- surfaceId,
485- shadowNodeList,
486- {/* .enableStateReconciliation = */ true ,
487- /* .mountSynchronously = */ false });
488- }
486+ shadowNodeListFromValue (runtime, arguments[1 ]);
487+ uiManager->completeSurface (
488+ surfaceId,
489+ shadowNodeList,
490+ {/* .enableStateReconciliation = */ true ,
491+ /* .mountSynchronously = */ false });
489492 } else {
490493 auto weakShadowNodeList =
491494 weakShadowNodeListFromValue (runtime, arguments[1 ]);
0 commit comments