You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
I thought that adding TypeDocs might be a good idea and it could enhance
developer experience (I've come up with this idea when I discovered that
we have `withRef` modifier). This PR adds TypeDocs to new API (but we
can also think of filling missing docs in old API)
## Test plan
Hover functions/components and read docs.
* `GestureDetector` is responsible for creating and updating native gesture handlers based on the config of provided gesture.
670
+
*
671
+
* ### Props
672
+
* - `gesture`
673
+
* - `userSelect` (**Web only**)
674
+
* - `enableContextMenu` (**Web only**)
675
+
* - `touchAction` (**Web only**)
676
+
*
677
+
* ### Remarks
678
+
* - Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically collapsed.
679
+
* - Using the same instance of a gesture across multiple Gesture Detectors is not possible.
* Set the callback that is being called when the gesture that was recognized by the handler finishes and handler reaches `END` state.
196
+
* It will be called only if the handler was previously in the `ACTIVE` state.
197
+
* @param callback
198
+
*/
181
199
onEnd(
182
200
callback: (
183
201
event: GestureStateChangeEvent<EventPayloadT>,
@@ -190,6 +208,10 @@ export abstract class BaseGesture<
190
208
returnthis;
191
209
}
192
210
211
+
/**
212
+
* Set the callback that is being called when the handler finalizes handling gesture - the gesture was recognized and has finished or it failed to recognize.
213
+
* @param callback
214
+
*/
193
215
onFinalize(
194
216
callback: (
195
217
event: GestureStateChangeEvent<EventPayloadT>,
@@ -202,6 +224,10 @@ export abstract class BaseGesture<
202
224
returnthis;
203
225
}
204
226
227
+
/**
228
+
* Set the `onTouchesDown` callback which is called every time a pointer is placed on the screen.
229
+
* @param callback
230
+
*/
205
231
onTouchesDown(callback: TouchEventHandlerType){
206
232
this.config.needsPointerData=true;
207
233
this.handlers.onTouchesDown=callback;
@@ -211,6 +237,10 @@ export abstract class BaseGesture<
211
237
returnthis;
212
238
}
213
239
240
+
/**
241
+
* Set the `onTouchesMove` callback which is called every time a pointer is moved on the screen.
242
+
* @param callback
243
+
*/
214
244
onTouchesMove(callback: TouchEventHandlerType){
215
245
this.config.needsPointerData=true;
216
246
this.handlers.onTouchesMove=callback;
@@ -220,6 +250,10 @@ export abstract class BaseGesture<
220
250
returnthis;
221
251
}
222
252
253
+
/**
254
+
* Set the `onTouchesUp` callback which is called every time a pointer is lifted from the screen.
255
+
* @param callback
256
+
*/
223
257
onTouchesUp(callback: TouchEventHandlerType){
224
258
this.config.needsPointerData=true;
225
259
this.handlers.onTouchesUp=callback;
@@ -229,6 +263,10 @@ export abstract class BaseGesture<
229
263
returnthis;
230
264
}
231
265
266
+
/**
267
+
* Set the `onTouchesCancelled` callback which is called every time a pointer stops being tracked, for example when the gesture finishes.
* When `react-native-reanimated` is installed, the callbacks passed to the gestures are automatically workletized and run on the UI thread when called.
336
+
* This option allows for changing this behavior: when `true`, all the callbacks will be run on the JS thread instead of the UI thread, regardless of whether they are worklets or not.
337
+
* Defaults to `false`.
338
+
* @param runOnJS
339
+
*/
266
340
runOnJS(runOnJS: boolean){
267
341
this.config.runOnJS=runOnJS;
268
342
returnthis;
269
343
}
270
344
345
+
/**
346
+
* Allows gestures across different components to be recognized simultaneously.
* Works similarily to `requireExternalGestureToFail` but the direction of the relation is reversed - instead of being one-to-many relation, it's many-to-one.
0 commit comments