@@ -17,11 +17,7 @@ import {
17
17
includesTransitionLane ,
18
18
} from './ReactFiberLane' ;
19
19
import { ensureRootIsScheduled } from './ReactFiberRootScheduler' ;
20
- import {
21
- subscribeToGestureDirection ,
22
- getCurrentGestureOffset ,
23
- stopViewTransition ,
24
- } from './ReactFiberConfig' ;
20
+ import { getCurrentGestureOffset , stopViewTransition } from './ReactFiberConfig' ;
25
21
26
22
// This type keeps track of any scheduled or active gestures.
27
23
export type ScheduledGesture = {
@@ -31,85 +27,11 @@ export type ScheduledGesture = {
31
27
rangePrevious : number , // The end along the timeline where the previous state is reached.
32
28
rangeCurrent : number , // The starting offset along the timeline.
33
29
rangeNext : number , // The end along the timeline where the next state is reached.
34
- cancel : ( ) => void , // Cancel the subscription to direction change. // TODO: Delete this.
35
30
running : null | RunningViewTransition , // Used to cancel the running transition after we're done.
36
31
prev : null | ScheduledGesture , // The previous scheduled gesture in the queue for this root.
37
32
next : null | ScheduledGesture , // The next scheduled gesture in the queue for this root.
38
33
} ;
39
34
40
- // TODO: Delete this when deleting useSwipeTransition.
41
- export function scheduleGestureLegacy (
42
- root : FiberRoot ,
43
- provider : GestureTimeline ,
44
- initialDirection : boolean ,
45
- rangePrevious : number ,
46
- rangeCurrent : number ,
47
- rangeNext : number ,
48
- ) : ScheduledGesture {
49
- let prev = root . pendingGestures ;
50
- while ( prev !== null ) {
51
- if ( prev . provider === provider ) {
52
- // Existing instance found.
53
- prev . count ++ ;
54
- return prev ;
55
- }
56
- const next = prev . next ;
57
- if ( next === null ) {
58
- break ;
59
- }
60
- prev = next ;
61
- }
62
- const isFlippedDirection = rangePrevious > rangeNext ;
63
- // Add new instance to the end of the queue.
64
- const cancel = subscribeToGestureDirection (
65
- provider ,
66
- rangeCurrent ,
67
- ( direction : boolean ) => {
68
- if ( isFlippedDirection ) {
69
- direction = ! direction ;
70
- }
71
- if ( gesture . direction !== direction ) {
72
- gesture . direction = direction ;
73
- if ( gesture . prev === null && root . pendingGestures !== gesture ) {
74
- // This gesture is not in the schedule, meaning it was already rendered.
75
- // We need to rerender in the new direction. Insert it into the first slot
76
- // in case other gestures are queued after the on-going one.
77
- const existing = root . pendingGestures ;
78
- gesture . next = existing ;
79
- if ( existing !== null ) {
80
- existing . prev = gesture ;
81
- }
82
- root . pendingGestures = gesture ;
83
- // Schedule the lane on the root. The Fibers will already be marked as
84
- // long as the gesture is active on that Hook.
85
- root . pendingLanes |= GestureLane ;
86
- ensureRootIsScheduled ( root ) ;
87
- }
88
- // TODO: If we're currently rendering this gesture, we need to restart it.
89
- }
90
- } ,
91
- ) ;
92
- const gesture : ScheduledGesture = {
93
- provider : provider ,
94
- count : 1 ,
95
- direction : initialDirection ,
96
- rangePrevious : rangePrevious ,
97
- rangeCurrent : rangeCurrent ,
98
- rangeNext : rangeNext ,
99
- cancel : cancel ,
100
- running : null ,
101
- prev : prev ,
102
- next : null ,
103
- } ;
104
- if ( prev === null ) {
105
- root . pendingGestures = gesture ;
106
- } else {
107
- prev . next = gesture ;
108
- }
109
- ensureRootIsScheduled ( root ) ;
110
- return gesture ;
111
- }
112
-
113
35
export function scheduleGesture (
114
36
root : FiberRoot ,
115
37
provider : GestureTimeline ,
@@ -133,7 +55,6 @@ export function scheduleGesture(
133
55
rangePrevious : - 1 ,
134
56
rangeCurrent : - 1 ,
135
57
rangeNext : - 1 ,
136
- cancel : ( ) => { } , // TODO: Delete this with useSwipeTransition.
137
58
running : null ,
138
59
prev : prev ,
139
60
next : null ,
@@ -210,8 +131,6 @@ export function cancelScheduledGesture(
210
131
) : void {
211
132
gesture . count -- ;
212
133
if ( gesture . count === 0 ) {
213
- const cancelDirectionSubscription = gesture . cancel ;
214
- cancelDirectionSubscription ( ) ;
215
134
// Delete the scheduled gesture from the pending queue.
216
135
deleteScheduledGesture ( root , gesture ) ;
217
136
// TODO: If we're currently rendering this gesture, we need to restart the render
0 commit comments