File tree 3 files changed +30
-0
lines changed 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,30 @@ export type SpringStopFn<T> = T extends object
176
176
: ( keys ?: OneOrMore < string > ) => void
177
177
: ( ) => void
178
178
179
+ /**
180
+ * Pause animating `SpringValue`.
181
+ *
182
+ * The `T` parameter can be a set of animated values (as an object type)
183
+ * or a primitive type for a single animated value.
184
+ */
185
+ export type SpringPauseFn < T > = T extends object
186
+ ? T extends ReadonlyArray < number | string >
187
+ ? ( ) => void
188
+ : ( keys ?: OneOrMore < string > ) => void
189
+ : ( ) => void
190
+
191
+ /**
192
+ * Resume paused `SpringValue`.
193
+ *
194
+ * The `T` parameter can be a set of animated values (as an object type)
195
+ * or a primitive type for a single animated value.
196
+ */
197
+ export type SpringResumeFn < T > = T extends object
198
+ ? T extends ReadonlyArray < number | string >
199
+ ? ( ) => void
200
+ : ( keys ?: OneOrMore < string > ) => void
201
+ : ( ) => void
202
+
179
203
/**
180
204
* Update the props of each spring, individually or all at once.
181
205
*
@@ -202,6 +226,8 @@ export interface SpringHandle<T extends Indexable = any> {
202
226
update : SpringsUpdateFn < T >
203
227
start : ( ) => AsyncResult < T [ ] >
204
228
stop : SpringStopFn < T >
229
+ pause : SpringPauseFn < T >
230
+ resume : SpringResumeFn < T >
205
231
}
206
232
207
233
export type SpringConfig = Partial < Omit < AnimationConfig , 'w0' > >
Original file line number Diff line number Diff line change @@ -131,6 +131,8 @@ export function useSprings(
131
131
}
132
132
} ,
133
133
stop : keys => each ( ctrls , ctrl => ctrl . stop ( keys ) ) ,
134
+ pause : keys => each ( ctrls , ctrl => ctrl . pause ( keys ) ) ,
135
+ resume : keys => each ( ctrls , ctrl => ctrl . resume ( keys ) ) ,
134
136
} ) ,
135
137
[ ]
136
138
)
Original file line number Diff line number Diff line change @@ -312,6 +312,8 @@ export function useTransition(
312
312
}
313
313
} ,
314
314
stop : keys => each ( usedTransitions . current ! , t => t . ctrl . stop ( keys ) ) ,
315
+ pause : keys => each ( usedTransitions . current ! , t => t . ctrl . pause ( keys ) ) ,
316
+ resume : keys => each ( usedTransitions . current ! , t => t . ctrl . resume ( keys ) ) ,
315
317
} ) ,
316
318
[ ]
317
319
)
You can’t perform that action at this time.
0 commit comments