@nativescript-community/ui-drawer 0.0.34 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -0
- package/index.d.ts +2 -0
- package/index.js +8 -7
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [0.1.1](https://github.com/nativescript-community/ui-drawer/compare/v0.1.0...v0.1.1) (2022-05-12)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-drawer
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
# [0.1.0](https://github.com/nativescript-community/ui-drawer/compare/v0.0.35...v0.1.0) (2022-05-03)
|
15
|
+
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* allow `gestureHandlerOptions` to customize gesture handler ([6ba74c2](https://github.com/nativescript-community/ui-drawer/commit/6ba74c21cf8f96b05a4a030a049c96d606285aa2))
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## [0.0.35](https://github.com/nativescript-community/ui-drawer/compare/v0.0.34...v0.0.35) (2022-04-14)
|
26
|
+
|
27
|
+
**Note:** Version bump only for package @nativescript-community/ui-drawer
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
6
33
|
## [0.0.34](https://github.com/nativescript-community/ui-drawer/compare/v0.0.33...v0.0.34) (2022-04-11)
|
7
34
|
|
8
35
|
|
package/README.md
CHANGED
@@ -99,6 +99,7 @@ install();
|
|
99
99
|
| leftDrawerMode | `slide` | `Mode ('under' or 'slide')` | The color of the backdrop behind the drawer |
|
100
100
|
| rightDrawerMode | `slide` | `Mode ('under' or 'slide')` | The color of the backdrop behind the drawer |
|
101
101
|
| gestureMinDist | `10` | number | The min "swipe" distance to trigger the menu gesture |
|
102
|
+
| gestureHandlerOptions | `null` | PanGestureHandlerOptions | Options to customize the pan gesture handler |
|
102
103
|
| leftSwipeDistance | `40` | number | The "left" zone size from where the gesture is recognized |
|
103
104
|
| rightSwipeDistance | `40` | number | The "right" zone size from where the gesture is recognized |
|
104
105
|
| topSwipeDistance | `40` | number | The "top" zone size from where the gesture is recognized |
|
package/index.d.ts
CHANGED
@@ -27,6 +27,7 @@ export declare class Drawer extends GridLayout {
|
|
27
27
|
mainContent: View;
|
28
28
|
backDrop: View;
|
29
29
|
gestureMinDist: number;
|
30
|
+
gestureHandlerOptions: any;
|
30
31
|
waitFor: any[];
|
31
32
|
simultaneousHandlers: any[];
|
32
33
|
shouldStartSheetDragging?: (side: Side | VerticalSide) => boolean;
|
@@ -46,6 +47,7 @@ export declare class Drawer extends GridLayout {
|
|
46
47
|
topClosedDrawerAllowDraging: boolean;
|
47
48
|
panGestureHandler: PanGestureHandler;
|
48
49
|
gestureEnabled: boolean;
|
50
|
+
backdropTapGestureEnabled: boolean;
|
49
51
|
private isPanning;
|
50
52
|
private isAnimating;
|
51
53
|
private prevDeltaX;
|
package/index.js
CHANGED
@@ -87,6 +87,7 @@ let Drawer = class Drawer extends GridLayout {
|
|
87
87
|
this.bottomClosedDrawerAllowDraging = true;
|
88
88
|
this.topClosedDrawerAllowDraging = true;
|
89
89
|
this.gestureEnabled = true;
|
90
|
+
this.backdropTapGestureEnabled = true;
|
90
91
|
this.isPanning = false;
|
91
92
|
this.isAnimating = false;
|
92
93
|
this.prevDeltaX = 0;
|
@@ -105,16 +106,13 @@ let Drawer = class Drawer extends GridLayout {
|
|
105
106
|
this.insertChild(this.backDrop, 0);
|
106
107
|
}
|
107
108
|
onBackdropTap() {
|
108
|
-
this.
|
109
|
+
if (this.backdropTapGestureEnabled) {
|
110
|
+
this.close();
|
111
|
+
}
|
109
112
|
}
|
110
113
|
initGestures() {
|
111
114
|
const manager = Manager.getInstance();
|
112
|
-
const gestureHandler = manager.createGestureHandler(HandlerType.PAN, PAN_GESTURE_TAG, {
|
113
|
-
shouldStartGesture: this.shouldStartGesture.bind(this),
|
114
|
-
simultaneousHandlers: this.simultaneousHandlers,
|
115
|
-
waitFor: this.waitFor,
|
116
|
-
minDist: this.gestureMinDist
|
117
|
-
});
|
115
|
+
const gestureHandler = manager.createGestureHandler(HandlerType.PAN, PAN_GESTURE_TAG, Object.assign({ shouldStartGesture: this.shouldStartGesture.bind(this), simultaneousHandlers: this.simultaneousHandlers, waitFor: this.waitFor, minDist: this.gestureMinDist }, (this.gestureHandlerOptions || {})));
|
118
116
|
gestureHandler.on(GestureHandlerTouchEvent, this.onGestureTouch, this);
|
119
117
|
gestureHandler.on(GestureHandlerStateEvent, this.onGestureState, this);
|
120
118
|
gestureHandler.attachToView(this);
|
@@ -766,6 +764,9 @@ let Drawer = class Drawer extends GridLayout {
|
|
766
764
|
return;
|
767
765
|
}
|
768
766
|
}
|
767
|
+
if (this.showingSide && this.showingSide !== side) {
|
768
|
+
this.close();
|
769
|
+
}
|
769
770
|
if (!this.isOpened(side)) {
|
770
771
|
this.forceEnsureSize(side);
|
771
772
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-drawer",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.1.1",
|
4
4
|
"description": "Easily add a side drawer (side menu) to your projects.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"license": "Apache-2.0",
|
53
53
|
"readmeFilename": "README.md",
|
54
54
|
"dependencies": {
|
55
|
-
"@nativescript-community/gesturehandler": "^2.0.
|
55
|
+
"@nativescript-community/gesturehandler": "^2.0.5"
|
56
56
|
},
|
57
|
-
"gitHead": "
|
57
|
+
"gitHead": "e4f63bef53edc1e7e0f1ec9c5195677cac46f552"
|
58
58
|
}
|