@@ -327,25 +327,28 @@ jsi::Value UIManagerBinding::get(
327
327
});
328
328
}
329
329
330
- // Semantic: Clones the node with *same* props and *empty * children.
330
+ // Semantic: Clones the node with *same* props and *given * children.
331
331
if (methodName == " cloneNodeWithNewChildren" ) {
332
- auto paramCount = 1 ;
332
+ auto paramCount = 2 ;
333
333
return jsi::Function::createFromHostFunction (
334
334
runtime,
335
335
name,
336
336
paramCount,
337
- [uiManager, methodName, paramCount ](
337
+ [uiManager, methodName](
338
338
jsi::Runtime& runtime,
339
339
const jsi::Value& /* thisValue*/ ,
340
340
const jsi::Value* arguments,
341
341
size_t count) -> jsi::Value {
342
- validateArgumentCount (runtime, methodName, paramCount, count);
342
+ // TODO: re-enable when passChildrenWhenCloningPersistedNodes is
343
+ // rolled out
344
+ // validateArgumentCount(runtime, methodName, paramCount, count);
343
345
344
346
return valueFromShadowNode (
345
347
runtime,
346
348
uiManager->cloneNode (
347
349
*shadowNodeFromValue (runtime, arguments[0 ]),
348
- ShadowNode::emptySharedShadowNodeSharedList ()));
350
+ count > 1 ? shadowNodeListFromValue (runtime, arguments[1 ])
351
+ : ShadowNode::emptySharedShadowNodeSharedList ()));
349
352
});
350
353
}
351
354
@@ -363,7 +366,7 @@ jsi::Value UIManagerBinding::get(
363
366
size_t count) -> jsi::Value {
364
367
validateArgumentCount (runtime, methodName, paramCount, count);
365
368
366
- const auto & rawProps = RawProps (runtime, arguments[1 ]);
369
+ RawProps rawProps (runtime, arguments[1 ]);
367
370
return valueFromShadowNode (
368
371
runtime,
369
372
uiManager->cloneNode (
@@ -373,26 +376,31 @@ jsi::Value UIManagerBinding::get(
373
376
});
374
377
}
375
378
376
- // Semantic: Clones the node with *given* props and *empty * children.
379
+ // Semantic: Clones the node with *given* props and *given * children.
377
380
if (methodName == " cloneNodeWithNewChildrenAndProps" ) {
378
- auto paramCount = 2 ;
381
+ auto paramCount = 3 ;
379
382
return jsi::Function::createFromHostFunction (
380
383
runtime,
381
384
name,
382
385
paramCount,
383
- [uiManager, methodName, paramCount ](
386
+ [uiManager, methodName](
384
387
jsi::Runtime& runtime,
385
388
const jsi::Value& /* thisValue*/ ,
386
389
const jsi::Value* arguments,
387
390
size_t count) -> jsi::Value {
388
- validateArgumentCount (runtime, methodName, paramCount, count);
391
+ // TODO: re-enable when passChildrenWhenCloningPersistedNodes is
392
+ // rolled out
393
+ // validateArgumentCount(runtime, methodName, paramCount, count);
389
394
390
- const auto & rawProps = RawProps (runtime, arguments[1 ]);
395
+ bool hasChildrenArg = count == 3 ;
396
+ RawProps rawProps (runtime, arguments[hasChildrenArg ? 2 : 1 ]);
391
397
return valueFromShadowNode (
392
398
runtime,
393
399
uiManager->cloneNode (
394
400
*shadowNodeFromValue (runtime, arguments[0 ]),
395
- ShadowNode::emptySharedShadowNodeSharedList (),
401
+ hasChildrenArg
402
+ ? shadowNodeListFromValue (runtime, arguments[1 ])
403
+ : ShadowNode::emptySharedShadowNodeSharedList (),
396
404
&rawProps));
397
405
});
398
406
}
@@ -417,6 +425,7 @@ jsi::Value UIManagerBinding::get(
417
425
});
418
426
}
419
427
428
+ // TODO: remove when passChildrenWhenCloningPersistedNodes is rolled out
420
429
if (methodName == " createChildSet" ) {
421
430
return jsi::Function::createFromHostFunction (
422
431
runtime,
@@ -432,6 +441,7 @@ jsi::Value UIManagerBinding::get(
432
441
});
433
442
}
434
443
444
+ // TODO: remove when passChildrenWhenCloningPersistedNodes is rolled out
435
445
if (methodName == " appendChildToSet" ) {
436
446
auto paramCount = 2 ;
437
447
return jsi::Function::createFromHostFunction (
@@ -475,17 +485,13 @@ jsi::Value UIManagerBinding::get(
475
485
if (!uiManager->backgroundExecutor_ ||
476
486
(runtimeSchedulerBinding &&
477
487
runtimeSchedulerBinding->getIsSynchronous ())) {
478
- auto weakShadowNodeList =
479
- weakShadowNodeListFromValue (runtime, arguments[1 ]);
480
488
auto shadowNodeList =
481
- shadowNodeListFromWeakList (weakShadowNodeList);
482
- if (shadowNodeList) {
483
- uiManager->completeSurface (
484
- surfaceId,
485
- shadowNodeList,
486
- {/* .enableStateReconciliation = */ true ,
487
- /* .mountSynchronously = */ false });
488
- }
489
+ shadowNodeListFromValue (runtime, arguments[1 ]);
490
+ uiManager->completeSurface (
491
+ surfaceId,
492
+ shadowNodeList,
493
+ {/* .enableStateReconciliation = */ true ,
494
+ /* .mountSynchronously = */ false });
489
495
} else {
490
496
auto weakShadowNodeList =
491
497
weakShadowNodeListFromValue (runtime, arguments[1 ]);
0 commit comments