Skip to content

Commit a282d35

Browse files
committed
Fix phase shift once we've reached a host component we're no longer in the exit/unhide phase
1 parent a6e6d07 commit a282d35

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/react-reconciler/src/ReactFiberApplyGesture.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,32 +299,32 @@ function recursivelyInsertClonesFromExistingTree(
299299
switch (child.tag) {
300300
case HostComponent: {
301301
const instance: Instance = child.stateNode;
302-
let keepTraversing: boolean;
302+
let nextPhase: VisitPhase;
303303
switch (visitPhase) {
304-
case CLONE_UPDATE:
305-
case CLONE_UNCHANGED:
306-
// We've found any "layout" View Transitions at this point so we can bail.
307-
keepTraversing = false;
308-
break;
309304
case CLONE_EXIT:
310305
case CLONE_UNHIDE:
311306
case CLONE_APPEARING_PAIR:
312307
// If this was an unhide, we need to keep going if there are any named
313308
// pairs in this subtree, since they might need to be marked.
314-
keepTraversing =
315-
(child.subtreeFlags & ViewTransitionNamedStatic) !== NoFlags;
309+
nextPhase =
310+
(child.subtreeFlags & ViewTransitionNamedStatic) !== NoFlags
311+
? CLONE_APPEARING_PAIR
312+
: CLONE_UNCHANGED;
316313
break;
314+
default:
315+
// We've found any "layout" View Transitions at this point so we can bail.
316+
nextPhase = CLONE_UNCHANGED;
317317
}
318318
let clone: Instance;
319-
if (keepTraversing) {
319+
if (nextPhase !== CLONE_UNCHANGED) {
320320
// We might need a handle on these clones, so we need to do a shallow clone
321321
// and keep going.
322322
clone = cloneMutableInstance(instance, false);
323323
recursivelyInsertClonesFromExistingTree(
324324
child,
325325
clone,
326326
null,
327-
visitPhase,
327+
nextPhase,
328328
);
329329
} else {
330330
// If we have no mutations in this subtree, and we don't need a handle on the

0 commit comments

Comments
 (0)