Skip to content

Commit 1ee1ae2

Browse files
davidgolikmagiera
authored andcommitted
Update typescript definitions (#148)
* add typescript definitions for FlingGestureHandler * add Directions * use correct event types
1 parent 2a4703a commit 1ee1ae2

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

react-native-gesture-handler.d.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ import {
2121

2222
/* GESTURE HANDLER STATE */
2323

24+
export enum Directions {
25+
RIGHT = 1,
26+
LEFT = 2,
27+
UP = 4,
28+
DOWN = 8,
29+
}
30+
2431
export enum State {
2532
UNDETERMINED = 0,
2633
FAILED,
@@ -147,6 +154,16 @@ export interface RotationGestureHandlerGestureEvent
147154
RotationGestureHandlerEventExtra;
148155
}
149156

157+
export interface FlingGestureHandlerStateChangeEvent
158+
extends GestureHandlerStateChangeEvent {
159+
nativeEvent: GestureHandlerStateChangeNativeEvent;
160+
}
161+
162+
export interface FlingGestureHandlerGestureEvent
163+
extends GestureHandlerGestureEvent {
164+
nativeEvent: GestureHandlerGestureEventNativeEvent;
165+
}
166+
150167
/* GESTURE HANDLERS PROPERTIES */
151168

152169
export interface GestureHandlerProperties {
@@ -225,6 +242,14 @@ export interface RotationGestureHandlerProperties
225242
) => void;
226243
}
227244

245+
export interface FlingGestureHandlerProperties
246+
extends GestureHandlerProperties {
247+
direction?: number;
248+
numberOfPointers?: number;
249+
onGestureEvent?: (event: FlingGestureHandlerGestureEvent) => void;
250+
onHandlerStateChange?: (event: FlingGestureHandlerStateChangeEvent) => void;
251+
}
252+
228253
/* GESTURE HANDLERS CLASSES */
229254

230255
export class NativeViewGestureHandler extends React.Component<
@@ -251,6 +276,10 @@ export class RotationGestureHandler extends React.Component<
251276
RotationGestureHandlerProperties
252277
> {}
253278

279+
export class FlingGestureHandler extends React.Component<
280+
FlingGestureHandlerProperties
281+
> {}
282+
254283
/* BUTTONS PROPERTIES */
255284

256285
export interface RawButtonProperties
@@ -263,7 +292,7 @@ export interface BaseButtonProperties extends RawButtonProperties {
263292
}
264293

265294
export interface RectButtonProperties extends BaseButtonProperties {
266-
underlayColor?: string
295+
underlayColor?: string;
267296
}
268297

269298
export interface BorderlessButtonProperties extends RawButtonProperties {

0 commit comments

Comments
 (0)