Skip to content

Commit 13f9c5a

Browse files
committed
Rename useSwipeTransition() to startGestureTransition() in error messages
1 parent fa784ea commit 13f9c5a

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

packages/react-art/src/ReactFiberConfigART.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ export function createViewTransitionInstance(
560560
export type GestureTimeline = null;
561561

562562
export function getCurrentGestureOffset(provider: GestureTimeline): number {
563-
throw new Error('useSwipeTransition is not yet supported in react-art.');
563+
throw new Error('startGestureTransition is not yet supported in react-art.');
564564
}
565565

566566
export function clearContainer(container) {

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,9 @@ export function cloneRootViewTransitionContainer(
13581358

13591359
const containerParent = containerInstance.parentNode;
13601360
if (containerParent === null) {
1361-
throw new Error('Cannot use a useSwipeTransition() in a detached root.');
1361+
throw new Error(
1362+
'Cannot use a startGestureTransition() on a detached root.',
1363+
);
13621364
}
13631365

13641366
const clone: HTMLElement = containerInstance.cloneNode(false);
@@ -1464,7 +1466,9 @@ export function removeRootViewTransitionClone(
14641466
}
14651467
const containerParent = containerInstance.parentNode;
14661468
if (containerParent === null) {
1467-
throw new Error('Cannot use a useSwipeTransition() in a detached root.');
1469+
throw new Error(
1470+
'Cannot use a startGestureTransition() on a detached root.',
1471+
);
14681472
}
14691473
// We assume that the clone is still within the same parent.
14701474
containerParent.removeChild(clone);

packages/react-native-renderer/src/ReactFiberConfigNative.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,9 @@ export function createViewTransitionInstance(
692692
export type GestureTimeline = null;
693693

694694
export function getCurrentGestureOffset(provider: GestureTimeline): number {
695-
throw new Error('useSwipeTransition is not yet supported in React Native.');
695+
throw new Error(
696+
'startGestureTransition is not yet supported in React Native.',
697+
);
696698
}
697699

698700
export function clearContainer(container: Container): void {

packages/react-reconciler/src/ReactFiberApplyGesture.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ function recursivelyInsertNewFiber(
412412
// had any effect.
413413
if (finishedWork.flags & Update) {
414414
console.error(
415-
'useSwipeTransition() caused something to render a new <%s>. ' +
415+
'startGestureTransition() caused something to render a new <%s>. ' +
416416
'This is not possible in the current implementation. ' +
417417
"Make sure that the swipe doesn't mount any new <%s> elements.",
418418
finishedWork.type,
@@ -789,7 +789,7 @@ function insertDestinationClonesOfFiber(
789789
commitUpdate(instance, type, oldProps, newProps, finishedWork);
790790
if (viewTransitionMutationContext) {
791791
console.error(
792-
'useSwipeTransition() caused something to mutate <%s>. ' +
792+
'startGestureTransition() caused something to mutate <%s>. ' +
793793
'This is not possible in the current implementation. ' +
794794
"Make sure that the swipe doesn't update any state which " +
795795
'causes <%s> to change.',
@@ -977,10 +977,10 @@ export function insertDestinationClones(
977977
if (!didWarnForRootClone) {
978978
didWarnForRootClone = true;
979979
console.warn(
980-
'useSwipeTransition() caused something to mutate or relayout the root. ' +
980+
'startGestureTransition() caused something to mutate or relayout the root. ' +
981981
'This currently requires a clone of the whole document. Make sure to ' +
982982
'add a <ViewTransition> directly around an absolutely positioned DOM node ' +
983-
'to minimize the impact of any changes caused by the Swipe Transition.',
983+
'to minimize the impact of any changes caused by the Gesture Transition.',
984984
);
985985
}
986986
}

packages/react-reconciler/src/ReactFiberGestureScheduler.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ import {
1717
includesTransitionLane,
1818
} from './ReactFiberLane';
1919
import {ensureRootIsScheduled} from './ReactFiberRootScheduler';
20-
import {
21-
getCurrentGestureOffset,
22-
stopViewTransition,
23-
} from './ReactFiberConfig';
20+
import {getCurrentGestureOffset, stopViewTransition} from './ReactFiberConfig';
2421

2522
// This type keeps track of any scheduled or active gestures.
2623
export type ScheduledGesture = {

scripts/error-codes/codes.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@
535535
"547": "startGesture cannot be called during server rendering.",
536536
"548": "Finished rendering the gesture lane but there were no pending gestures. React should not have started a render in this case. This is a bug in React.",
537537
"549": "Cannot start a gesture with a disconnected AnimationTimeline.",
538-
"550": "useSwipeTransition is not yet supported in react-art.",
539-
"551": "useSwipeTransition is not yet supported in React Native.",
540-
"552": "Cannot use a useSwipeTransition() in a detached root.",
538+
"550": "startGestureTransition is not yet supported in react-art.",
539+
"551": "startGestureTransition is not yet supported in React Native.",
540+
"552": "Cannot use a startGestureTransition() on a detached root.",
541541
"553": "A Timeline is required as the first argument to startGestureTransition.",
542542
"554": "Cannot setState on regular state inside a startGestureTransition. Gestures can only update the useOptimistic() hook. There should be no side-effects associated with starting a Gesture until its Action is invoked. Move side-effects to the Action instead.",
543543
"555": "Cannot requestFormReset() inside a startGestureTransition. There should be no side-effects associated with starting a Gesture until its Action is invoked. Move side-effects to the Action instead."

0 commit comments

Comments
 (0)