1
- # NativeScript Drawer
1
+ # NativeScript BottomSheet
2
2
3
- NativeScript plugin that allows you to easily add a side drawer (side menu) to your projects. This can be used as an Open Source alternative to [ RadSideDrawer ] ( https://docs.nativescript.org/ui/components/sidedrawer/overview ) .
3
+ NativeScript plugin that allows you to easily add persistent bottomsheet to your projects.
4
4
5
5
[ ![ npm] ( https://img.shields.io/npm/v/@nativescript-community/ui-persistent-bottomsheet.svg )] ( https://www.npmjs.com/package/@nativescript-community/ui-persistent-bottomsheet )
6
6
[ ![ npm downloads] ( https://img.shields.io/npm/dm/@nativescript-community/ui-persistent-bottomsheet.svg )] ( https://www.npmjs.com/package/@nativescript-community/ui-persistent-bottomsheet )
7
7
[ ![ npm downloads] ( https://img.shields.io/npm/dt/@nativescript-community/ui-persistent-bottomsheet.svg )] ( https://www.npmjs.com/package/@nativescript-community/ui-persistent-bottomsheet )
8
8
9
- | <img src =" https://i.imgur.com/3MCog2g.gif " height =" 500 " /> | <img src =" https://i.imgur.com/t3v8tQP.gif " height =" 500 " /> |
10
- | --- | ----------- |
11
- | iOS Demo | Android Demo |
12
-
13
9
---
14
10
## Table of Contents
15
11
1 . [ Installation] ( #installation )
@@ -41,34 +37,29 @@ install();
41
37
42
38
| Property | Default | Type | Description |
43
39
| ------------------- | --------------------------------- | --------------------------- | ------------------------------------------------------- |
44
- | leftDrawer | ` undefined ` | ` View ` | View containing the content for the left side drawer |
45
- | rightDrawer | ` undefined ` | ` View ` | View containing the content for the right side drawer |
46
- | mainContent | ` undefined ` | ` View ` | View containing the main content of the app |
47
- | gestureEnabled | ` true ` | ` boolean ` | Boolean setting if swipe gestures are enabled |
48
- | backdropColor | ` new Color('rgba(0, 0, 0, 0.7)') ` | ` Color ` | The color of the backdrop behind the drawer |
49
- | leftDrawerMode | ` slide ` | ` Mode ('under' or 'slide') ` | The color of the backdrop behind the drawer |
50
- | rightDrawerMode | ` slide ` | ` Mode ('under' or 'slide') ` | The color of the backdrop behind the drawer |
40
+ | bottomSheet | ` undefined ` | ` View ` | View containing the content for the bottomsheet |
41
+ | gestureEnabled | ` true ` | ` boolean ` | Boolean setting if swipe gestures are enabled |
42
+ | stepIndex | ` 0 ` | ` number ` | the index of current step (mutable) |
43
+ | steps | ` [70] ` | ` number[] ` | the different available steps |
44
+ | backdropColor | ` new Color('rgba(0, 0, 0, 0.7)') ` | ` Color ` | The color of the backdrop behind the drawer |
51
45
52
46
53
47
54
48
### Methods
55
49
56
50
| Name | Return | Description |
57
51
| ------------ | ------ | ----------------------------------------------- |
58
- | open() | ` void ` | Programatically open the drawer |
59
- | close() | ` void ` | Programatically close the drawer |
60
- | toggle() | ` void ` | Programatically toggle the state of the drawer |
61
52
| install() | ` void ` | Install gestures |
62
53
63
54
## Usage in Angular
64
55
Import the module into your project.
65
56
66
57
``` typescript
67
- import { DrawerModule } from " @nativescript-community/ui-persistent-bottomsheet/angular" ;
58
+ import { PBSModule } from " @nativescript-community/ui-persistent-bottomsheet/angular" ;
68
59
69
60
@NgModule ({
70
61
imports: [
71
- DrawerModule
62
+ PBSModule
72
63
]
73
64
schemas : [
74
65
NO_ERRORS_SCHEMA
@@ -81,15 +72,16 @@ export class AppModule { }
81
72
Then in your component add the following:
82
73
83
74
``` xml
84
- <Drawer >
85
- <GridLayout leftDrawer backgroundColor =" white" >
75
+ <BottomSheet >
76
+ <StackLayout backgroundColor =" white" >
77
+ <Label text =" This is the main content" ></Label >
78
+ </StackLayout >
79
+ <GridLayout bottomSheet backgroundColor =" white" height =" 70" >
86
80
<Label text =" This is the side drawer content" ></Label >
87
81
</GridLayout >
88
82
89
- <StackLayout mainContent backgroundColor =" white" >
90
- <Label text =" This is the main content" ></Label >
91
- </StackLayout >
92
- </Drawer >
83
+
84
+ </BottomSheet >
93
85
```
94
86
For a more complete example, look in the ` demo-ng ` directory.
95
87
@@ -98,22 +90,22 @@ For a more complete example, look in the `demo-ng` directory.
98
90
Register the plugin in your ` app.js ` .
99
91
100
92
``` typescript
101
- import DrawerPlugin from ' ~/components/drawer/vue' ;
102
- Vue .use (DrawerPlugin );
93
+ import BottomSheetPlugin from ' ~/components/drawer/vue' ;
94
+ Vue .use (BottomSheetPlugin );
103
95
```
104
96
105
97
Then in your component add the following:
106
98
107
99
``` xml
108
- <Drawer >
109
- <GridLayout ~leftDrawer backgroundColor =" white" >
100
+ <BottomSheet >
101
+ <StackLayout backgroundColor =" white" >
102
+ <Label text =" This is the main content" />
103
+ </StackLayout >
104
+ <GridLayout ~bottomSheet backgroundColor =" white" height =" 70" >
110
105
<Label text =" This is the side drawer content" />
111
106
</GridLayout >
112
107
113
- <StackLayout ~mainContent backgroundColor =" white" >
114
- <Label text =" This is the main content" />
115
- </StackLayout >
116
- </Drawer >
108
+ </BottomSheet >
117
109
```
118
110
For a more complete example, look in the ` demo-vue ` directory.
119
111
@@ -122,22 +114,22 @@ For a more complete example, look in the `demo-vue` directory.
122
114
Register the plugin in your ` app.ts ` .
123
115
124
116
``` typescript
125
- import DrawerElement from ' @nativescript-community/ui-persistent-bottomsheet/svelte' ;
126
- DrawerElement .register ();
117
+ import BottomSheetElement from ' @nativescript-community/ui-persistent-bottomsheet/svelte' ;
118
+ BottomSheetElement .register ();
127
119
```
128
120
129
121
Then in your component, add the following:
130
122
131
123
``` xml
132
- <drawer >
133
- <gridlayout prop:leftDrawer backgroundColor =" white" >
124
+ <bottomsheet >
125
+ <stacklayout backgroundColor =" white" >
126
+ <Label text =" This is the main content" />
127
+ </stacklayout >
128
+ <gridlayout prop:bottomSheet backgroundColor =" white" height =" 70" >
134
129
<Label text =" This is the side drawer content" />
135
130
</gridlayout >
136
131
137
- <stacklayout prop:mainContent backgroundColor =" white" >
138
- <Label text =" This is the main content" />
139
- </stacklayout >
140
- </drawer >
132
+ </bottomsheet >
141
133
```
142
134
For a more complete example, look in the ` demo-svelte ` directory.
143
135
@@ -146,25 +138,25 @@ For a more complete example, look in the `demo-svelte` directory.
146
138
Register the plugin in your ` app.ts ` .
147
139
148
140
``` typescript
149
- import DrawerElement from ' @nativescript-community/ui-persistent-bottomsheet/react' ;
150
- DrawerElement .register ();
141
+ import BottomSheetElement from ' @nativescript-community/ui-persistent-bottomsheet/react' ;
142
+ BottomSheetElement .register ();
151
143
```
152
144
153
145
Then in your component, add the following:
154
146
``` ts
155
- import { Drawer } from " @nativescript-community/ui-persistent-bottomsheet/react"
147
+ import { BottomSheet } from " @nativescript-community/ui-persistent-bottomsheet/react"
156
148
```
157
149
158
150
``` xml
159
- <Drawer >
160
- <gridLayout nodeRole =" leftDrawer" backgroundColor =" white" width =" 300" >
151
+ <BottomSheet >
152
+ <stackLayout backgroundColor =" white" >
153
+ <label text =" This is the main content" />
154
+ </stackLayout >
155
+ <gridLayout nodeRole =" bottomSheet" backgroundColor =" white" height =" 70" >
161
156
<label text =" This is the side drawer content" />
162
157
</gridLayout >
163
158
164
- <stackLayout nodeRole =" mainContent" backgroundColor =" white" >
165
- <label text =" This is the main content" />
166
- </stackLayout >
167
- </Drawer >
159
+ </BottomSheet >
168
160
```
169
161
For a more complete example, look in the ` demo-react ` directory.
170
162
0 commit comments