|
1 |
| -import { NavigationButton } from '@nativescript/core/ui/action-bar/action-bar'; |
2 |
| -import { EventData, Frame, View } from '@nativescript/core/ui/frame/frame'; |
| 1 | +import { NavigationButton, EventData, Frame, View, ObservableArray, StackLayout, Label, Builder } from '@nativescript/core'; |
3 | 2 | import { alert, AlertDialog, login, prompt } from '@nativescript-community/ui-material-dialogs';
|
4 |
| -import { ObservableArray } from '@nativescript/core/data/observable-array/observable-array'; |
5 |
| -const builder = require('@nativescript/core/ui/builder'); |
| 3 | + |
6 | 4 | // importing adds the View augmentation
|
7 | 5 | import { BottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';
|
8 |
| -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout/stack-layout'; |
9 | 6 | import { ActivityIndicator } from '@nativescript-community/ui-material-activityindicator';
|
10 |
| -import { Label } from '@nativescript/core/ui/label/label'; |
11 |
| -import { Button } from '@nativescript/core/ui/button/button'; |
12 | 7 |
|
13 | 8 | function getObjectClass(obj) {
|
14 | 9 | if (typeof obj !== 'object' || obj === null) return false;
|
@@ -82,9 +77,47 @@ class Model {
|
82 | 77 | }).then(result => console.log('login result', result));
|
83 | 78 | break;
|
84 | 79 | }
|
85 |
| - case 'bottomsheet1': { |
| 80 | + case 'bottomsheet1none': { |
| 81 | + obj.showBottomSheet({ |
| 82 | + view: 'examples/bottomsheetinner1-fragment', |
| 83 | + ignoreBottomSafeArea: false, |
| 84 | + ignoreTopSafeArea: false, |
| 85 | + context: {}, |
| 86 | + closeCallback: objId => { |
| 87 | + alert(`bottomsheet closed ${objId}`); |
| 88 | + } |
| 89 | + }); |
| 90 | + break; |
| 91 | + } |
| 92 | + case 'bottomsheet1top': { |
| 93 | + obj.showBottomSheet({ |
| 94 | + view: 'examples/bottomsheetinner1-fragment', |
| 95 | + ignoreBottomSafeArea: false, |
| 96 | + ignoreTopSafeArea: true, |
| 97 | + context: {}, |
| 98 | + closeCallback: objId => { |
| 99 | + alert(`bottomsheet closed ${objId}`); |
| 100 | + } |
| 101 | + }); |
| 102 | + break; |
| 103 | + } |
| 104 | + case 'bottomsheet1bottom': { |
| 105 | + obj.showBottomSheet({ |
| 106 | + view: 'examples/bottomsheetinner1-fragment', |
| 107 | + ignoreBottomSafeArea: true, |
| 108 | + ignoreTopSafeArea: false, |
| 109 | + context: {}, |
| 110 | + closeCallback: objId => { |
| 111 | + alert(`bottomsheet closed ${objId}`); |
| 112 | + } |
| 113 | + }); |
| 114 | + break; |
| 115 | + } |
| 116 | + case 'bottomsheet1both': { |
86 | 117 | obj.showBottomSheet({
|
87 | 118 | view: 'examples/bottomsheetinner1-fragment',
|
| 119 | + ignoreBottomSafeArea: true, |
| 120 | + ignoreTopSafeArea: true, |
88 | 121 | context: {},
|
89 | 122 | closeCallback: objId => {
|
90 | 123 | alert(`bottomsheet closed ${objId}`);
|
@@ -118,6 +151,62 @@ class Model {
|
118 | 151 | });
|
119 | 152 | break;
|
120 | 153 | }
|
| 154 | + case 'bottomsheet4none': { |
| 155 | + obj.showBottomSheet({ |
| 156 | + view: 'examples/bottomsheetinner4-fragment', |
| 157 | + trackingScrollView: 'webview', |
| 158 | + dismissOnDraggingDownSheet: false, |
| 159 | + ignoreBottomSafeArea: false, |
| 160 | + ignoreTopSafeArea: false, |
| 161 | + context: {}, |
| 162 | + closeCallback: objId => { |
| 163 | + alert(`bottomsheet closed ${objId}`); |
| 164 | + } |
| 165 | + }); |
| 166 | + break; |
| 167 | + } |
| 168 | + case 'bottomsheet4top': { |
| 169 | + obj.showBottomSheet({ |
| 170 | + view: 'examples/bottomsheetinner4-fragment', |
| 171 | + trackingScrollView: 'webview', |
| 172 | + dismissOnDraggingDownSheet: false, |
| 173 | + ignoreBottomSafeArea: false, |
| 174 | + ignoreTopSafeArea: true, |
| 175 | + context: {}, |
| 176 | + closeCallback: objId => { |
| 177 | + alert(`bottomsheet closed ${objId}`); |
| 178 | + } |
| 179 | + }); |
| 180 | + break; |
| 181 | + } |
| 182 | + case 'bottomsheet4bottom': { |
| 183 | + obj.showBottomSheet({ |
| 184 | + view: 'examples/bottomsheetinner4-fragment', |
| 185 | + trackingScrollView: 'webview', |
| 186 | + dismissOnDraggingDownSheet: false, |
| 187 | + ignoreBottomSafeArea: true, |
| 188 | + ignoreTopSafeArea: false, |
| 189 | + context: {}, |
| 190 | + closeCallback: objId => { |
| 191 | + alert(`bottomsheet closed ${objId}`); |
| 192 | + } |
| 193 | + }); |
| 194 | + break; |
| 195 | + } |
| 196 | + case 'bottomsheet4both': { |
| 197 | + obj.showBottomSheet({ |
| 198 | + view: 'examples/bottomsheetinner4-fragment', |
| 199 | + trackingScrollView: 'webview', |
| 200 | + dismissOnDraggingDownSheet: false, |
| 201 | + ignoreBottomSafeArea: true, |
| 202 | + ignoreTopSafeArea: true, |
| 203 | + context: {}, |
| 204 | + closeCallback: objId => { |
| 205 | + alert(`bottomsheet closed ${objId}`); |
| 206 | + } |
| 207 | + }); |
| 208 | + break; |
| 209 | + } |
121 | 210 | case 'alertdialog':
|
122 | 211 | const stack = new StackLayout();
|
123 | 212 | stack.orientation = 'horizontal';
|
@@ -171,10 +260,10 @@ export function onNavigatingTo(args) {
|
171 | 260 | // some-fragment.xml registered via bundle-config.ts, because it's postfixed with "fragment"
|
172 | 261 | // so it already exist in bundle.js as module
|
173 | 262 | console.log('loading xml', `./${exampleTitle}-fragment.xml`);
|
174 |
| - innerComponent = builder.parse(require(`./${exampleTitle}-fragment.xml`) as string, theModule); |
| 263 | + innerComponent = Builder.parse(require(`./${exampleTitle}-fragment.xml`) as string, theModule); |
175 | 264 | } else {
|
176 | 265 | console.log('loading xml', `${__dirname}/${exampleTitle}-fragment.xml`);
|
177 |
| - innerComponent = builder.load(`${__dirname}/${exampleTitle}-fragment.xml`, theModule); |
| 266 | + innerComponent = Builder.load(`${__dirname}/${exampleTitle}-fragment.xml`, theModule); |
178 | 267 | }
|
179 | 268 |
|
180 | 269 | container.addChild(innerComponent);
|
|
0 commit comments