@@ -58,8 +58,7 @@ import {
58
58
ViewTransitionComponent ,
59
59
} from './ReactWorkTags' ;
60
60
import {
61
- restoreEnterViewTransitions ,
62
- restoreExitViewTransitions ,
61
+ restoreEnterOrExitViewTransitions ,
63
62
restoreNestedViewTransitions ,
64
63
} from './ReactFiberCommitViewTransitions' ;
65
64
@@ -70,11 +69,11 @@ function detectMutationOrInsertClones(finishedWork: Fiber): boolean {
70
69
}
71
70
72
71
const CLONE_UPDATE = 0 ; // Mutations in this subtree or potentially affected by layout.
73
- const CLONE_ENTER = 1 ; // Inside a reappearing offscreen before the next ViewTransition or HostComponent.
72
+ const CLONE_EXIT = 1 ; // Inside a reappearing offscreen before the next ViewTransition or HostComponent.
74
73
const CLONE_UNHIDE = 2 ; // Inside a reappearing offscreen before the next HostComponent.
75
74
const CLONE_APPEARING_PAIR = 3 ; // Like UNHIDE but we're already inside the first Host Component only finding pairs.
76
75
const CLONE_UNCHANGED = 4 ; // Nothing in this tree was changed but we're still walking to clone it.
77
- const INSERT_ENTER = 5 ; // Inside a newly mounted tree before the next ViewTransition or HostComponent.
76
+ const INSERT_EXIT = 5 ; // Inside a newly mounted tree before the next ViewTransition or HostComponent.
78
77
const INSERT_APPEND = 6 ; // Inside a newly mounted tree before the next HostComponent.
79
78
const INSERT_APPEARING_PAIR = 7 ; // Inside a newly mounted tree only finding pairs.
80
79
type VisitPhase = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 ;
@@ -105,7 +104,7 @@ function trackDeletedPairViewTransitions(deletion: Fiber): void {
105
104
}
106
105
}
107
106
108
- function trackExitViewTransitions ( deletion : Fiber ) : void {
107
+ function trackEnterViewTransitions ( deletion : Fiber ) : void {
109
108
if ( deletion . tag === ViewTransitionComponent ) {
110
109
const props : ViewTransitionProps = deletion . memoizedProps ;
111
110
const name = props . name ;
@@ -117,7 +116,7 @@ function trackExitViewTransitions(deletion: Fiber): void {
117
116
} else if ( ( deletion . subtreeFlags & ViewTransitionStatic ) !== NoFlags ) {
118
117
let child = deletion . child ;
119
118
while ( child !== null ) {
120
- trackExitViewTransitions ( child ) ;
119
+ trackEnterViewTransitions ( child ) ;
121
120
child = child . sibling ;
122
121
}
123
122
} else {
@@ -261,7 +260,7 @@ function recursivelyInsertNewFiber(
261
260
// TODO: If this was already cloned by a previous pass we can reuse those clones.
262
261
viewTransitionState . clones = null ;
263
262
let nextPhase ;
264
- if ( visitPhase === INSERT_ENTER ) {
263
+ if ( visitPhase === INSERT_EXIT ) {
265
264
// This was an Enter of a ViewTransition. We now move onto inserting the inner
266
265
// HostComponents and finding inner pairs.
267
266
nextPhase = INSERT_APPEND ;
@@ -307,7 +306,7 @@ function recursivelyInsertClonesFromExistingTree(
307
306
// We've found any "layout" View Transitions at this point so we can bail.
308
307
keepTraversing = false ;
309
308
break ;
310
- case CLONE_ENTER :
309
+ case CLONE_EXIT :
311
310
case CLONE_UNHIDE :
312
311
case CLONE_APPEARING_PAIR :
313
312
// If this was an unhide, we need to keep going if there are any named
@@ -345,7 +344,7 @@ function recursivelyInsertClonesFromExistingTree(
345
344
parentViewTransition . clones . push ( clone ) ;
346
345
}
347
346
}
348
- if ( visitPhase === CLONE_ENTER || visitPhase === CLONE_UNHIDE ) {
347
+ if ( visitPhase === CLONE_EXIT || visitPhase === CLONE_UNHIDE ) {
349
348
unhideInstance ( clone , child . memoizedProps ) ;
350
349
}
351
350
break ;
@@ -360,7 +359,7 @@ function recursivelyInsertClonesFromExistingTree(
360
359
}
361
360
const clone = cloneMutableTextInstance ( textInstance ) ;
362
361
appendChild ( hostParentClone , clone ) ;
363
- if ( visitPhase === CLONE_ENTER || visitPhase === CLONE_UNHIDE ) {
362
+ if ( visitPhase === CLONE_EXIT || visitPhase === CLONE_UNHIDE ) {
364
363
unhideTextInstance ( clone , child . memoizedProps ) ;
365
364
}
366
365
break ;
@@ -393,7 +392,7 @@ function recursivelyInsertClonesFromExistingTree(
393
392
// TODO: If this was already cloned by a previous pass we can reuse those clones.
394
393
viewTransitionState . clones = null ;
395
394
let nextPhase ;
396
- if ( visitPhase === CLONE_ENTER ) {
395
+ if ( visitPhase === CLONE_EXIT ) {
397
396
// This was an Enter of a ViewTransition. We now move onto unhiding the inner
398
397
// HostComponents and finding inner pairs.
399
398
nextPhase = CLONE_UNHIDE ;
@@ -440,7 +439,7 @@ function recursivelyInsertClones(
440
439
if ( deletions !== null ) {
441
440
for ( let i = 0 ; i < deletions . length ; i ++ ) {
442
441
const childToDelete = deletions [ i ] ;
443
- trackExitViewTransitions ( childToDelete ) ;
442
+ trackEnterViewTransitions ( childToDelete ) ;
444
443
}
445
444
}
446
445
@@ -485,7 +484,7 @@ function insertDestinationClonesOfFiber(
485
484
finishedWork ,
486
485
hostParentClone ,
487
486
parentViewTransition ,
488
- INSERT_ENTER ,
487
+ INSERT_EXIT ,
489
488
) ;
490
489
return ;
491
490
}
@@ -578,7 +577,7 @@ function insertDestinationClonesOfFiber(
578
577
commitUpdate ( clone , type , oldProps , newProps , finishedWork ) ;
579
578
}
580
579
581
- if ( visitPhase === CLONE_ENTER || visitPhase === CLONE_UNHIDE ) {
580
+ if ( visitPhase === CLONE_EXIT || visitPhase === CLONE_UNHIDE ) {
582
581
recursivelyInsertClones (
583
582
finishedWork ,
584
583
clone ,
@@ -615,7 +614,7 @@ function insertDestinationClonesOfFiber(
615
614
commitTextUpdate ( clone , newText , oldText ) ;
616
615
}
617
616
appendChild ( hostParentClone , clone ) ;
618
- if ( visitPhase === CLONE_ENTER || visitPhase === CLONE_UNHIDE ) {
617
+ if ( visitPhase === CLONE_EXIT || visitPhase === CLONE_UNHIDE ) {
619
618
unhideTextInstance ( clone , finishedWork . memoizedProps ) ;
620
619
}
621
620
break ;
@@ -634,7 +633,7 @@ function insertDestinationClonesOfFiber(
634
633
let nextPhase ;
635
634
if ( visitPhase === CLONE_UPDATE && ( flags & Visibility ) !== NoFlags ) {
636
635
// This is the root of an appear. We need to trigger Enter transitions.
637
- nextPhase = CLONE_ENTER ;
636
+ nextPhase = CLONE_EXIT ;
638
637
} else {
639
638
nextPhase = visitPhase ;
640
639
}
@@ -646,7 +645,7 @@ function insertDestinationClonesOfFiber(
646
645
) ;
647
646
} else if ( current !== null && current . memoizedState === null ) {
648
647
// Was previously mounted as visible but is now hidden.
649
- trackExitViewTransitions ( current ) ;
648
+ trackEnterViewTransitions ( current ) ;
650
649
}
651
650
break ;
652
651
}
@@ -656,7 +655,7 @@ function insertDestinationClonesOfFiber(
656
655
// TODO: If this was already cloned by a previous pass we can reuse those clones.
657
656
viewTransitionState . clones = null ;
658
657
let nextPhase ;
659
- if ( visitPhase === CLONE_ENTER ) {
658
+ if ( visitPhase === CLONE_EXIT ) {
660
659
// This was an Enter of a ViewTransition. We now move onto unhiding the inner
661
660
// HostComponents and finding inner pairs.
662
661
nextPhase = CLONE_UNHIDE ;
@@ -746,7 +745,7 @@ function applyDeletedPairViewTransitions(deletion: Fiber): void {
746
745
}
747
746
}
748
747
749
- function applyExitViewTransitions ( deletion : Fiber ) : void {
748
+ function applyEnterViewTransitions ( deletion : Fiber ) : void {
750
749
if ( deletion . tag === ViewTransitionComponent ) {
751
750
const props : ViewTransitionProps = deletion . memoizedProps ;
752
751
const name = props . name ;
@@ -759,7 +758,7 @@ function applyExitViewTransitions(deletion: Fiber): void {
759
758
// TODO: Check if this is a hidden Offscreen or a Portal.
760
759
let child = deletion . child ;
761
760
while ( child !== null ) {
762
- applyExitViewTransitions ( child ) ;
761
+ applyEnterViewTransitions ( child ) ;
763
762
child = child . sibling ;
764
763
}
765
764
} else {
@@ -811,7 +810,7 @@ function recursivelyApplyViewTransitions(parentFiber: Fiber) {
811
810
if ( deletions !== null ) {
812
811
for ( let i = 0 ; i < deletions . length ; i ++ ) {
813
812
const childToDelete = deletions [ i ] ;
814
- applyExitViewTransitions ( childToDelete ) ;
813
+ applyEnterViewTransitions ( childToDelete ) ;
815
814
}
816
815
}
817
816
@@ -866,7 +865,7 @@ function applyViewTransitionsOnFiber(finishedWork: Fiber) {
866
865
measureEnterViewTransitions ( finishedWork ) ;
867
866
} else if ( current !== null && current . memoizedState === null ) {
868
867
// Was previously mounted as visible but is now hidden.
869
- applyExitViewTransitions ( current ) ;
868
+ applyEnterViewTransitions ( current ) ;
870
869
}
871
870
}
872
871
break ;
@@ -903,7 +902,7 @@ function recursivelyRestoreViewTransitions(parentFiber: Fiber) {
903
902
if ( deletions !== null ) {
904
903
for ( let i = 0 ; i < deletions . length ; i ++ ) {
905
904
const childToDelete = deletions [ i ] ;
906
- restoreExitViewTransitions ( childToDelete ) ;
905
+ restoreEnterOrExitViewTransitions ( childToDelete ) ;
907
906
}
908
907
}
909
908
@@ -928,7 +927,7 @@ function recursivelyRestoreViewTransitions(parentFiber: Fiber) {
928
927
function restoreViewTransitionsOnFiber ( finishedWork : Fiber ) {
929
928
const current = finishedWork . alternate ;
930
929
if ( current === null ) {
931
- restoreEnterViewTransitions ( finishedWork ) ;
930
+ restoreEnterOrExitViewTransitions ( finishedWork ) ;
932
931
return ;
933
932
}
934
933
@@ -955,10 +954,10 @@ function restoreViewTransitionsOnFiber(finishedWork: Fiber) {
955
954
const newState : OffscreenState | null = finishedWork . memoizedState ;
956
955
const isHidden = newState !== null ;
957
956
if ( ! isHidden ) {
958
- restoreEnterViewTransitions ( finishedWork ) ;
957
+ restoreEnterOrExitViewTransitions ( finishedWork ) ;
959
958
} else if ( current !== null && current . memoizedState === null ) {
960
959
// Was previously mounted as visible but is now hidden.
961
- restoreExitViewTransitions ( current ) ;
960
+ restoreEnterOrExitViewTransitions ( current ) ;
962
961
}
963
962
}
964
963
break ;
0 commit comments