Skip to content

Commit 851d21f

Browse files
committed
Connect pairs on both sides so we can get to the other pair from either state
This doesn't matter for CommitViewTransitions since we only read on one side but it matters for ApplyGesture when we read on the reverse end.
1 parent 6348e23 commit 851d21f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/react-reconciler/src/ReactFiberApplyGesture.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function trackDeletedPairViewTransitions(deletion: Fiber): void {
152152
// The "new" instance is the already mounted one we're deleting.
153153
const newInstance: ViewTransitionState = child.stateNode;
154154
oldInstance.paired = newInstance;
155+
newInstance.paired = oldInstance;
155156
const clones = oldInstance.clones;
156157
if (clones !== null) {
157158
// If we have clones that means that we've already visited this
@@ -201,6 +202,7 @@ function trackEnterViewTransitions(deletion: Fiber): void {
201202
// The "new" instance is the already mounted one we're deleting.
202203
const newInstance: ViewTransitionState = deletion.stateNode;
203204
oldInstance.paired = newInstance;
205+
newInstance.paired = oldInstance;
204206
const clones = oldInstance.clones;
205207
if (clones !== null) {
206208
// If we have clones that means that we've already visited this

packages/react-reconciler/src/ReactFiberCommitViewTransitions.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,10 @@ function commitDeletedPairViewTransitions(deletion: Fiber): void {
348348
restoreViewTransitionOnHostInstances(child.child, false);
349349
} else {
350350
// We'll transition between them.
351-
const oldinstance: ViewTransitionState = child.stateNode;
351+
const oldInstance: ViewTransitionState = child.stateNode;
352352
const newInstance: ViewTransitionState = pair;
353-
newInstance.paired = oldinstance;
353+
newInstance.paired = oldInstance;
354+
oldInstance.paired = newInstance;
354355
// Note: If the other side ends up outside the viewport, we'll still run this.
355356
// Therefore it's possible for onShare to be called with only an old snapshot.
356357
scheduleViewTransitionEvent(child, props.onShare);
@@ -399,9 +400,10 @@ export function commitExitViewTransitions(deletion: Fiber): void {
399400
} else if (pair !== undefined) {
400401
// We found a new appearing view transition with the same name as this deletion.
401402
// We'll transition between them instead of running the normal exit.
402-
const oldinstance: ViewTransitionState = deletion.stateNode;
403+
const oldInstance: ViewTransitionState = deletion.stateNode;
403404
const newInstance: ViewTransitionState = pair;
404-
newInstance.paired = oldinstance;
405+
newInstance.paired = oldInstance;
406+
oldInstance.paired = newInstance;
405407
// Delete the entry so that we know when we've found all of them
406408
// and can stop searching (size reaches zero).
407409
// $FlowFixMe[incompatible-use]: Refined by the pair.

0 commit comments

Comments
 (0)