@@ -62,6 +62,8 @@ import {
62
62
restoreEnterOrExitViewTransitions ,
63
63
restoreNestedViewTransitions ,
64
64
appearingViewTransitions ,
65
+ commitEnterViewTransitions ,
66
+ measureNestedViewTransitions ,
65
67
} from './ReactFiberCommitViewTransitions' ;
66
68
import {
67
69
getViewTransitionName ,
@@ -968,53 +970,6 @@ export function insertDestinationClones(
968
970
}
969
971
}
970
972
971
- function applyDeletedPairViewTransitions ( deletion : Fiber ) : void {
972
- if ( ( deletion . subtreeFlags & ViewTransitionNamedStatic ) === NoFlags ) {
973
- // This has no named view transitions in its subtree.
974
- return ;
975
- }
976
- let child = deletion . child ;
977
- while ( child !== null ) {
978
- if ( child . tag === OffscreenComponent && child . memoizedState === null ) {
979
- // This tree was already hidden so we skip it.
980
- } else {
981
- if (
982
- child . tag === ViewTransitionComponent &&
983
- ( child . flags & ViewTransitionNamedStatic ) !== NoFlags
984
- ) {
985
- const props : ViewTransitionProps = child . memoizedProps ;
986
- const name = props . name ;
987
- if ( name != null && name !== 'auto' ) {
988
- // TODO: Find a pair
989
- }
990
- }
991
- applyDeletedPairViewTransitions ( child ) ;
992
- }
993
- child = child . sibling ;
994
- }
995
- }
996
-
997
- function applyEnterViewTransitions ( deletion : Fiber ) : void {
998
- if ( deletion . tag === ViewTransitionComponent ) {
999
- const props : ViewTransitionProps = deletion . memoizedProps ;
1000
- const name = props . name ;
1001
- if ( name != null && name !== 'auto' ) {
1002
- // TODO: Find a pair
1003
- }
1004
- // Look for more pairs deeper in the tree.
1005
- applyDeletedPairViewTransitions ( deletion ) ;
1006
- } else if ( ( deletion . subtreeFlags & ViewTransitionStatic ) !== NoFlags ) {
1007
- // TODO: Check if this is a hidden Offscreen or a Portal.
1008
- let child = deletion . child ;
1009
- while ( child !== null ) {
1010
- applyEnterViewTransitions ( child ) ;
1011
- child = child . sibling ;
1012
- }
1013
- } else {
1014
- applyDeletedPairViewTransitions ( deletion ) ;
1015
- }
1016
- }
1017
-
1018
973
function measureExitViewTransitions ( placement : Fiber ) : void {
1019
974
if ( placement . tag === ViewTransitionComponent ) {
1020
975
// const state: ViewTransitionState = placement.stateNode;
@@ -1036,24 +991,6 @@ function measureExitViewTransitions(placement: Fiber): void {
1036
991
}
1037
992
}
1038
993
1039
- function measureNestedViewTransitions ( changedParent : Fiber ) : void {
1040
- let child = changedParent . child ;
1041
- while ( child !== null ) {
1042
- if ( child . tag === ViewTransitionComponent ) {
1043
- const current = child . alternate ;
1044
- if ( current !== null ) {
1045
- // const props: ViewTransitionProps = child.memoizedProps;
1046
- // const name = getViewTransitionName(props, child.stateNode);
1047
- // TODO: Measure both the old and new state and see if they're different.
1048
- }
1049
- } else if ( ( child . subtreeFlags & ViewTransitionStatic ) !== NoFlags ) {
1050
- // TODO: Check if this is a hidden Offscreen or a Portal.
1051
- measureNestedViewTransitions ( child ) ;
1052
- }
1053
- child = child . sibling ;
1054
- }
1055
- }
1056
-
1057
994
function measureUpdateViewTransition (
1058
995
current : Fiber ,
1059
996
finishedWork : Fiber ,
@@ -1066,7 +1003,7 @@ function recursivelyApplyViewTransitions(parentFiber: Fiber) {
1066
1003
if ( deletions !== null ) {
1067
1004
for ( let i = 0 ; i < deletions . length ; i ++ ) {
1068
1005
const childToDelete = deletions [ i ] ;
1069
- applyEnterViewTransitions ( childToDelete ) ;
1006
+ commitEnterViewTransitions ( childToDelete , true ) ;
1070
1007
}
1071
1008
}
1072
1009
@@ -1084,7 +1021,7 @@ function recursivelyApplyViewTransitions(parentFiber: Fiber) {
1084
1021
// Nothing has changed in this subtree, but the parent may have still affected
1085
1022
// its size and position. We need to measure the old and new state to see if
1086
1023
// we should animate its size and position.
1087
- measureNestedViewTransitions ( parentFiber ) ;
1024
+ measureNestedViewTransitions ( parentFiber , true ) ;
1088
1025
}
1089
1026
}
1090
1027
@@ -1121,7 +1058,7 @@ function applyViewTransitionsOnFiber(finishedWork: Fiber) {
1121
1058
measureExitViewTransitions ( finishedWork ) ;
1122
1059
} else if ( current !== null && current . memoizedState === null ) {
1123
1060
// Was previously mounted as visible but is now hidden.
1124
- applyEnterViewTransitions ( current ) ;
1061
+ commitEnterViewTransitions ( current , true ) ;
1125
1062
}
1126
1063
}
1127
1064
break ;
0 commit comments