Skip to content

Commit 020b3a1

Browse files
committed
Extarct CALLBACK_TYPE
1 parent 35a0aea commit 020b3a1

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export const CALLBACK_TYPE = {
2+
UNDEFINED: 0,
3+
BEGAN: 1,
4+
START: 2,
5+
UPDATE: 3,
6+
CHANGE: 4,
7+
END: 5,
8+
FINALIZE: 6,
9+
TOUCHES_DOWN: 7,
10+
TOUCHES_MOVE: 8,
11+
TOUCHES_UP: 9,
12+
TOUCHES_CANCEL: 10,
13+
} as const;
14+
15+
// Allow using CALLBACK_TYPE as object and type
16+
// eslint-disable-next-line @typescript-eslint/no-redeclare
17+
export type CALLBACK_TYPE = (typeof CALLBACK_TYPE)[keyof typeof CALLBACK_TYPE];

packages/react-native-gesture-handler/src/handlers/gestures/GestureDetector/useAnimatedGesture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CALLBACK_TYPE } from '../../../CallbackType';
12
import { State } from '../../../State';
23
import { TouchEventType } from '../../../TouchEventType';
34
import { tagMessage } from '../../../utils';
@@ -7,7 +8,6 @@ import type {
78
GestureUpdateEvent,
89
} from '../../gestureHandlerCommon';
910
import type { HandlerCallbacks } from '../gesture';
10-
import { CALLBACK_TYPE } from '../gesture';
1111
import type { GestureStateManagerType } from '../gestureStateManager';
1212
import { GestureStateManager } from '../gestureStateManager';
1313
import { Reanimated } from '../reanimatedWrapper';

packages/react-native-gesture-handler/src/handlers/gestures/gesture.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CALLBACK_TYPE } from '../../CallbackType';
12
import { isRemoteDebuggingEnabled } from '../../utils';
23
import type {
34
ActiveCursor,
@@ -91,24 +92,6 @@ export type HandlerCallbacks<EventPayloadT extends Record<string, unknown>> = {
9192
isWorklet: boolean[];
9293
};
9394

94-
export const CALLBACK_TYPE = {
95-
UNDEFINED: 0,
96-
BEGAN: 1,
97-
START: 2,
98-
UPDATE: 3,
99-
CHANGE: 4,
100-
END: 5,
101-
FINALIZE: 6,
102-
TOUCHES_DOWN: 7,
103-
TOUCHES_MOVE: 8,
104-
TOUCHES_UP: 9,
105-
TOUCHES_CANCEL: 10,
106-
} as const;
107-
108-
// Allow using CALLBACK_TYPE as object and type
109-
// eslint-disable-next-line @typescript-eslint/no-redeclare
110-
export type CALLBACK_TYPE = (typeof CALLBACK_TYPE)[keyof typeof CALLBACK_TYPE];
111-
11295
export abstract class Gesture {
11396
/**
11497
* Return array of gestures, providing the same interface for creating and updating

packages/react-native-gesture-handler/src/v3/hooks/callbacks/eventHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { CALLBACK_TYPE } from '../../../CallbackType';
12
import type { GestureTouchEvent } from '../../../handlers/gestureHandlerCommon';
2-
import { CALLBACK_TYPE } from '../../../handlers/gestures/gesture';
33
import type { ReanimatedContext } from '../../../handlers/gestures/reanimatedWrapper';
44
import { State } from '../../../State';
55
import { TouchEventType } from '../../../TouchEventType';

packages/react-native-gesture-handler/src/v3/hooks/utils/eventHandlersUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useMemo } from 'react';
22

3-
import { CALLBACK_TYPE } from '../../../handlers/gestures/gesture';
3+
import { CALLBACK_TYPE } from '../../../CallbackType';
44
import { TouchEventType } from '../../../TouchEventType';
55
import type {
66
GestureCallbacks,

0 commit comments

Comments
 (0)