@@ -153,7 +153,11 @@ void LayoutAnimationsProxy::parseRemoveMutations(
153
153
if (mutation.type == ShadowViewMutation::Remove) {
154
154
updateIndexForMutation (mutation);
155
155
auto tag = mutation.oldChildShadowView .tag ;
156
+ #if REACT_NATIVE_MINOR_VERSION >= 78
157
+ auto parentTag = mutation.parentTag ;
158
+ #else
156
159
auto parentTag = mutation.parentShadowView .tag ;
160
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
157
161
auto unflattenedParentTag = parentTag; // temporary
158
162
159
163
std::shared_ptr<MutationNode> mutationNode;
@@ -287,17 +291,24 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
287
291
}
288
292
case ShadowViewMutation::Type::Insert: {
289
293
updateIndexForMutation (mutation);
290
- if (nodeForTag_.contains (mutation.parentShadowView .tag )) {
291
- nodeForTag_[mutation.parentShadowView .tag ]->applyMutationToIndices (
292
- mutation);
294
+
295
+ #if REACT_NATIVE_MINOR_VERSION >= 78
296
+ const auto parentTag = mutation.parentTag ;
297
+ const auto mutationParent = parentTag;
298
+ #else
299
+ const auto parentTag = mutation.parentShadowView .tag ;
300
+ const auto mutationParent = mutation.parentShadowView ;
301
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
302
+ if (nodeForTag_.contains (parentTag)) {
303
+ nodeForTag_[parentTag]->applyMutationToIndices (mutation);
293
304
}
294
305
295
306
if (movedViews.contains (tag)) {
296
307
auto layoutAnimationIt = layoutAnimations_.find (tag);
297
308
if (layoutAnimationIt == layoutAnimations_.end ()) {
298
309
if (oldShadowViewsForReparentings.contains (tag)) {
299
310
filteredMutations.push_back (ShadowViewMutation::InsertMutation (
300
- mutation. parentShadowView ,
311
+ mutationParent ,
301
312
oldShadowViewsForReparentings[tag],
302
313
mutation.index ));
303
314
} else {
@@ -308,7 +319,7 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
308
319
309
320
auto oldView = *layoutAnimationIt->second .currentView ;
310
321
filteredMutations.push_back (ShadowViewMutation::InsertMutation (
311
- mutation. parentShadowView , oldView, mutation.index ));
322
+ mutationParent , oldView, mutation.index ));
312
323
continue ;
313
324
}
314
325
@@ -328,7 +339,7 @@ void LayoutAnimationsProxy::handleUpdatesAndEnterings(
328
339
cloneViewWithoutOpacity (mutation, propsParserContext);
329
340
330
341
filteredMutations.push_back (ShadowViewMutation::UpdateMutation (
331
- mutation.newChildShadowView , *newView, mutation. parentShadowView ));
342
+ mutation.newChildShadowView , *newView, mutationParent ));
332
343
break ;
333
344
}
334
345
@@ -386,7 +397,14 @@ void LayoutAnimationsProxy::addOngoingAnimations(
386
397
updateLayoutMetrics (newView->layoutMetrics , updateValues.frame );
387
398
388
399
mutations.push_back (ShadowViewMutation::UpdateMutation (
389
- *layoutAnimation.currentView , *newView, *layoutAnimation.parentView ));
400
+ *layoutAnimation.currentView ,
401
+ *newView,
402
+ #if REACT_NATIVE_MINOR_VERSION >= 78
403
+ layoutAnimation.parentTag
404
+ #else
405
+ *layoutAnimation.parentView
406
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
407
+ ));
390
408
layoutAnimation.currentView = newView;
391
409
}
392
410
updateMap.clear ();
@@ -549,12 +567,18 @@ void LayoutAnimationsProxy::updateIndexForMutation(
549
567
if (mutation.index == -1 ) {
550
568
return ;
551
569
}
552
- if (!nodeForTag_.contains (mutation.parentShadowView .tag )) {
570
+
571
+ #if REACT_NATIVE_MINOR_VERSION >= 78
572
+ const auto parentTag = mutation.parentTag ;
573
+ #else
574
+ const auto parentTag = mutation.parentShadowView .tag ;
575
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
576
+
577
+ if (!nodeForTag_.contains (parentTag)) {
553
578
return ;
554
579
}
555
580
556
- auto parent = nodeForTag_[mutation.parentShadowView .tag ];
557
-
581
+ auto parent = nodeForTag_[parentTag];
558
582
int size = 0 , prevIndex = -1 , offset = 0 ;
559
583
560
584
for (auto &subNode : parent->children ) {
@@ -569,9 +593,8 @@ void LayoutAnimationsProxy::updateIndexForMutation(
569
593
int tag = mutation.type == ShadowViewMutation::Insert
570
594
? mutation.newChildShadowView .tag
571
595
: mutation.oldChildShadowView .tag ;
572
- LOG (INFO) << " update index for " << tag << " in "
573
- << mutation.parentShadowView .tag << " : " << mutation.index << " -> "
574
- << mutation.index + offset << std::endl;
596
+ LOG (INFO) << " update index for " << tag << " in " << parentTag << " : "
597
+ << mutation.index << " -> " << mutation.index + offset << std::endl;
575
598
#endif
576
599
mutation.index += offset;
577
600
}
@@ -599,9 +622,16 @@ void LayoutAnimationsProxy::createLayoutAnimation(
599
622
? mutation.oldChildShadowView
600
623
: mutation.newChildShadowView );
601
624
auto currentView = std::make_shared<ShadowView>(oldView);
625
+
626
+ #if REACT_NATIVE_MINOR_VERSION >= 78
627
+ layoutAnimations_.insert_or_assign (
628
+ tag,
629
+ LayoutAnimation{finalView, currentView, mutation.parentTag , {}, count});
630
+ #else
602
631
auto parentView = std::make_shared<ShadowView>(mutation.parentShadowView );
603
632
layoutAnimations_.insert_or_assign (
604
633
tag, LayoutAnimation{finalView, currentView, parentView, {}, count});
634
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
605
635
}
606
636
607
637
void LayoutAnimationsProxy::startEnteringAnimation (
@@ -612,7 +642,9 @@ void LayoutAnimationsProxy::startEnteringAnimation(
612
642
#endif
613
643
auto finalView = std::make_shared<ShadowView>(mutation.newChildShadowView );
614
644
auto current = std::make_shared<ShadowView>(mutation.newChildShadowView );
645
+ #if REACT_NATIVE_MINOR_VERSION < 78
615
646
auto parent = std::make_shared<ShadowView>(mutation.parentShadowView );
647
+ #endif
616
648
617
649
auto &viewProps =
618
650
static_cast <const ViewProps &>(*mutation.newChildShadowView .props );
@@ -621,7 +653,9 @@ void LayoutAnimationsProxy::startEnteringAnimation(
621
653
uiScheduler_->scheduleOnUI ([weakThis = weak_from_this (),
622
654
finalView,
623
655
current,
656
+ #if REACT_NATIVE_MINOR_VERSION < 78
624
657
parent,
658
+ #endif // REACT_NATIVE_MINOR_VERSION < 78
625
659
mutation,
626
660
opacity,
627
661
tag]() {
@@ -635,7 +669,16 @@ void LayoutAnimationsProxy::startEnteringAnimation(
635
669
auto &mutex = strongThis->mutex ;
636
670
auto lock = std::unique_lock<std::recursive_mutex>(mutex);
637
671
strongThis->layoutAnimations_ .insert_or_assign (
638
- tag, LayoutAnimation{finalView, current, parent, opacity});
672
+ tag,
673
+ LayoutAnimation{
674
+ finalView,
675
+ current,
676
+ #if REACT_NATIVE_MINOR_VERSION >= 78
677
+ mutation.parentTag ,
678
+ #else
679
+ parent,
680
+ #endif // REACT_NATIVE_MINOR_VERSION >= 78
681
+ opacity});
639
682
window = strongThis->surfaceManager .getWindow (
640
683
mutation.newChildShadowView .surfaceId );
641
684
}
0 commit comments