186
addMarkerIncompleteCallbackToPendingTransition,
187
addMarkerCompleteCallbackToPendingTransition,
188
retryDehydratedSuspenseBoundary,
189
+ scheduleViewTransitionEvent,
190
} from './ReactFiberWorkLoop';
191
import {
192
HasEffect as HookHasEffect,
650
if (child.tag === OffscreenComponent && child.memoizedState === null) {
651
// This tree was already hidden so we skip it.
652
} else {
653
+ commitAppearingPairViewTransitions(child);
654
if (
655
child.tag === ViewTransitionComponent &&
656
(child.flags & ViewTransitionNamedStatic) !== NoFlags
684
}
685
}
686
}
685
- commitAppearingPairViewTransitions(child);
687
}
688
child = child.sibling;
689
}
702
false,
703
);
704
if (!inViewport) {
705
+ // TODO: If this was part of a pair we will still run the onShare callback.
706
// Revert the transition names. This boundary is not in the viewport
707
// so we won't bother animating it.
708
restoreViewTransitionOnHostInstances(placement.child, false);
709
// TODO: Should we still visit the children in case a named one was in the viewport?
710
} else {
711
commitAppearingPairViewTransitions(placement);
712
+
713
+ const state: ViewTransitionState = placement.stateNode;
714
+ if (!state.paired) {
715
+ scheduleViewTransitionEvent(placement, props.onEnter);
716
+ }
717
}
718
} else if ((placement.subtreeFlags & ViewTransitionStatic) !== NoFlags) {
719
let child = placement.child;
771
const oldinstance: ViewTransitionState = child.stateNode;
772
const newInstance: ViewTransitionState = pair;
773
newInstance.paired = oldinstance;
774
+ // Note: If the other side ends up outside the viewport, we'll still run this.
775
+ // Therefore it's possible for onShare to be called with only an old snapshot.
776
+ scheduleViewTransitionEvent(child, props.onShare);
777
}
778
// Delete the entry so that we know when we've found all of them
779
// and can stop searching (size reaches zero).
821
// Delete the entry so that we know when we've found all of them
822
// and can stop searching (size reaches zero).
823
appearingViewTransitions.delete(name);
824
+ // Note: If the other side ends up outside the viewport, we'll still run this.
825
+ // Therefore it's possible for onShare to be called with only an old snapshot.
826
+ scheduleViewTransitionEvent(deletion, props.onShare);
827
+ } else {
828
+ scheduleViewTransitionEvent(deletion, props.onExit);
829
}
830
// Look for more pairs deeper in the tree.
831
commitDeletedPairViewTransitions(deletion, appearingViewTransitions);
832
+ } else {
833
+ scheduleViewTransitionEvent(deletion, props.onExit);
834
}
835
} else if ((deletion.subtreeFlags & ViewTransitionStatic) !== NoFlags) {
836
let child = deletion.child;
1135
child.memoizedState,
1136
false,
1137
);
1138
+ const props: ViewTransitionProps = child.memoizedProps;
1139
+ scheduleViewTransitionEvent(child, props.onLayout);
1140
}
1141
} else if ((child.subtreeFlags & ViewTransitionStatic) !== NoFlags) {
1142
measureNestedViewTransitions(child);
3094
(Placement | Update | ChildDeletion | ContentReset | Visibility)) !==
3095
NoFlags
3096
) {
3097
+ const wasMutated = (finishedWork.flags & Update) !== NoFlags;
3098
+
3099
const prevContextChanged = viewTransitionContextChanged;
3100
const prevCancelableChildren = viewTransitionCancelableChildren;
3101
viewTransitionContextChanged = false;
3124
);
3125
viewTransitionCancelableChildren = prevCancelableChildren;
3126
}
3127
+ // TODO: If this doesn't end up canceled, because a parent animates,
3128
+ // then we should probably issue an event since this instance is part of it.
3129
} else {
3130
+ const props: ViewTransitionProps = finishedWork.memoizedProps;
3131
+ scheduleViewTransitionEvent(
3132
+ finishedWork,
3133
+ wasMutated || viewTransitionContextChanged
3134
+ ? props.onUpdate
3135
+ : props.onLayout,
3136
+ );
3137
+
3138
// If this boundary did update, we cannot cancel its children so those are dropped.
3139
viewTransitionCancelableChildren = prevCancelableChildren;
3140
}