Skip to content

Commit 900f3f1

Browse files
committed
fix: angular demo almost working
1 parent d825ddd commit 900f3f1

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

demo-snippets/ng/basic/basic.component.html

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,28 @@
33
<Label text="Basic Drawer"></Label>
44
</ActionBar>
55

6-
<BottomSheet [(stepIndex)]="stepIndex" [steps]="[56, 156, 456]" scrollViewId="scrollView" backdropColor="#88000000">
6+
<BottomSheet [(stepIndex)]="stepIndex" [steps]="[56, 156, 456]" backdropColor="#88000000">
77
<StackLayout backgroundColor="red">
8-
<Label text="This is the main content" />
8+
<Label text="This is the main content"></Label>
99
</StackLayout>
10-
<gridlayout bottomSheet backgroundColor="yellow" rows="56, 100, 300">
11-
<stacklayout row="0" orientation="horizontal">
12-
<button text="My Profile" class="button" (tap)="stepIndex = 0" />
13-
<button text="Settings" class="button" (tap)="stepIndex = 1"/>
14-
<button text="Rate Us" class="button" (tap)="stepIndex = 2"/>
15-
<button text="Support" class="button" />
16-
<button text="Contact" class="button" />
17-
</stacklayout>
18-
<stacklayout row="1" orientation="horizontal">
19-
<button text="My Profile" class="button" />
20-
<button text="Settings" class="button" />
21-
<button text="Rate Us" class="button" />
22-
<button text="Support" class="button" />
23-
<button text="Contact" class="button" />
24-
</stacklayout>
25-
<ListView [items]="items" row="2" id="scrollView" colWidth="50%" rowHeight="100">
26-
<v-template>
27-
<gridlayout rows="*, auto" [backgroundColor]="item.color" class="item">
28-
<stacklayout row="1">
29-
<label row="1" :text="item.name" class="title" />
30-
<label row="1" :text="item.color" class="subtitle" />
31-
</stacklayout>
32-
</gridlayout>
33-
</v-template>
10+
<GridLayout bottomSheet backgroundColor="yellow" rows="56, 100, 300">
11+
<StackLayout row="0" orientation="horizontal">
12+
<Button text="Open Step 0" class="Button" (tap)="setIndex(0)"></Button>
13+
<Button text="Open Step 1" class="Button" (tap)="setIndex(1)"></Button>
14+
<Button text="Open Step 2" class="Button" (tap)="setIndex(2)"></Button>
15+
</StackLayout>
16+
<StackLayout row="1" backgroundColor="orange">
17+
<Label text="Second step section"></Label>
18+
</StackLayout>
19+
<ListView [items]="items" row="2" colWidth="50%" rowHeight="100">
20+
<ng-template let-item="item" let-i="index">
21+
<GridLayout rows="*, auto" class="item" [backgroundColor]="item.color">
22+
<StackLayout row="1">
23+
<Label row="1" [text]="item.name" class="title"></Label>
24+
<Label row="1" [text]="item.color" class="subtitle"></Label>
25+
</StackLayout>
26+
</GridLayout>
27+
</ng-template>
3428
</ListView>
35-
</gridlayout>
29+
</GridLayout>
3630
</BottomSheet>

demo-snippets/ng/basic/basic.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export class BasicComponent {
3232
{ index: 19, name: 'ASBESTOS', color: '#7f8c8d' }
3333
];
3434

35+
setIndex(index: number) {
36+
this.stepIndex = index;
37+
}
38+
3539
goBack(): void {
3640
this.router.back();
3741
}

demo-snippets/ng/install.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
22

3-
import { PersistentBottomSheetComponent } from '@nativescript-community/ui-persistent-bottomsheet/angular';
3+
import { BottomSheetModule } from '@nativescript-community/ui-persistent-bottomsheet/angular';
44

55
import { BasicComponent } from './basic/basic.component';
66

77
export const COMPONENTS = [BasicComponent];
88
@NgModule({
9-
imports: [PersistentBottomSheetComponent],
10-
exports: [PersistentBottomSheetComponent],
9+
imports: [BottomSheetModule],
10+
exports: [BottomSheetModule],
1111
schemas: [NO_ERRORS_SCHEMA]
1212
})
1313
export class InstallModule {}

demo-snippets/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nativescript-community/template-snippet",
33
"version": "0.0.1",
44
"dependencies": {
5-
"@nativescript-community/ui-persistent-bottomsheet": "file:../packages/ui-persistent-bottomsheet",
6-
"@nativescript-community/gesturehandler": "^0.1.50"
5+
"@nativescript-community/gesturehandler": "^0.1.50",
6+
"@nativescript-community/ui-persistent-bottomsheet": "file:../packages/ui-persistent-bottomsheet"
77
}
88
}

src/ui-persistent-bottomsheet/angular/module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ export class BottomSheetComponent {
4747
}
4848

4949
set stepIndex(value) {
50-
this._stepIndex = value;
51-
this.pbs.stepIndex = this._stepIndex;
50+
if (!isNaN(value)) {
51+
this._stepIndex = value;
52+
this.pbs.stepIndex = this._stepIndex;
53+
}
5254
}
5355
@Input()
5456
get backdropColor() {

0 commit comments

Comments
 (0)