forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RNGestureHandlerModule.web.js
49 lines (47 loc) · 1.74 KB
/
RNGestureHandlerModule.web.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Direction } from './web/constants';
import FlingGestureHandler from './web/FlingGestureHandler';
import LongPressGestureHandler from './web/LongPressGestureHandler';
import NativeViewGestureHandler from './web/NativeViewGestureHandler';
import * as NodeManager from './web/NodeManager';
import PanGestureHandler from './web/PanGestureHandler';
import PinchGestureHandler from './web/PinchGestureHandler';
import RotationGestureHandler from './web/RotationGestureHandler';
import TapGestureHandler from './web/TapGestureHandler';
const Gestures = {
PanGestureHandler,
RotationGestureHandler,
PinchGestureHandler,
TapGestureHandler,
NativeViewGestureHandler,
LongPressGestureHandler,
FlingGestureHandler,
// ForceTouchGestureHandler,
};
export default {
Direction,
handleSetJSResponder(tag, blockNativeResponder) {
console.warn('handleSetJSResponder: ', tag, blockNativeResponder);
},
handleClearJSResponder() {
console.warn('handleClearJSResponder: ');
},
createGestureHandler(handlerName, handlerTag, config) {
if (!(handlerName in Gestures))
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
const GestureClass = Gestures[handlerName];
NodeManager.createGestureHandler(handlerTag, new GestureClass());
this.updateGestureHandler(handlerTag, config);
},
attachGestureHandler(handlerTag, newView) {
NodeManager.getHandler(handlerTag).setView(newView);
},
updateGestureHandler(handlerTag, newConfig) {
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
},
getGestureHandlerNode(handlerTag) {
return NodeManager.getHandler(handlerTag);
},
dropGestureHandler(handlerTag) {
NodeManager.dropGestureHandler(handlerTag);
},
};