react-native-gesture-handler 2.14.0 → 2.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/RNGestureHandler.podspec +2 -2
- package/android/paper/src/main/java/com/swmansion/gesturehandler/NativeRNGestureHandlerModuleSpec.java +55 -0
- package/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt +64 -4
- package/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +12 -2
- package/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt +53 -19
- package/{ios → apple}/Handlers/RNFlingHandler.m +25 -5
- package/{ios → apple}/Handlers/RNForceTouchHandler.m +25 -7
- package/{ios → apple}/Handlers/RNHoverHandler.m +26 -1
- package/{ios → apple}/Handlers/RNLongPressHandler.m +24 -4
- package/{ios → apple}/Handlers/RNManualHandler.m +24 -4
- package/{ios → apple}/Handlers/RNNativeViewHandler.mm +42 -6
- package/{ios → apple}/Handlers/RNPanHandler.m +100 -15
- package/apple/Handlers/RNPinchHandler.m +162 -0
- package/{ios → apple}/Handlers/RNRotationHandler.m +71 -9
- package/{ios → apple}/Handlers/RNTapHandler.m +96 -26
- package/apple/RNGHUIKit.h +27 -0
- package/{ios → apple}/RNGestureHandler.h +3 -3
- package/{ios → apple}/RNGestureHandler.m +31 -5
- package/{ios → apple}/RNGestureHandlerButton.h +4 -1
- package/{ios → apple}/RNGestureHandlerButton.m +12 -4
- package/{ios → apple}/RNGestureHandlerButtonManager.m +4 -2
- package/{ios → apple}/RNGestureHandlerEvents.h +1 -1
- package/{ios → apple}/RNGestureHandlerManager.h +2 -2
- package/{ios → apple}/RNGestureHandlerManager.mm +46 -11
- package/apple/RNGestureHandlerModule.h +17 -0
- package/{ios → apple}/RNGestureHandlerModule.mm +46 -60
- package/{ios → apple}/RNGestureHandlerPointerTracker.h +5 -5
- package/{ios → apple}/RNGestureHandlerPointerTracker.m +19 -14
- package/{ios → apple}/RNGestureHandlerRegistry.h +1 -1
- package/{ios → apple}/RNGestureHandlerRegistry.m +1 -1
- package/{ios → apple}/RNManualActivationRecognizer.h +8 -0
- package/{ios → apple}/RNManualActivationRecognizer.m +27 -7
- package/{ios → apple}/RNRootViewGestureRecognizer.m +72 -4
- package/lib/commonjs/RNGestureHandlerModule.js +5 -18
- package/lib/commonjs/RNGestureHandlerModule.js.map +1 -1
- package/lib/commonjs/RNGestureHandlerModule.windows.js +10 -102
- package/lib/commonjs/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/commonjs/components/DrawerLayout.js +2 -0
- package/lib/commonjs/components/DrawerLayout.js.map +1 -1
- package/lib/commonjs/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/commonjs/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js +1 -1
- package/lib/commonjs/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js +11 -1
- package/lib/commonjs/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gesture.js +5 -0
- package/lib/commonjs/handlers/gestures/gesture.js.map +1 -1
- package/lib/commonjs/handlers/gestures/gestureStateManager.js +39 -37
- package/lib/commonjs/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js +13 -0
- package/lib/commonjs/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/commonjs/web/handlers/FlingGestureHandler.js +8 -6
- package/lib/commonjs/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/GestureHandler.js +13 -1
- package/lib/commonjs/web/handlers/GestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js +8 -6
- package/lib/commonjs/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/PanGestureHandler.js +4 -0
- package/lib/commonjs/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/commonjs/web/handlers/TapGestureHandler.js +4 -0
- package/lib/commonjs/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/commonjs/web/interfaces.js +12 -14
- package/lib/commonjs/web/interfaces.js.map +1 -1
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js +35 -0
- package/lib/commonjs/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/commonjs/web/tools/NodeManager.js +3 -2
- package/lib/commonjs/web/tools/NodeManager.js.map +1 -1
- package/lib/commonjs/web/tools/PointerEventManager.js +16 -6
- package/lib/commonjs/web/tools/PointerEventManager.js.map +1 -1
- package/lib/commonjs/web/tools/TouchEventManager.js +0 -1
- package/lib/commonjs/web/tools/TouchEventManager.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.js +4 -18
- package/lib/module/RNGestureHandlerModule.js.map +1 -1
- package/lib/module/RNGestureHandlerModule.windows.js +10 -81
- package/lib/module/RNGestureHandlerModule.windows.js.map +1 -1
- package/lib/module/components/DrawerLayout.js +2 -0
- package/lib/module/components/DrawerLayout.js.map +1 -1
- package/lib/module/components/gestureHandlerRootHOC.js.map +1 -1
- package/lib/module/components/touchables/TouchableWithoutFeedback.js.map +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js +1 -1
- package/lib/module/handlers/gestureHandlerCommon.js.map +1 -1
- package/lib/module/handlers/gestures/GestureDetector.js +11 -1
- package/lib/module/handlers/gestures/GestureDetector.js.map +1 -1
- package/lib/module/handlers/gestures/gesture.js +5 -0
- package/lib/module/handlers/gestures/gesture.js.map +1 -1
- package/lib/module/handlers/gestures/gestureStateManager.js +44 -42
- package/lib/module/handlers/gestures/gestureStateManager.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js +3 -0
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -0
- package/lib/module/web/handlers/FlingGestureHandler.js +8 -6
- package/lib/module/web/handlers/FlingGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/GestureHandler.js +14 -2
- package/lib/module/web/handlers/GestureHandler.js.map +1 -1
- package/lib/module/web/handlers/LongPressGestureHandler.js +8 -5
- package/lib/module/web/handlers/LongPressGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/PanGestureHandler.js +4 -0
- package/lib/module/web/handlers/PanGestureHandler.js.map +1 -1
- package/lib/module/web/handlers/TapGestureHandler.js +4 -0
- package/lib/module/web/handlers/TapGestureHandler.js.map +1 -1
- package/lib/module/web/interfaces.js +9 -11
- package/lib/module/web/interfaces.js.map +1 -1
- package/lib/module/web/tools/GestureHandlerWebDelegate.js +34 -0
- package/lib/module/web/tools/GestureHandlerWebDelegate.js.map +1 -1
- package/lib/module/web/tools/NodeManager.js +3 -2
- package/lib/module/web/tools/NodeManager.js.map +1 -1
- package/lib/module/web/tools/PointerEventManager.js +16 -7
- package/lib/module/web/tools/PointerEventManager.js.map +1 -1
- package/lib/module/web/tools/TouchEventManager.js +1 -2
- package/lib/module/web/tools/TouchEventManager.js.map +1 -1
- package/lib/typescript/RNGestureHandlerModule.d.ts +2 -13
- package/lib/typescript/RNGestureHandlerModule.windows.d.ts +5 -21
- package/lib/typescript/components/DrawerLayout.d.ts +11 -0
- package/lib/typescript/components/gestureHandlerRootHOC.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableWithoutFeedback.d.ts +1 -1
- package/lib/typescript/handlers/NativeViewGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/PanGestureHandler.d.ts +1 -1
- package/lib/typescript/handlers/gestureHandlerCommon.d.ts +4 -1
- package/lib/typescript/handlers/gestures/GestureDetector.d.ts +2 -1
- package/lib/typescript/handlers/gestures/gesture.d.ts +2 -0
- package/lib/typescript/handlers/gestures/gestureStateManager.d.ts +3 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +14 -0
- package/lib/typescript/web/handlers/GestureHandler.d.ts +3 -1
- package/lib/typescript/web/interfaces.d.ts +9 -9
- package/lib/typescript/web/tools/GestureHandlerDelegate.d.ts +2 -0
- package/lib/typescript/web/tools/GestureHandlerWebDelegate.d.ts +7 -0
- package/lib/typescript/web/tools/PointerEventManager.d.ts +2 -0
- package/package.json +14 -11
- package/src/RNGestureHandlerModule.ts +4 -49
- package/src/RNGestureHandlerModule.windows.ts +18 -100
- package/src/components/DrawerLayout.tsx +15 -0
- package/src/components/gestureHandlerRootHOC.tsx +1 -3
- package/src/components/touchables/TouchableWithoutFeedback.tsx +3 -3
- package/src/handlers/gestureHandlerCommon.ts +5 -0
- package/src/handlers/gestures/GestureDetector.tsx +16 -2
- package/src/handlers/gestures/gesture.ts +6 -0
- package/src/handlers/gestures/gestureStateManager.ts +42 -40
- package/src/index.ts +1 -0
- package/src/specs/NativeRNGestureHandlerModule.ts +26 -0
- package/src/web/handlers/FlingGestureHandler.ts +9 -5
- package/src/web/handlers/GestureHandler.ts +17 -0
- package/src/web/handlers/LongPressGestureHandler.ts +8 -5
- package/src/web/handlers/PanGestureHandler.ts +4 -0
- package/src/web/handlers/TapGestureHandler.ts +4 -0
- package/src/web/interfaces.ts +10 -10
- package/src/web/tools/GestureHandlerDelegate.ts +3 -0
- package/src/web/tools/GestureHandlerWebDelegate.ts +39 -0
- package/src/web/tools/NodeManager.ts +5 -1
- package/src/web/tools/PointerEventManager.ts +23 -5
- package/src/web/tools/TouchEventManager.ts +0 -2
- package/ios/Handlers/RNPinchHandler.m +0 -95
- package/ios/RNGestureHandlerModule.h +0 -7
- package/lib/commonjs/RNGestureHandlerModule.macos.js +0 -149
- package/lib/commonjs/RNGestureHandlerModule.macos.js.map +0 -1
- package/lib/module/RNGestureHandlerModule.macos.js +0 -110
- package/lib/module/RNGestureHandlerModule.macos.js.map +0 -1
- package/lib/typescript/RNGestureHandlerModule.macos.d.ts +0 -47
- package/src/RNGestureHandlerModule.macos.ts +0 -133
- /package/{ios → apple}/Handlers/RNFlingHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNForceTouchHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNHoverHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNLongPressHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNManualHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNNativeViewHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNPanHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNPinchHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNRotationHandler.h +0 -0
- /package/{ios → apple}/Handlers/RNTapHandler.h +0 -0
- /package/{ios → apple}/RNGHTouchEventType.h +0 -0
- /package/{ios → apple}/RNGestureHandler.xcodeproj/project.pbxproj +0 -0
- /package/{ios → apple}/RNGestureHandler.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- /package/{ios → apple}/RNGestureHandlerActionType.h +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonComponentView.h +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonComponentView.mm +0 -0
- /package/{ios → apple}/RNGestureHandlerButtonManager.h +0 -0
- /package/{ios → apple}/RNGestureHandlerDirection.h +0 -0
- /package/{ios → apple}/RNGestureHandlerEvents.m +0 -0
- /package/{ios → apple}/RNGestureHandlerRootViewComponentView.mm +0 -0
- /package/{ios → apple}/RNGestureHandlerState.h +0 -0
- /package/{ios → apple}/RNGestureHandlerStateManager.h +0 -0
- /package/{ios → apple}/RNRootViewGestureRecognizer.h +0 -0
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
import { isNewWebImplementationEnabled } from './EnableNewWebImplementation'; //GestureHandlers
|
3
|
-
|
4
|
-
import InteractionManager from './web/tools/InteractionManager';
|
5
|
-
import NodeManager from './web/tools/NodeManager';
|
1
|
+
// GestureHandlers
|
6
2
|
import PanGestureHandler from './web/handlers/PanGestureHandler';
|
7
3
|
import TapGestureHandler from './web/handlers/TapGestureHandler';
|
8
4
|
import LongPressGestureHandler from './web/handlers/LongPressGestureHandler';
|
@@ -10,17 +6,7 @@ import PinchGestureHandler from './web/handlers/PinchGestureHandler';
|
|
10
6
|
import RotationGestureHandler from './web/handlers/RotationGestureHandler';
|
11
7
|
import FlingGestureHandler from './web/handlers/FlingGestureHandler';
|
12
8
|
import NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';
|
13
|
-
import ManualGestureHandler from './web/handlers/ManualGestureHandler';
|
14
|
-
|
15
|
-
import * as HammerNodeManager from './web_hammer/NodeManager';
|
16
|
-
import HammerNativeViewGestureHandler from './web_hammer/NativeViewGestureHandler';
|
17
|
-
import HammerPanGestureHandler from './web_hammer/PanGestureHandler';
|
18
|
-
import HammerTapGestureHandler from './web_hammer/TapGestureHandler';
|
19
|
-
import HammerLongPressGestureHandler from './web_hammer/LongPressGestureHandler';
|
20
|
-
import HammerPinchGestureHandler from './web_hammer/PinchGestureHandler';
|
21
|
-
import HammerRotationGestureHandler from './web_hammer/RotationGestureHandler';
|
22
|
-
import HammerFlingGestureHandler from './web_hammer/FlingGestureHandler';
|
23
|
-
import { GestureHandlerWebDelegate } from './web/tools/GestureHandlerWebDelegate';
|
9
|
+
import ManualGestureHandler from './web/handlers/ManualGestureHandler';
|
24
10
|
export const Gestures = {
|
25
11
|
NativeViewGestureHandler,
|
26
12
|
PanGestureHandler,
|
@@ -31,15 +17,6 @@ export const Gestures = {
|
|
31
17
|
FlingGestureHandler,
|
32
18
|
ManualGestureHandler
|
33
19
|
};
|
34
|
-
export const HammerGestures = {
|
35
|
-
NativeViewGestureHandler: HammerNativeViewGestureHandler,
|
36
|
-
PanGestureHandler: HammerPanGestureHandler,
|
37
|
-
TapGestureHandler: HammerTapGestureHandler,
|
38
|
-
LongPressGestureHandler: HammerLongPressGestureHandler,
|
39
|
-
PinchGestureHandler: HammerPinchGestureHandler,
|
40
|
-
RotationGestureHandler: HammerRotationGestureHandler,
|
41
|
-
FlingGestureHandler: HammerFlingGestureHandler
|
42
|
-
};
|
43
20
|
export default {
|
44
21
|
handleSetJSResponder(_tag, _blockNativeResponder) {// NO-OP
|
45
22
|
},
|
@@ -47,72 +24,24 @@ export default {
|
|
47
24
|
handleClearJSResponder() {// NO-OP
|
48
25
|
},
|
49
26
|
|
50
|
-
createGestureHandler(
|
51
|
-
if (isNewWebImplementationEnabled()) {
|
52
|
-
if (!(handlerName in Gestures)) {
|
53
|
-
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
54
|
-
}
|
55
|
-
|
56
|
-
const GestureClass = Gestures[handlerName];
|
57
|
-
NodeManager.createGestureHandler(handlerTag, new GestureClass(new GestureHandlerWebDelegate()));
|
58
|
-
InteractionManager.getInstance().configureInteractions(NodeManager.getHandler(handlerTag), config);
|
59
|
-
} else {
|
60
|
-
if (!(handlerName in HammerGestures)) {
|
61
|
-
throw new Error(`react-native-gesture-handler: ${handlerName} is not supported on web.`);
|
62
|
-
} // @ts-ignore If it doesn't exist, the error is thrown
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
64
|
-
|
65
|
-
|
66
|
-
const GestureClass = HammerGestures[handlerName]; // eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
67
|
-
|
68
|
-
HammerNodeManager.createGestureHandler(handlerTag, new GestureClass());
|
69
|
-
}
|
70
|
-
|
71
|
-
this.updateGestureHandler(handlerTag, config);
|
27
|
+
createGestureHandler(_handlerName, _handlerTag, _config) {// NO-OP
|
72
28
|
},
|
73
29
|
|
74
|
-
attachGestureHandler(
|
75
|
-
|
76
|
-
if (!(newView instanceof HTMLElement || newView instanceof React.Component)) {
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
|
80
|
-
if (isNewWebImplementationEnabled()) {
|
81
|
-
//@ts-ignore Types should be HTMLElement or React.Component
|
82
|
-
NodeManager.getHandler(handlerTag).init(newView, propsRef);
|
83
|
-
} else {
|
84
|
-
//@ts-ignore Types should be HTMLElement or React.Component
|
85
|
-
HammerNodeManager.getHandler(handlerTag).setView(newView, propsRef);
|
86
|
-
}
|
30
|
+
attachGestureHandler(_handlerTag, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
31
|
+
_newView, _actionType, _propsRef) {// NO-OP
|
87
32
|
},
|
88
33
|
|
89
|
-
updateGestureHandler(
|
90
|
-
if (isNewWebImplementationEnabled()) {
|
91
|
-
NodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
92
|
-
InteractionManager.getInstance().configureInteractions(NodeManager.getHandler(handlerTag), newConfig);
|
93
|
-
} else {
|
94
|
-
HammerNodeManager.getHandler(handlerTag).updateGestureConfig(newConfig);
|
95
|
-
}
|
34
|
+
updateGestureHandler(_handlerTag, _newConfig) {// NO-OP
|
96
35
|
},
|
97
36
|
|
98
|
-
getGestureHandlerNode(
|
99
|
-
if (isNewWebImplementationEnabled()) {
|
100
|
-
return NodeManager.getHandler(handlerTag);
|
101
|
-
} else {
|
102
|
-
return HammerNodeManager.getHandler(handlerTag);
|
103
|
-
}
|
37
|
+
getGestureHandlerNode(_handlerTag) {// NO-OP
|
104
38
|
},
|
105
39
|
|
106
|
-
dropGestureHandler(
|
107
|
-
if (isNewWebImplementationEnabled()) {
|
108
|
-
NodeManager.dropGestureHandler(handlerTag);
|
109
|
-
} else {
|
110
|
-
HammerNodeManager.dropGestureHandler(handlerTag);
|
111
|
-
}
|
40
|
+
dropGestureHandler(_handlerTag) {// NO-OP
|
112
41
|
},
|
113
42
|
|
114
|
-
//
|
115
|
-
|
43
|
+
flushOperations() {// NO-OP
|
44
|
+
}
|
116
45
|
|
117
46
|
};
|
118
47
|
//# sourceMappingURL=RNGestureHandlerModule.windows.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["RNGestureHandlerModule.windows.ts"],"names":["
|
1
|
+
{"version":3,"sources":["RNGestureHandlerModule.windows.ts"],"names":["PanGestureHandler","TapGestureHandler","LongPressGestureHandler","PinchGestureHandler","RotationGestureHandler","FlingGestureHandler","NativeViewGestureHandler","ManualGestureHandler","Gestures","handleSetJSResponder","_tag","_blockNativeResponder","handleClearJSResponder","createGestureHandler","_handlerName","_handlerTag","_config","attachGestureHandler","_newView","_actionType","_propsRef","updateGestureHandler","_newConfig","getGestureHandlerNode","dropGestureHandler","flushOperations"],"mappings":"AAIA;AACA,OAAOA,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,OAAOC,uBAAP,MAAoC,wCAApC;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,OAAOC,sBAAP,MAAmC,uCAAnC;AACA,OAAOC,mBAAP,MAAgC,oCAAhC;AACA,OAAOC,wBAAP,MAAqC,yCAArC;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AAGA,OAAO,MAAMC,QAAQ,GAAG;AACtBF,EAAAA,wBADsB;AAEtBN,EAAAA,iBAFsB;AAGtBC,EAAAA,iBAHsB;AAItBC,EAAAA,uBAJsB;AAKtBC,EAAAA,mBALsB;AAMtBC,EAAAA,sBANsB;AAOtBC,EAAAA,mBAPsB;AAQtBE,EAAAA;AARsB,CAAjB;AAWP,eAAe;AACbE,EAAAA,oBAAoB,CAACC,IAAD,EAAeC,qBAAf,EAA+C,CACjE;AACD,GAHY;;AAIbC,EAAAA,sBAAsB,GAAG,CACvB;AACD,GANY;;AAObC,EAAAA,oBAAoB,CAClBC,YADkB,EAElBC,WAFkB,EAGlBC,OAHkB,EAIlB,CACA;AACD,GAbY;;AAcbC,EAAAA,oBAAoB,CAClBF,WADkB,EAElB;AACAG,EAAAA,QAHkB,EAIlBC,WAJkB,EAKlBC,SALkB,EAMlB,CACA;AACD,GAtBY;;AAuBbC,EAAAA,oBAAoB,CAACN,WAAD,EAAsBO,UAAtB,EAA0C,CAC5D;AACD,GAzBY;;AA0BbC,EAAAA,qBAAqB,CAACR,WAAD,EAAsB,CACzC;AACD,GA5BY;;AA6BbS,EAAAA,kBAAkB,CAACT,WAAD,EAAsB,CACtC;AACD,GA/BY;;AAgCbU,EAAAA,eAAe,GAAG,CAChB;AACD;;AAlCY,CAAf","sourcesContent":["import React from 'react';\n\nimport { ActionType } from './ActionType';\n\n// GestureHandlers\nimport PanGestureHandler from './web/handlers/PanGestureHandler';\nimport TapGestureHandler from './web/handlers/TapGestureHandler';\nimport LongPressGestureHandler from './web/handlers/LongPressGestureHandler';\nimport PinchGestureHandler from './web/handlers/PinchGestureHandler';\nimport RotationGestureHandler from './web/handlers/RotationGestureHandler';\nimport FlingGestureHandler from './web/handlers/FlingGestureHandler';\nimport NativeViewGestureHandler from './web/handlers/NativeViewGestureHandler';\nimport ManualGestureHandler from './web/handlers/ManualGestureHandler';\nimport { Config } from './web/interfaces';\n\nexport const Gestures = {\n NativeViewGestureHandler,\n PanGestureHandler,\n TapGestureHandler,\n LongPressGestureHandler,\n PinchGestureHandler,\n RotationGestureHandler,\n FlingGestureHandler,\n ManualGestureHandler,\n};\n\nexport default {\n handleSetJSResponder(_tag: number, _blockNativeResponder: boolean) {\n // NO-OP\n },\n handleClearJSResponder() {\n // NO-OP\n },\n createGestureHandler<T>(\n _handlerName: keyof typeof Gestures,\n _handlerTag: number,\n _config: T\n ) {\n // NO-OP\n },\n attachGestureHandler(\n _handlerTag: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _newView: any,\n _actionType: ActionType,\n _propsRef: React.RefObject<unknown>\n ) {\n // NO-OP\n },\n updateGestureHandler(_handlerTag: number, _newConfig: Config) {\n // NO-OP\n },\n getGestureHandlerNode(_handlerTag: number) {\n // NO-OP\n },\n dropGestureHandler(_handlerTag: number) {\n // NO-OP\n },\n flushOperations() {\n // NO-OP\n },\n};\n"]}
|
@@ -499,6 +499,8 @@ export default class DrawerLayout extends Component {
|
|
499
499
|
, {
|
500
500
|
userSelect: this.props.userSelect,
|
501
501
|
activeCursor: this.props.activeCursor,
|
502
|
+
mouseButton: this.props.mouseButton,
|
503
|
+
enableContextMenu: this.props.enableContextMenu,
|
502
504
|
ref: this.setPanGestureRef,
|
503
505
|
hitSlop: hitSlop,
|
504
506
|
activeOffsetX: gestureOrientation * minSwipeDistance,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","drawerState","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","drawerOpened","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","shouldComponentUpdate","render","userSelect","activeCursor","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,EAKEC,SALF,EAMEC,WANF,QAYO,cAZP;AAoBA,SACEC,iBADF,QAGO,+BAHP;AAIA,SACEC,iBADF,QAGO,+BAHP;AAIA,SAASC,KAAT,QAAsB,UAAtB;AAEA,MAAMC,SAAS,GAAG,IAAlB;AAEA,MAAMC,IAAiB,GAAG,MAA1B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AAiJA,eAAe,MAAMC,YAAN,SAA2Bf,SAA3B,CAGb;AAaAgB,EAAAA,WAAW,CAACC,MAAD,EAA2B;AACpC,UAAMA,MAAN;;AADoC;;AAAA;;AAAA,mEAoCHlB,KAAK,CAACmB,SAAN,EApCG;;AAAA,4DAqCVnB,KAAK,CAACmB,SAAN,EArCU;;AAAA,4DAsCVnB,KAAK,CAACmB,SAAN,EAtCU;;AAAA,yCAuChB,KAvCgB;;AAAA,iDA8CR,CAC5BD,KAD4B,EAE5BE,KAF4B,KAGzB;AACH;AACA,YAAM;AAAEC,QAAAA,cAAF;AAAkBC,QAAAA,WAAlB;AAA+BC,QAAAA;AAA/B,UAA8CL,KAApD;AACA,YAAM;AACJM,QAAAA,KAAK,EAAEC,UADH;AAEJC,QAAAA,MAAM,EAAEC,WAFJ;AAGJC,QAAAA,iBAHI;AAIJC,QAAAA;AAJI,UAKFT,KALJ;AAOA,UAAII,KAAK,GAAGC,UAAZ;AACA,UAAIC,MAAM,GAAGC,WAAb;;AAEA,UAAIN,cAAc,KAAK,MAAvB,EAA+B;AAC7B;AACA;AACA;AACA;AACA;AACA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AVc;AAa/BtB,EAAAA,IAAI,EAAE;AACJwB,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/B1C,EAAAA,OAAO,EAAE,EACP,GAAGxH,UAAU,CAAC+J,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n UserSelect,\n ActiveCursor,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\n// Animated.AnimatedInterpolation has been converted to a generic type\n// in @types/react-native 0.70. This way we can maintain compatibility\n// with all versions of @types/react-native`\ntype AnimatedInterpolation = ReturnType<Animated.Value['interpolate']>;\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp<ViewStyle>;\n\n drawerContainerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?:\n | React.ReactNode\n | ((openValue?: AnimatedInterpolation) => React.ReactNode);\n\n /**\n * @default 'none'\n * Defines which userSelect property should be used.\n * Values: 'none'|'text'|'auto'\n */\n userSelect?: UserSelect;\n\n /**\n * @default 'auto'\n * Defines which cursor property should be used when gesture activates.\n * Values: see CSS cursor values\n */\n activeCursor?: ActiveCursor;\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n drawerState: DrawerState;\n drawerOpened: boolean;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n drawerState: IDLE,\n drawerOpened: false,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n shouldComponentUpdate(props: DrawerLayoutProps, state: DrawerLayoutState) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n\n return true;\n }\n\n private openValue?: AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private accessibilityIsModalView = React.createRef<View>();\n private pointerEventsView = React.createRef<View>();\n private panGestureHandler = React.createRef<PanGestureHandler | null>();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent<PanGestureHandlerEventPayload>\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n this.setState({ drawerState: DRAGGING });\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n this.setState({ drawerState: SETTLING });\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n this.setState({ drawerOpened: willShow });\n if (this.state.drawerState !== DRAGGING) {\n // it's possilbe that user started drag while the drawer\n // was settling, don't override state in this case\n this.setState({ drawerState: IDLE });\n }\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(\n undefined,\n 0,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n let overlayOpacity;\n\n if (this.state.drawerState !== IDLE) {\n overlayOpacity = this.openValue;\n } else {\n overlayOpacity = this.state.drawerOpened ? 1 : 0;\n }\n\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n <TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={this.drawerShown ? 'auto' : 'none'}\n ref={this.pointerEventsView}\n style={[styles.overlay, dynamicOverlayStyles]}\n />\n </TapGestureHandler>\n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n if (this.state.drawerState !== IDLE) {\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n } else {\n drawerTranslateX = this.state.drawerOpened ? 0 : closedDrawerOffset;\n }\n }\n const drawerStyles: {\n transform: { translateX: number | AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n <Animated.View style={styles.main} onLayout={this.handleContainerLayout}>\n <Animated.View\n style={[\n drawerType === 'front'\n ? styles.containerOnBack\n : styles.containerInFront,\n containerStyles,\n contentContainerStyle,\n ]}\n importantForAccessibility={\n this.drawerShown ? 'no-hide-descendants' : 'yes'\n }>\n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n </Animated.View>\n <Animated.View\n pointerEvents=\"box-none\"\n ref={this.accessibilityIsModalView}\n accessibilityViewIsModal={this.drawerShown}\n style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>\n <View style={dynamicDrawerStyles}>\n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n </View>\n </Animated.View>\n </Animated.View>\n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (\n this.panGestureHandler as React.MutableRefObject<PanGestureHandler>\n ).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const { drawerPosition, drawerLockMode, edgeWidth, minSwipeDistance } =\n this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n <PanGestureHandler\n // @ts-ignore could be fixed in handler types\n userSelect={this.props.userSelect}\n activeCursor={this.props.activeCursor}\n ref={this.setPanGestureRef}\n hitSlop={hitSlop}\n activeOffsetX={gestureOrientation * minSwipeDistance!}\n failOffsetY={[-15, 15]}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.openingHandlerStateChange}\n enableTrackpadTwoFingerGesture={\n this.props.enableTrackpadTwoFingerGesture\n }\n enabled={\n drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'\n }>\n {this.renderDrawer()}\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}
|
1
|
+
{"version":3,"sources":["DrawerLayout.tsx"],"names":["React","Component","invariant","Animated","StyleSheet","View","Keyboard","StatusBar","I18nManager","PanGestureHandler","TapGestureHandler","State","DRAG_TOSS","IDLE","DRAGGING","SETTLING","DrawerLayout","constructor","props","createRef","state","drawerPosition","drawerWidth","drawerType","dragX","dragXValue","touchX","touchXValue","drawerTranslation","containerWidth","multiply","Value","add","setValue","translationX","startPositionX","dragOffsetFromOnStartPosition","interpolate","inputRange","outputRange","openValue","extrapolate","gestureOptions","useNativeDriver","useNativeAnimations","onDrawerSlide","listener","ev","Math","floor","abs","nativeEvent","position","onGestureEvent","event","x","setState","layout","width","newState","drawerWillShow","onDrawerStateChanged","oldState","ACTIVE","handleRelease","emitStateChanged","drawerState","keyboardDismissMode","dismiss","hideStatusBar","setHidden","statusBarAnimation","drawerShown","drawerLockMode","closeDrawer","velocityX","gestureStartX","dragOffsetBasedOnStart","startOffsetX","projOffsetX","shouldOpen","animateDrawer","showing","accessibilityIsModalView","current","setNativeProps","accessibilityViewIsModal","pointerEventsView","pointerEvents","minSwipeDistance","edgeWidth","fromLeft","gestureOrientation","hitSlop","left","undefined","right","panGestureHandler","activeOffsetX","fromValue","toValue","velocity","speed","nextFramePosition","min","max","willShow","updateShowing","spring","bounciness","start","finished","drawerOpened","onDrawerOpen","onDrawerClose","options","forceUpdate","overlayOpacity","dynamicOverlayStyles","opacity","backgroundColor","overlayColor","onTapHandlerStateChange","styles","overlay","drawerBackgroundColor","drawerContainerStyle","contentContainerStyle","drawerSlide","containerSlide","reverseContentDirection","isRTL","dynamicDrawerStyles","containerStyles","containerTranslateX","transform","translateX","drawerTranslateX","closedDrawerOffset","drawerStyles","flexDirection","main","handleContainerLayout","containerOnBack","containerInFront","children","renderOverlay","drawerContainer","renderNavigationView","ref","onGestureRef","updateAnimatedEvent","shouldComponentUpdate","render","userSelect","activeCursor","mouseButton","enableContextMenu","setPanGestureRef","openingHandlerStateChange","enableTrackpadTwoFingerGesture","renderDrawer","Left","Right","create","absoluteFillObject","zIndex","flex","overflow"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,SAAP,MAAsB,WAAtB;AACA,SACEC,QADF,EAEEC,UAFF,EAGEC,IAHF,EAIEC,QAJF,EAKEC,SALF,EAMEC,WANF,QAYO,cAZP;AAoBA,SACEC,iBADF,QAGO,+BAHP;AAIA,SACEC,iBADF,QAGO,+BAHP;AAIA,SAASC,KAAT,QAAsB,UAAtB;AAGA,MAAMC,SAAS,GAAG,IAAlB;AAEA,MAAMC,IAAiB,GAAG,MAA1B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AACA,MAAMC,QAAqB,GAAG,UAA9B;AA6JA,eAAe,MAAMC,YAAN,SAA2Bf,SAA3B,CAGb;AAaAgB,EAAAA,WAAW,CAACC,MAAD,EAA2B;AACpC,UAAMA,MAAN;;AADoC;;AAAA;;AAAA,mEAoCHlB,KAAK,CAACmB,SAAN,EApCG;;AAAA,4DAqCVnB,KAAK,CAACmB,SAAN,EArCU;;AAAA,4DAsCVnB,KAAK,CAACmB,SAAN,EAtCU;;AAAA,yCAuChB,KAvCgB;;AAAA,iDA8CR,CAC5BD,KAD4B,EAE5BE,KAF4B,KAGzB;AACH;AACA,YAAM;AAAEC,QAAAA,cAAF;AAAkBC,QAAAA,WAAlB;AAA+BC,QAAAA;AAA/B,UAA8CL,KAApD;AACA,YAAM;AACJM,QA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,C;;AA2drB,MAAMxC,MAAM,GAAGvH,UAAU,CAACgK,MAAX,CAAkB;AAC/BjB,EAAAA,eAAe,EAAE,EACf,GAAG/I,UAAU,CAACiK,kBADC;AAEfC,IAAAA,MAAM,EAAE,IAFO;AAGf1B,IAAAA,aAAa,EAAE;AAHA,GADc;AAM/BI,EAAAA,gBAAgB,EAAE,EAChB,GAAG5I,UAAU,CAACiK,kBADE;AAEhBC,IAAAA,MAAM,EAAE;AAFQ,GANa;AAU/BvB,EAAAA,eAAe,EAAE,EACf,GAAG3I,UAAU,CAACiK;AADC,GAVc;AAa/BxB,EAAAA,IAAI,EAAE;AACJ0B,IAAAA,IAAI,EAAE,CADF;AAEJD,IAAAA,MAAM,EAAE,CAFJ;AAGJE,IAAAA,QAAQ,EAAE;AAHN,GAbyB;AAkB/B5C,EAAAA,OAAO,EAAE,EACP,GAAGxH,UAAU,CAACiK,kBADP;AAEPC,IAAAA,MAAM,EAAE;AAFD;AAlBsB,CAAlB,CAAf","sourcesContent":["// This component is based on RN's DrawerLayoutAndroid API\n//\n// It perhaps deserves to be put in a separate repo, but since it relies on\n// react-native-gesture-handler library which isn't very popular at the moment I\n// decided to keep it here for the time being. It will allow us to move faster\n// and fix issues that may arise in gesture handler library that could be found\n// when using the drawer component\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport invariant from 'invariant';\nimport {\n Animated,\n StyleSheet,\n View,\n Keyboard,\n StatusBar,\n I18nManager,\n StatusBarAnimation,\n StyleProp,\n ViewStyle,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n UserSelect,\n ActiveCursor,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\nimport { MouseButton } from '../web/interfaces';\n\nconst DRAG_TOSS = 0.05;\n\nconst IDLE: DrawerState = 'Idle';\nconst DRAGGING: DrawerState = 'Dragging';\nconst SETTLING: DrawerState = 'Settling';\n\nexport type DrawerPosition = 'left' | 'right';\n\nexport type DrawerState = 'Idle' | 'Dragging' | 'Settling';\n\nexport type DrawerType = 'front' | 'back' | 'slide';\n\nexport type DrawerLockMode = 'unlocked' | 'locked-closed' | 'locked-open';\n\nexport type DrawerKeyboardDismissMode = 'none' | 'on-drag';\n\n// Animated.AnimatedInterpolation has been converted to a generic type\n// in @types/react-native 0.70. This way we can maintain compatibility\n// with all versions of @types/react-native`\ntype AnimatedInterpolation = ReturnType<Animated.Value['interpolate']>;\nexport interface DrawerLayoutProps {\n /**\n * This attribute is present in the standard implementation already and is one\n * of the required params. Gesture handler version of DrawerLayout make it\n * possible for the function passed as `renderNavigationView` to take an\n * Animated value as a parameter that indicates the progress of drawer\n * opening/closing animation (progress value is 0 when closed and 1 when\n * opened). This can be used by the drawer component to animated its children\n * while the drawer is opening or closing.\n */\n renderNavigationView: (\n progressAnimatedValue: Animated.Value\n ) => React.ReactNode;\n\n drawerPosition?: DrawerPosition;\n\n drawerWidth?: number;\n\n drawerBackgroundColor?: string;\n\n drawerLockMode?: DrawerLockMode;\n\n keyboardDismissMode?: DrawerKeyboardDismissMode;\n\n /**\n * Called when the drawer is closed.\n */\n onDrawerClose?: () => void;\n\n /**\n * Called when the drawer is opened.\n */\n onDrawerOpen?: () => void;\n\n /**\n * Called when the status of the drawer changes.\n */\n onDrawerStateChanged?: (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => void;\n useNativeAnimations?: boolean;\n\n drawerType?: DrawerType;\n\n /**\n * Defines how far from the edge of the content view the gesture should\n * activate.\n */\n edgeWidth?: number;\n\n minSwipeDistance?: number;\n\n /**\n * When set to true Drawer component will use\n * {@link https://reactnative.dev/docs/statusbar StatusBar} API to hide the OS\n * status bar whenever the drawer is pulled or when its in an \"open\" state.\n */\n hideStatusBar?: boolean;\n\n /**\n * @default 'slide'\n *\n * Can be used when hideStatusBar is set to true and will select the animation\n * used for hiding/showing the status bar. See\n * {@link https://reactnative.dev/docs/statusbar StatusBar} documentation for\n * more details\n */\n statusBarAnimation?: StatusBarAnimation;\n\n /**\n * @default black\n *\n * Color of a semi-transparent overlay to be displayed on top of the content\n * view when drawer gets open. A solid color should be used as the opacity is\n * added by the Drawer itself and the opacity of the overlay is animated (from\n * 0% to 70%).\n */\n overlayColor?: string;\n\n contentContainerStyle?: StyleProp<ViewStyle>;\n\n drawerContainerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n onDrawerSlide?: (position: number) => void;\n\n onGestureRef?: (ref: PanGestureHandler) => void;\n\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?:\n | React.ReactNode\n | ((openValue?: AnimatedInterpolation) => React.ReactNode);\n\n /**\n * @default 'none'\n * Defines which userSelect property should be used.\n * Values: 'none'|'text'|'auto'\n */\n userSelect?: UserSelect;\n\n /**\n * @default 'auto'\n * Defines which cursor property should be used when gesture activates.\n * Values: see CSS cursor values\n */\n activeCursor?: ActiveCursor;\n\n /**\n * @default 'MouseButton.LEFT'\n * Allows to choose which mouse button should underlying pan handler react to.\n */\n mouseButton?: MouseButton;\n\n /**\n * @default 'false if MouseButton.RIGHT is specified'\n * Allows to enable/disable context menu.\n */\n enableContextMenu?: boolean;\n}\n\nexport type DrawerLayoutState = {\n dragX: Animated.Value;\n touchX: Animated.Value;\n drawerTranslation: Animated.Value;\n containerWidth: number;\n drawerState: DrawerState;\n drawerOpened: boolean;\n};\n\nexport type DrawerMovementOption = {\n velocity?: number;\n speed?: number;\n};\nexport default class DrawerLayout extends Component<\n DrawerLayoutProps,\n DrawerLayoutState\n> {\n static defaultProps = {\n drawerWidth: 200,\n drawerPosition: 'left',\n useNativeAnimations: true,\n drawerType: 'front',\n edgeWidth: 20,\n minSwipeDistance: 3,\n overlayColor: 'rgba(0, 0, 0, 0.7)',\n drawerLockMode: 'unlocked',\n enableTrackpadTwoFingerGesture: false,\n };\n\n constructor(props: DrawerLayoutProps) {\n super(props);\n\n const dragX = new Animated.Value(0);\n const touchX = new Animated.Value(0);\n const drawerTranslation = new Animated.Value(0);\n\n this.state = {\n dragX,\n touchX,\n drawerTranslation,\n containerWidth: 0,\n drawerState: IDLE,\n drawerOpened: false,\n };\n\n this.updateAnimatedEvent(props, this.state);\n }\n\n shouldComponentUpdate(props: DrawerLayoutProps, state: DrawerLayoutState) {\n if (\n this.props.drawerPosition !== props.drawerPosition ||\n this.props.drawerWidth !== props.drawerWidth ||\n this.props.drawerType !== props.drawerType ||\n this.state.containerWidth !== state.containerWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n\n return true;\n }\n\n private openValue?: AnimatedInterpolation;\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private accessibilityIsModalView = React.createRef<View>();\n private pointerEventsView = React.createRef<View>();\n private panGestureHandler = React.createRef<PanGestureHandler | null>();\n private drawerShown = false;\n\n static positions = {\n Left: 'left',\n Right: 'right',\n };\n\n private updateAnimatedEvent = (\n props: DrawerLayoutProps,\n state: DrawerLayoutState\n ) => {\n // Event definition is based on\n const { drawerPosition, drawerWidth, drawerType } = props;\n const {\n dragX: dragXValue,\n touchX: touchXValue,\n drawerTranslation,\n containerWidth,\n } = state;\n\n let dragX = dragXValue;\n let touchX = touchXValue;\n\n if (drawerPosition !== 'left') {\n // Most of the code is written in a way to handle left-side drawer. In\n // order to handle right-side drawer the only thing we need to do is to\n // reverse events coming from gesture handler in a way they emulate\n // left-side drawer gestures. E.g. dragX is simply -dragX, and touchX is\n // calulcated by subtracing real touchX from the width of the container\n // (such that when touch happens at the right edge the value is simply 0)\n dragX = Animated.multiply(\n new Animated.Value(-1),\n dragXValue\n ) as Animated.Value; // TODO(TS): (for all \"as\" in this file) make sure we can map this\n touchX = Animated.add(\n new Animated.Value(containerWidth),\n Animated.multiply(new Animated.Value(-1), touchXValue)\n ) as Animated.Value; // TODO(TS): make sure we can map this;\n touchXValue.setValue(containerWidth);\n } else {\n touchXValue.setValue(0);\n }\n\n // While closing the drawer when user starts gesture outside of its area (in greyed\n // out part of the window), we want the drawer to follow only once finger reaches the\n // edge of the drawer.\n // E.g. on the diagram below drawer is illustrate by X signs and the greyed out area by\n // dots. The touch gesture starts at '*' and moves left, touch path is indicated by\n // an arrow pointing left\n // 1) +---------------+ 2) +---------------+ 3) +---------------+ 4) +---------------+\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|.<-*..| |XXXXXXXX|<--*..| |XXXXX|<-----*..|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // |XXXXXXXX|......| |XXXXXXXX|......| |XXXXXXXX|......| |XXXXX|.........|\n // +---------------+ +---------------+ +---------------+ +---------------+\n //\n // For the above to work properly we define animated value that will keep\n // start position of the gesture. Then we use that value to calculate how\n // much we need to subtract from the dragX. If the gesture started on the\n // greyed out area we take the distance from the edge of the drawer to the\n // start position. Otherwise we don't subtract at all and the drawer be\n // pulled back as soon as you start the pan.\n //\n // This is used only when drawerType is \"front\"\n //\n let translationX = dragX;\n if (drawerType === 'front') {\n const startPositionX = Animated.add(\n touchX,\n Animated.multiply(new Animated.Value(-1), dragX)\n );\n\n const dragOffsetFromOnStartPosition = startPositionX.interpolate({\n inputRange: [drawerWidth! - 1, drawerWidth!, drawerWidth! + 1],\n outputRange: [0, 0, 1],\n });\n translationX = Animated.add(\n dragX,\n dragOffsetFromOnStartPosition\n ) as Animated.Value; // TODO: as above\n }\n\n this.openValue = Animated.add(translationX, drawerTranslation).interpolate({\n inputRange: [0, drawerWidth!],\n outputRange: [0, 1],\n extrapolate: 'clamp',\n });\n\n const gestureOptions: {\n useNativeDriver: boolean;\n // TODO: make sure it is correct\n listener?: (\n ev: NativeSyntheticEvent<PanGestureHandlerEventPayload>\n ) => void;\n } = {\n useNativeDriver: props.useNativeAnimations!,\n };\n\n if (this.props.onDrawerSlide) {\n gestureOptions.listener = (ev) => {\n const translationX = Math.floor(Math.abs(ev.nativeEvent.translationX));\n const position = translationX / this.state.containerWidth;\n\n this.props.onDrawerSlide?.(position);\n };\n }\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragXValue, x: touchXValue } }],\n gestureOptions\n );\n };\n\n private handleContainerLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ containerWidth: nativeEvent.layout.width });\n };\n\n private emitStateChanged = (\n newState: DrawerState,\n drawerWillShow: boolean\n ) => {\n this.props.onDrawerStateChanged?.(newState, drawerWillShow);\n };\n\n private openingHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease({ nativeEvent });\n } else if (nativeEvent.state === State.ACTIVE) {\n this.emitStateChanged(DRAGGING, false);\n this.setState({ drawerState: DRAGGING });\n if (this.props.keyboardDismissMode === 'on-drag') {\n Keyboard.dismiss();\n }\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(true, this.props.statusBarAnimation || 'slide');\n }\n }\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (\n this.drawerShown &&\n nativeEvent.oldState === State.ACTIVE &&\n this.props.drawerLockMode !== 'locked-open'\n ) {\n this.closeDrawer();\n }\n };\n\n private handleRelease = ({\n nativeEvent,\n }: HandlerStateChangeEvent<PanGestureHandlerEventPayload>) => {\n const { drawerWidth, drawerPosition, drawerType } = this.props;\n const { containerWidth } = this.state;\n let { translationX: dragX, velocityX, x: touchX } = nativeEvent;\n\n if (drawerPosition !== 'left') {\n // See description in _updateAnimatedEvent about why events are flipped\n // for right-side drawer\n dragX = -dragX;\n touchX = containerWidth - touchX;\n velocityX = -velocityX;\n }\n\n const gestureStartX = touchX - dragX;\n let dragOffsetBasedOnStart = 0;\n\n if (drawerType === 'front') {\n dragOffsetBasedOnStart =\n gestureStartX > drawerWidth! ? gestureStartX - drawerWidth! : 0;\n }\n\n const startOffsetX =\n dragX + dragOffsetBasedOnStart + (this.drawerShown ? drawerWidth! : 0);\n const projOffsetX = startOffsetX + DRAG_TOSS * velocityX;\n\n const shouldOpen = projOffsetX > drawerWidth! / 2;\n\n if (shouldOpen) {\n this.animateDrawer(startOffsetX, drawerWidth!, velocityX);\n } else {\n this.animateDrawer(startOffsetX, 0, velocityX);\n }\n };\n\n private updateShowing = (showing: boolean) => {\n this.drawerShown = showing;\n this.accessibilityIsModalView.current?.setNativeProps({\n accessibilityViewIsModal: showing,\n });\n this.pointerEventsView.current?.setNativeProps({\n pointerEvents: showing ? 'auto' : 'none',\n });\n const { drawerPosition, minSwipeDistance, edgeWidth } = this.props;\n const fromLeft = drawerPosition === 'left';\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: showing ? undefined : edgeWidth }\n : { right: 0, width: showing ? undefined : edgeWidth };\n // @ts-ignore internal API, maybe could be fixed in handler types\n this.panGestureHandler.current?.setNativeProps({\n hitSlop,\n activeOffsetX: gestureOrientation * minSwipeDistance!,\n });\n };\n\n private animateDrawer = (\n fromValue: number | null | undefined,\n toValue: number,\n velocity: number,\n speed?: number\n ) => {\n this.state.dragX.setValue(0);\n this.state.touchX.setValue(\n this.props.drawerPosition === 'left' ? 0 : this.state.containerWidth\n );\n\n if (fromValue != null) {\n let nextFramePosition = fromValue;\n if (this.props.useNativeAnimations) {\n // When using native driver, we predict the next position of the\n // animation because it takes one frame of a roundtrip to pass RELEASE\n // event from native driver to JS before we can start animating. Without\n // it, it is more noticable that the frame is dropped.\n if (fromValue < toValue && velocity > 0) {\n nextFramePosition = Math.min(fromValue + velocity / 60.0, toValue);\n } else if (fromValue > toValue && velocity < 0) {\n nextFramePosition = Math.max(fromValue + velocity / 60.0, toValue);\n }\n }\n this.state.drawerTranslation.setValue(nextFramePosition);\n }\n\n const willShow = toValue !== 0;\n this.updateShowing(willShow);\n this.emitStateChanged(SETTLING, willShow);\n this.setState({ drawerState: SETTLING });\n if (this.props.hideStatusBar) {\n StatusBar.setHidden(willShow, this.props.statusBarAnimation || 'slide');\n }\n Animated.spring(this.state.drawerTranslation, {\n velocity,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n speed: speed ?? undefined,\n }).start(({ finished }) => {\n if (finished) {\n this.emitStateChanged(IDLE, willShow);\n this.setState({ drawerOpened: willShow });\n if (this.state.drawerState !== DRAGGING) {\n // it's possilbe that user started drag while the drawer\n // was settling, don't override state in this case\n this.setState({ drawerState: IDLE });\n }\n if (willShow) {\n this.props.onDrawerOpen?.();\n } else {\n this.props.onDrawerClose?.();\n }\n }\n });\n };\n\n openDrawer = (options: DrawerMovementOption = {}) => {\n this.animateDrawer(\n // TODO: decide if it should be null or undefined is the proper value\n undefined,\n this.props.drawerWidth!,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would not be clickable\n this.forceUpdate();\n };\n\n closeDrawer = (options: DrawerMovementOption = {}) => {\n // TODO: decide if it should be null or undefined is the proper value\n this.animateDrawer(\n undefined,\n 0,\n options.velocity ? options.velocity : 0,\n options.speed\n );\n\n // We need to force the update, otherwise the overlay is not rerendered and\n // it would be still clickable\n this.forceUpdate();\n };\n\n private renderOverlay = () => {\n /* Overlay styles */\n invariant(this.openValue, 'should be set');\n let overlayOpacity;\n\n if (this.state.drawerState !== IDLE) {\n overlayOpacity = this.openValue;\n } else {\n overlayOpacity = this.state.drawerOpened ? 1 : 0;\n }\n\n const dynamicOverlayStyles = {\n opacity: overlayOpacity,\n backgroundColor: this.props.overlayColor,\n };\n\n return (\n <TapGestureHandler onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={this.drawerShown ? 'auto' : 'none'}\n ref={this.pointerEventsView}\n style={[styles.overlay, dynamicOverlayStyles]}\n />\n </TapGestureHandler>\n );\n };\n\n private renderDrawer = () => {\n const {\n drawerBackgroundColor,\n drawerWidth,\n drawerPosition,\n drawerType,\n drawerContainerStyle,\n contentContainerStyle,\n } = this.props;\n\n const fromLeft = drawerPosition === 'left';\n const drawerSlide = drawerType !== 'back';\n const containerSlide = drawerType !== 'front';\n\n // we rely on row and row-reverse flex directions to position the drawer\n // properly. Apparently for RTL these are flipped which requires us to use\n // the opposite setting for the drawer to appear from left or right\n // according to the drawerPosition prop\n const reverseContentDirection = I18nManager.isRTL ? fromLeft : !fromLeft;\n\n const dynamicDrawerStyles = {\n backgroundColor: drawerBackgroundColor,\n width: drawerWidth,\n };\n const openValue = this.openValue;\n invariant(openValue, 'should be set');\n\n let containerStyles;\n if (containerSlide) {\n const containerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: fromLeft ? [0, drawerWidth!] : [0, -drawerWidth!],\n extrapolate: 'clamp',\n });\n containerStyles = {\n transform: [{ translateX: containerTranslateX }],\n };\n }\n\n let drawerTranslateX: number | AnimatedInterpolation = 0;\n if (drawerSlide) {\n const closedDrawerOffset = fromLeft ? -drawerWidth! : drawerWidth!;\n if (this.state.drawerState !== IDLE) {\n drawerTranslateX = openValue.interpolate({\n inputRange: [0, 1],\n outputRange: [closedDrawerOffset, 0],\n extrapolate: 'clamp',\n });\n } else {\n drawerTranslateX = this.state.drawerOpened ? 0 : closedDrawerOffset;\n }\n }\n const drawerStyles: {\n transform: { translateX: number | AnimatedInterpolation }[];\n flexDirection: 'row-reverse' | 'row';\n } = {\n transform: [{ translateX: drawerTranslateX }],\n flexDirection: reverseContentDirection ? 'row-reverse' : 'row',\n };\n\n return (\n <Animated.View style={styles.main} onLayout={this.handleContainerLayout}>\n <Animated.View\n style={[\n drawerType === 'front'\n ? styles.containerOnBack\n : styles.containerInFront,\n containerStyles,\n contentContainerStyle,\n ]}\n importantForAccessibility={\n this.drawerShown ? 'no-hide-descendants' : 'yes'\n }>\n {typeof this.props.children === 'function'\n ? this.props.children(this.openValue)\n : this.props.children}\n {this.renderOverlay()}\n </Animated.View>\n <Animated.View\n pointerEvents=\"box-none\"\n ref={this.accessibilityIsModalView}\n accessibilityViewIsModal={this.drawerShown}\n style={[styles.drawerContainer, drawerStyles, drawerContainerStyle]}>\n <View style={dynamicDrawerStyles}>\n {this.props.renderNavigationView(this.openValue as Animated.Value)}\n </View>\n </Animated.View>\n </Animated.View>\n );\n };\n\n private setPanGestureRef = (ref: PanGestureHandler) => {\n // TODO(TS): make sure it is OK taken from\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31065#issuecomment-596081842\n (\n this.panGestureHandler as React.MutableRefObject<PanGestureHandler>\n ).current = ref;\n this.props.onGestureRef?.(ref);\n };\n\n render() {\n const { drawerPosition, drawerLockMode, edgeWidth, minSwipeDistance } =\n this.props;\n\n const fromLeft = drawerPosition === 'left';\n\n // gestureOrientation is 1 if the expected gesture is from left to right and\n // -1 otherwise e.g. when drawer is on the left and is closed we expect left\n // to right gesture, thus orientation will be 1.\n const gestureOrientation =\n (fromLeft ? 1 : -1) * (this.drawerShown ? -1 : 1);\n\n // When drawer is closed we want the hitSlop to be horizontally shorter than\n // the container size by the value of SLOP. This will make it only activate\n // when gesture happens not further than SLOP away from the edge\n const hitSlop = fromLeft\n ? { left: 0, width: this.drawerShown ? undefined : edgeWidth }\n : { right: 0, width: this.drawerShown ? undefined : edgeWidth };\n\n return (\n <PanGestureHandler\n // @ts-ignore could be fixed in handler types\n userSelect={this.props.userSelect}\n activeCursor={this.props.activeCursor}\n mouseButton={this.props.mouseButton}\n enableContextMenu={this.props.enableContextMenu}\n ref={this.setPanGestureRef}\n hitSlop={hitSlop}\n activeOffsetX={gestureOrientation * minSwipeDistance!}\n failOffsetY={[-15, 15]}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.openingHandlerStateChange}\n enableTrackpadTwoFingerGesture={\n this.props.enableTrackpadTwoFingerGesture\n }\n enabled={\n drawerLockMode !== 'locked-closed' && drawerLockMode !== 'locked-open'\n }>\n {this.renderDrawer()}\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n drawerContainer: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1001,\n flexDirection: 'row',\n },\n containerInFront: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1002,\n },\n containerOnBack: {\n ...StyleSheet.absoluteFillObject,\n },\n main: {\n flex: 1,\n zIndex: 0,\n overflow: 'hidden',\n },\n overlay: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 1000,\n },\n});\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["gestureHandlerRootHOC.tsx"],"names":["React","StyleSheet","hoistNonReactStatics","GestureHandlerRootView","gestureHandlerRootHOC","Component","containerStyles","Wrapper","props","styles","container","displayName","name","create","flex"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAAiD,cAAjD;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AAEA,eAAe,SAASC,qBAAT,
|
1
|
+
{"version":3,"sources":["gestureHandlerRootHOC.tsx"],"names":["React","StyleSheet","hoistNonReactStatics","GestureHandlerRootView","gestureHandlerRootHOC","Component","containerStyles","Wrapper","props","styles","container","displayName","name","create","flex"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAAiD,cAAjD;AACA,OAAOC,oBAAP,MAAiC,yBAAjC;AACA,OAAOC,sBAAP,MAAmC,0BAAnC;AAEA,eAAe,SAASC,qBAAT,CACbC,SADa,EAEbC,eAFa,EAGW;AACxB,WAASC,OAAT,CAAiBC,KAAjB,EAA2B;AACzB,wBACE,oBAAC,sBAAD;AAAwB,MAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBJ,eAAnB;AAA/B,oBACE,oBAAC,SAAD,EAAeE,KAAf,CADF,CADF;AAKD;;AAEDD,EAAAA,OAAO,CAACI,WAAR,GAAuB,yBACrBN,SAAS,CAACM,WAAV,IAAyBN,SAAS,CAACO,IACpC,GAFD,CATwB,CAaxB;;AACAV,EAAAA,oBAAoB,CAACK,OAAD,EAAUF,SAAV,CAApB;AAEA,SAAOE,OAAP;AACD;AAED,MAAME,MAAM,GAAGR,UAAU,CAACY,MAAX,CAAkB;AAC/BH,EAAAA,SAAS,EAAE;AAAEI,IAAAA,IAAI,EAAE;AAAR;AADoB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, StyleProp, ViewStyle } from 'react-native';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport GestureHandlerRootView from './GestureHandlerRootView';\n\nexport default function gestureHandlerRootHOC<P extends object>(\n Component: React.ComponentType<P>,\n containerStyles?: StyleProp<ViewStyle>\n): React.ComponentType<P> {\n function Wrapper(props: P) {\n return (\n <GestureHandlerRootView style={[styles.container, containerStyles]}>\n <Component {...props} />\n </GestureHandlerRootView>\n );\n }\n\n Wrapper.displayName = `gestureHandlerRootHOC(${\n Component.displayName || Component.name\n })`;\n\n // @ts-ignore - hoistNonReactStatics uses old version of @types/react\n hoistNonReactStatics(Wrapper, Component);\n\n return Wrapper;\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n});\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["TouchableWithoutFeedback.tsx"],"names":["React","GenericTouchable","TouchableWithoutFeedback","forwardRef","props","ref","defaultProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,gBAAP,MAAwD,oBAAxD;AAIA,MAAMC,wBAAwB,gBAAGF,KAAK,CAACG,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,kBAAgB,oBAAC,gBAAD;AAAkB,EAAA,GAAG,EAAEA;AAAvB,GAAgCD,KAAhC,EAHe,CAAjC;AAKAF,wBAAwB,CAACI,YAAzB,GAAwCL,gBAAgB,CAACK,YAAzD;AAEA,eAAeJ,wBAAf","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport GenericTouchable, { GenericTouchableProps } from './GenericTouchable';\n\nexport type TouchableWithoutFeedbackProps =
|
1
|
+
{"version":3,"sources":["TouchableWithoutFeedback.tsx"],"names":["React","GenericTouchable","TouchableWithoutFeedback","forwardRef","props","ref","defaultProps"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,gBAAP,MAAwD,oBAAxD;AAIA,MAAMC,wBAAwB,gBAAGF,KAAK,CAACG,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,kBAAgB,oBAAC,gBAAD;AAAkB,EAAA,GAAG,EAAEA;AAAvB,GAAgCD,KAAhC,EAHe,CAAjC;AAKAF,wBAAwB,CAACI,YAAzB,GAAwCL,gBAAgB,CAACK,YAAzD;AAEA,eAAeJ,wBAAf","sourcesContent":["import * as React from 'react';\nimport { PropsWithChildren } from 'react';\nimport GenericTouchable, { GenericTouchableProps } from './GenericTouchable';\n\nexport type TouchableWithoutFeedbackProps = GenericTouchableProps;\n\nconst TouchableWithoutFeedback = React.forwardRef<\n GenericTouchable,\n PropsWithChildren<TouchableWithoutFeedbackProps>\n>((props, ref) => <GenericTouchable ref={ref} {...props} />);\n\nTouchableWithoutFeedback.defaultProps = GenericTouchable.defaultProps;\n\nexport default TouchableWithoutFeedback;\n"]}
|
@@ -7,7 +7,7 @@ import { handlerIDToTag } from './handlersRegistry';
|
|
7
7
|
import { toArray } from '../utils';
|
8
8
|
import RNGestureHandlerModule from '../RNGestureHandlerModule';
|
9
9
|
import { ghQueueMicrotask } from '../ghQueueMicrotask';
|
10
|
-
const commonProps = ['id', 'enabled', 'shouldCancelWhenOutside', 'hitSlop', 'cancelsTouchesInView', 'userSelect', 'activeCursor'];
|
10
|
+
const commonProps = ['id', 'enabled', 'shouldCancelWhenOutside', 'hitSlop', 'cancelsTouchesInView', 'userSelect', 'activeCursor', 'mouseButton', 'enableContextMenu'];
|
11
11
|
const componentInteractionProps = ['waitFor', 'simultaneousHandlers', 'blocksHandlers'];
|
12
12
|
export const baseGestureHandlerProps = [...commonProps, ...componentInteractionProps, 'onBegan', 'onFailed', 'onCancelled', 'onActivated', 'onEnded', 'onGestureEvent', 'onHandlerStateChange'];
|
13
13
|
export const baseGestureHandlerWithMonitorProps = [...commonProps, 'needsPointerData', 'manualActivation'];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["gestureHandlerCommon.ts"],"names":["Platform","findNodeHandle","findNodeHandleRN","handlerIDToTag","toArray","RNGestureHandlerModule","ghQueueMicrotask","commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithMonitorProps","isConfigParam","param","name","undefined","Object","filterConfig","props","validProps","defaults","filteredConfig","key","value","transformIntoHandlerTags","top","left","bottom","right","handlerIDs","OS","map","current","filter","handle","handlerID","handlerTag","node","flushOperationsScheduled","scheduleFlushOperations","flushOperations"],"mappings":"AAAA;AACA;AACA;AACA;AAEA,SAASA,QAAT,EAAmBC,cAAc,IAAIC,gBAArC,QAA6D,cAA7D;AAKA,SAASC,cAAT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AACA/B,IAAAA,gBAAgB,CAAC,MAAM;AACrBD,MAAAA,sBAAsB,CAACkC,eAAvB;AAEAF,MAAAA,wBAAwB,GAAG,KAA3B;AACD,KAJe,CAAhB;AAKD;AACF","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\nimport { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';\n\nimport { State } from '../State';\nimport { TouchEventType } from '../TouchEventType';\nimport { ValueOf } from '../typeUtils';\nimport { handlerIDToTag } from './handlersRegistry';\nimport { toArray } from '../utils';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'cancelsTouchesInView',\n 'userSelect',\n 'activeCursor',\n] as const;\n\nconst componentInteractionProps = [\n 'waitFor',\n 'simultaneousHandlers',\n 'blocksHandlers',\n] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithMonitorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n}\nexport interface HandlerStateChangeEventPayload extends GestureEventPayload {\n oldState: ValueOf<typeof State>;\n}\n\nexport type HitSlop =\n | number\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\nexport type UserSelect = 'none' | 'auto' | 'text';\nexport type ActiveCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'col-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out';\n\n//TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf<typeof State>;\n eventType: TouchEventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n};\n\nexport type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =\n GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record<string, unknown>\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n userSelect?: UserSelect;\n activeCursor?: ActiveCursor;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n testID?: string;\n cancelsTouchesInView?: boolean;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n //TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n};\n\nfunction isConfigParam(param: unknown, name: string) {\n // param !== Object(param) returns false if `param` is a function\n // or an object and returns true if `param` is null\n return (\n param !== undefined &&\n (param !== Object(param) ||\n !('__isNative' in (param as Record<string, unknown>))) &&\n name !== 'onHandlerStateChange' &&\n name !== 'onGestureEvent'\n );\n}\n\nexport function filterConfig(\n props: Record<string, unknown>,\n validProps: string[],\n defaults: Record<string, unknown> = {}\n) {\n const filteredConfig = { ...defaults };\n for (const key of validProps) {\n let value = props[key];\n if (isConfigParam(value, key)) {\n if (key === 'simultaneousHandlers' || key === 'waitFor') {\n value = transformIntoHandlerTags(props[key]);\n } else if (key === 'hitSlop' && typeof value !== 'object') {\n value = { top: value, left: value, bottom: value, right: value };\n }\n filteredConfig[key] = value;\n }\n }\n return filteredConfig;\n}\n\nfunction transformIntoHandlerTags(handlerIDs: any) {\n handlerIDs = toArray(handlerIDs);\n\n if (Platform.OS === 'web') {\n return handlerIDs\n .map(({ current }: { current: any }) => current)\n .filter((handle: any) => handle);\n }\n // converts handler string IDs into their numeric tags\n return handlerIDs\n .map(\n (handlerID: any) =>\n handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1\n )\n .filter((handlerTag: number) => handlerTag > 0);\n}\n\nexport function findNodeHandle(\n node: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number | React.Component<any, any> | React.ComponentClass<any> {\n if (Platform.OS === 'web') {\n return node;\n }\n return findNodeHandleRN(node);\n}\n\nlet flushOperationsScheduled = false;\n\nexport function scheduleFlushOperations() {\n if (!flushOperationsScheduled) {\n flushOperationsScheduled = true;\n ghQueueMicrotask(() => {\n RNGestureHandlerModule.flushOperations();\n\n flushOperationsScheduled = false;\n });\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["gestureHandlerCommon.ts"],"names":["Platform","findNodeHandle","findNodeHandleRN","handlerIDToTag","toArray","RNGestureHandlerModule","ghQueueMicrotask","commonProps","componentInteractionProps","baseGestureHandlerProps","baseGestureHandlerWithMonitorProps","isConfigParam","param","name","undefined","Object","filterConfig","props","validProps","defaults","filteredConfig","key","value","transformIntoHandlerTags","top","left","bottom","right","handlerIDs","OS","map","current","filter","handle","handlerID","handlerTag","node","flushOperationsScheduled","scheduleFlushOperations","flushOperations"],"mappings":"AAAA;AACA;AACA;AACA;AAEA,SAASA,QAAT,EAAmBC,cAAc,IAAIC,gBAArC,QAA6D,cAA7D;AAKA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,OAAT,QAAwB,UAAxB;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AACA,SAASC,gBAAT,QAAiC,qBAAjC;AAGA,MAAMC,WAAW,GAAG,CAClB,IADkB,EAElB,SAFkB,EAGlB,yBAHkB,EAIlB,SAJkB,EAKlB,sBALkB,EAMlB,YANkB,EAOlB,cAPkB,EAQlB,aARkB,EASlB,mBATkB,CAApB;AAYA,MAAMC,yBAAyB,GAAG,CAChC,SADgC,EAEhC,sBAFgC,EAGh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AAc,CAACC,GAAD,CAAd,GAAsBC,KAAtB;AACD;AACF;;AACD,SAAOF,cAAP;AACD;;AAED,SAASG,wBAAT,CAAkCK,UAAlC,EAAmD;AACjDA,EAAAA,UAAU,GAAGxB,OAAO,CAACwB,UAAD,CAApB;;AAEA,MAAI5B,QAAQ,CAAC6B,EAAT,KAAgB,KAApB,EAA2B;AACzB,WAAOD,UAAU,CACdE,GADI,CACA,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAmCA,OADnC,EAEJC,MAFI,CAEIC,MAAD,IAAiBA,MAFpB,CAAP;AAGD,GAPgD,CAQjD;;;AACA,SAAOL,UAAU,CACdE,GADI,CAEFI,SAAD;AAAA;;AAAA,WACE/B,cAAc,CAAC+B,SAAD,CAAd,2BAA6BA,SAAS,CAACH,OAAvC,uDAA6B,mBAAmBI,UAAhD,KAA8D,CAAC,CADjE;AAAA,GAFG,EAKJH,MALI,CAKIG,UAAD,IAAwBA,UAAU,GAAG,CALxC,CAAP;AAMD;;AAED,OAAO,SAASlC,cAAT,CACLmC,IADK,EAEkE;AACvE,MAAIpC,QAAQ,CAAC6B,EAAT,KAAgB,KAApB,EAA2B;AACzB,WAAOO,IAAP;AACD;;AACD,SAAOlC,gBAAgB,CAACkC,IAAD,CAAvB;AACD;AAED,IAAIC,wBAAwB,GAAG,KAA/B;AAEA,OAAO,SAASC,uBAAT,GAAmC;AACxC,MAAI,CAACD,wBAAL,EAA+B;AAC7BA,IAAAA,wBAAwB,GAAG,IAA3B;AACA/B,IAAAA,gBAAgB,CAAC,MAAM;AACrBD,MAAAA,sBAAsB,CAACkC,eAAvB;AAEAF,MAAAA,wBAAwB,GAAG,KAA3B;AACD,KAJe,CAAhB;AAKD;AACF","sourcesContent":["// Previous types exported gesture handlers as classes which creates an interface and variable, both named the same as class.\n// Without those types, we'd introduce breaking change, forcing users to prefix every handler type specification with typeof\n// e.g. React.createRef<TapGestureHandler> -> React.createRef<typeof TapGestureHandler>.\n// See https://www.typescriptlang.org/docs/handbook/classes.html#constructor-functions for reference.\nimport * as React from 'react';\nimport { Platform, findNodeHandle as findNodeHandleRN } from 'react-native';\n\nimport { State } from '../State';\nimport { TouchEventType } from '../TouchEventType';\nimport { ValueOf } from '../typeUtils';\nimport { handlerIDToTag } from './handlersRegistry';\nimport { toArray } from '../utils';\nimport RNGestureHandlerModule from '../RNGestureHandlerModule';\nimport { ghQueueMicrotask } from '../ghQueueMicrotask';\nimport { MouseButton } from '../web/interfaces';\n\nconst commonProps = [\n 'id',\n 'enabled',\n 'shouldCancelWhenOutside',\n 'hitSlop',\n 'cancelsTouchesInView',\n 'userSelect',\n 'activeCursor',\n 'mouseButton',\n 'enableContextMenu',\n] as const;\n\nconst componentInteractionProps = [\n 'waitFor',\n 'simultaneousHandlers',\n 'blocksHandlers',\n] as const;\n\nexport const baseGestureHandlerProps = [\n ...commonProps,\n ...componentInteractionProps,\n 'onBegan',\n 'onFailed',\n 'onCancelled',\n 'onActivated',\n 'onEnded',\n 'onGestureEvent',\n 'onHandlerStateChange',\n] as const;\n\nexport const baseGestureHandlerWithMonitorProps = [\n ...commonProps,\n 'needsPointerData',\n 'manualActivation',\n];\n\nexport interface GestureEventPayload {\n handlerTag: number;\n numberOfPointers: number;\n state: ValueOf<typeof State>;\n}\nexport interface HandlerStateChangeEventPayload extends GestureEventPayload {\n oldState: ValueOf<typeof State>;\n}\n\nexport type HitSlop =\n | number\n | Partial<\n Record<\n 'left' | 'right' | 'top' | 'bottom' | 'vertical' | 'horizontal',\n number\n >\n >\n | Record<'width' | 'left', number>\n | Record<'width' | 'right', number>\n | Record<'height' | 'top', number>\n | Record<'height' | 'bottom', number>;\n\nexport type UserSelect = 'none' | 'auto' | 'text';\nexport type ActiveCursor =\n | 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'grab'\n | 'grabbing'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ew-resize'\n | 'ns-resize'\n | 'nesw-resize'\n | 'nwse-resize'\n | 'col-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out';\n\n//TODO(TS) events in handlers\n\nexport interface GestureEvent<ExtraEventPayloadT = Record<string, unknown>> {\n nativeEvent: Readonly<GestureEventPayload & ExtraEventPayloadT>;\n}\nexport interface HandlerStateChangeEvent<\n ExtraEventPayloadT = Record<string, unknown>\n> {\n nativeEvent: Readonly<HandlerStateChangeEventPayload & ExtraEventPayloadT>;\n}\n\nexport type TouchData = {\n id: number;\n x: number;\n y: number;\n absoluteX: number;\n absoluteY: number;\n};\n\nexport type GestureTouchEvent = {\n handlerTag: number;\n numberOfTouches: number;\n state: ValueOf<typeof State>;\n eventType: TouchEventType;\n allTouches: TouchData[];\n changedTouches: TouchData[];\n};\n\nexport type GestureUpdateEvent<GestureEventPayloadT = Record<string, unknown>> =\n GestureEventPayload & GestureEventPayloadT;\n\nexport type GestureStateChangeEvent<\n GestureStateChangeEventPayloadT = Record<string, unknown>\n> = HandlerStateChangeEventPayload & GestureStateChangeEventPayloadT;\n\nexport type CommonGestureConfig = {\n enabled?: boolean;\n shouldCancelWhenOutside?: boolean;\n hitSlop?: HitSlop;\n userSelect?: UserSelect;\n activeCursor?: ActiveCursor;\n mouseButton?: MouseButton;\n enableContextMenu?: boolean;\n};\n\n// Events payloads are types instead of interfaces due to TS limitation.\n// See https://github.com/microsoft/TypeScript/issues/15300 for more info.\nexport type BaseGestureHandlerProps<\n ExtraEventPayloadT extends Record<string, unknown> = Record<string, unknown>\n> = CommonGestureConfig & {\n id?: string;\n waitFor?: React.Ref<unknown> | React.Ref<unknown>[];\n simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[];\n testID?: string;\n cancelsTouchesInView?: boolean;\n // TODO(TS) - fix event types\n onBegan?: (event: HandlerStateChangeEvent) => void;\n onFailed?: (event: HandlerStateChangeEvent) => void;\n onCancelled?: (event: HandlerStateChangeEvent) => void;\n onActivated?: (event: HandlerStateChangeEvent) => void;\n onEnded?: (event: HandlerStateChangeEvent) => void;\n\n //TODO(TS) consider using NativeSyntheticEvent\n onGestureEvent?: (event: GestureEvent<ExtraEventPayloadT>) => void;\n onHandlerStateChange?: (\n event: HandlerStateChangeEvent<ExtraEventPayloadT>\n ) => void;\n // implicit `children` prop has been removed in @types/react^18.0.0\n children?: React.ReactNode;\n};\n\nfunction isConfigParam(param: unknown, name: string) {\n // param !== Object(param) returns false if `param` is a function\n // or an object and returns true if `param` is null\n return (\n param !== undefined &&\n (param !== Object(param) ||\n !('__isNative' in (param as Record<string, unknown>))) &&\n name !== 'onHandlerStateChange' &&\n name !== 'onGestureEvent'\n );\n}\n\nexport function filterConfig(\n props: Record<string, unknown>,\n validProps: string[],\n defaults: Record<string, unknown> = {}\n) {\n const filteredConfig = { ...defaults };\n for (const key of validProps) {\n let value = props[key];\n if (isConfigParam(value, key)) {\n if (key === 'simultaneousHandlers' || key === 'waitFor') {\n value = transformIntoHandlerTags(props[key]);\n } else if (key === 'hitSlop' && typeof value !== 'object') {\n value = { top: value, left: value, bottom: value, right: value };\n }\n filteredConfig[key] = value;\n }\n }\n return filteredConfig;\n}\n\nfunction transformIntoHandlerTags(handlerIDs: any) {\n handlerIDs = toArray(handlerIDs);\n\n if (Platform.OS === 'web') {\n return handlerIDs\n .map(({ current }: { current: any }) => current)\n .filter((handle: any) => handle);\n }\n // converts handler string IDs into their numeric tags\n return handlerIDs\n .map(\n (handlerID: any) =>\n handlerIDToTag[handlerID] || handlerID.current?.handlerTag || -1\n )\n .filter((handlerTag: number) => handlerTag > 0);\n}\n\nexport function findNodeHandle(\n node: null | number | React.Component<any, any> | React.ComponentClass<any>\n): null | number | React.Component<any, any> | React.ComponentClass<any> {\n if (Platform.OS === 'web') {\n return node;\n }\n return findNodeHandleRN(node);\n}\n\nlet flushOperationsScheduled = false;\n\nexport function scheduleFlushOperations() {\n if (!flushOperationsScheduled) {\n flushOperationsScheduled = true;\n ghQueueMicrotask(() => {\n RNGestureHandlerModule.flushOperations();\n\n flushOperationsScheduled = false;\n });\n }\n}\n"]}
|
@@ -443,6 +443,12 @@ const applyUserSelectProp = (userSelect, gesture) => {
|
|
443
443
|
}
|
444
444
|
};
|
445
445
|
|
446
|
+
const applyEnableContextMenuProp = (enableContextMenu, gesture) => {
|
447
|
+
for (const g of gesture.toGestureArray()) {
|
448
|
+
g.config.enableContextMenu = enableContextMenu;
|
449
|
+
}
|
450
|
+
};
|
451
|
+
|
446
452
|
export const GestureDetector = props => {
|
447
453
|
const rootViewContext = useContext(GestureHandlerRootViewContext);
|
448
454
|
|
@@ -456,6 +462,10 @@ export const GestureDetector = props => {
|
|
456
462
|
applyUserSelectProp(props.userSelect, gestureConfig);
|
457
463
|
}
|
458
464
|
|
465
|
+
if (props.enableContextMenu !== undefined) {
|
466
|
+
applyEnableContextMenuProp(props.enableContextMenu, gestureConfig);
|
467
|
+
}
|
468
|
+
|
459
469
|
const gesture = gestureConfig.toGestureArray();
|
460
470
|
const useReanimatedHook = gesture.some(g => g.shouldUseReanimated); // store state in ref to prevent unnecessary renders
|
461
471
|
|
@@ -573,7 +583,7 @@ export const GestureDetector = props => {
|
|
573
583
|
|
574
584
|
onHandlersUpdate(true);
|
575
585
|
|
576
|
-
if (isFabric()) {
|
586
|
+
if (isFabric() && global.isFormsStackingContext) {
|
577
587
|
const node = getShadowNodeFromRef(ref);
|
578
588
|
|
579
589
|
if (global.isFormsStackingContext(node) === false) {
|