File tree Expand file tree Collapse file tree 7 files changed +154
-4
lines changed Expand file tree Collapse file tree 7 files changed +154
-4
lines changed Original file line number Diff line number Diff line change 12
12
},
13
13
"dependencies" : {
14
14
"@akylas/nativescript" : " ^8.5.2" ,
15
- "@vallemar/nativescript-vueuse" : " ^0.0.8 " ,
15
+ "@vallemar/nativescript-vueuse" : " ^0.0.9 " ,
16
16
"nativescript-vue" : " 3.0.0-beta.8"
17
17
},
18
18
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { StackLayout } from "@nativescript/core";
6
6
import ElementSizeView from " ~/components/ElementSizeView.vue" ;
7
7
import ColorModeView from " ~/components/ColorModeView.vue" ;
8
8
import EventListenerComponent from " ~/components/EventListenerComponent.vue" ;
9
+ import RootLayoutView from ' ./rootLayout/RootLayoutView.vue' ;
9
10
10
11
function onUseElementSize() {
11
12
$navigateTo (ElementSizeView )
@@ -18,6 +19,10 @@ function onUseEventListener() {
18
19
$navigateTo (EventListenerComponent )
19
20
}
20
21
22
+ function onUseRootLayout() {
23
+ $navigateTo (RootLayoutView )
24
+ }
25
+
21
26
</script >
22
27
23
28
<template >
@@ -26,9 +31,10 @@ function onUseEventListener() {
26
31
<StackLayout ref =" test" class =" px-4" >
27
32
<Label text =" NativeScript-VueUse APP" class =" text-2xl font-bold mt-3" />
28
33
29
- <Button @tap =" onUseElementSize" text =" UseElementSize" class =" mt-12 m-1" ></Button >
30
- <Button @tap =" onUseColorMode" text =" UseColorMode" class =" mt-8 m-1" ></Button >
31
- <Button @tap =" onUseEventListener" text =" UseEventListener" class =" mt-8 m-1" ></Button >
34
+ <Button @tap =" onUseElementSize" text =" Use Element Size" class =" mt-12 m-1" ></Button >
35
+ <Button @tap =" onUseColorMode" text =" Use Color Mode" class =" mt-8 m-1" ></Button >
36
+ <Button @tap =" onUseEventListener" text =" Use Event Listener" class =" mt-8 m-1" ></Button >
37
+ <Button @tap =" onUseRootLayout" text =" Use Root Layout" class =" mt-8 m-1" ></Button >
32
38
</StackLayout >
33
39
</Page >
34
40
</Frame >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <GridLayout rows =" auto, auto" verticalAlignment =" bottom" height =" 455" class =" bg-white rounded-t-xl p-6 text-black" >
3
+ <Label row =" 0" class =" mt-8 text-2xl" text =" Hello 👋!" ></Label >
4
+ <Label row =" 1" class =" mt-8 text-lg" text =" I am a BottomSheet built with RootLayout 💪" textWrap =" true" ></Label >
5
+ </GridLayout >
6
+ </template >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <StackLayout verticalAlignment =" center" horizontalAlignment =" center" height =" 250" class =" p-4" >
3
+ <GridLayout rows =" auto, auto" class =" bg-white rounded-xl p-8 text-black" >
4
+ <Label row =" 0" class =" text-2xl" text =" Hello 👋!" ></Label >
5
+ <Label row =" 1" class =" mt-8 text-lg" text =" I am a Modal built with RootLayout 💪" textWrap =" true" ></Label >
6
+ </GridLayout >
7
+ </StackLayout >
8
+ </template >
Original file line number Diff line number Diff line change
1
+ <script lang="ts" setup>
2
+ import { ref , onMounted } from ' nativescript-vue'
3
+ import { useRootLayout } from ' @vallemar/nativescript-vueuse'
4
+ import BottomSheet from " ./BottomSheet.vue" ;
5
+ import Modal from ' ./Modal.vue' ;
6
+ import SideBar from ' ./SideBar.vue' ;
7
+ import SnackBar from ' ./SnackBar.vue' ;
8
+
9
+
10
+ const { show : showBottomSheet } = useRootLayout (BottomSheet , {
11
+ rootLayoutOption: {
12
+ shadeCover: {
13
+ color: ' #282C34' ,
14
+ opacity: 0.7 ,
15
+ tapToClose: true ,
16
+ },
17
+ animation: {
18
+ enterFrom: {
19
+ translateY: 500 ,
20
+ duration: 300 ,
21
+ },
22
+ exitTo: {
23
+ translateY: 500 ,
24
+ duration: 300 ,
25
+ },
26
+ },
27
+ },
28
+ onClose : () => {
29
+ console .log (" onClose BottomSheet" )
30
+ }
31
+ });
32
+
33
+ const { show : showModal } = useRootLayout (Modal , {
34
+ rootLayoutOption: {
35
+ shadeCover: {
36
+ color: ' #282C34' ,
37
+ opacity: 0.7 ,
38
+ tapToClose: true ,
39
+ },
40
+ animation: {
41
+ enterFrom: {
42
+ translateY: - 200 ,
43
+ duration: 300 ,
44
+ },
45
+ exitTo: {
46
+ translateY: - 200 ,
47
+ opacity: 0 ,
48
+ duration: 300 ,
49
+ },
50
+ },
51
+ },
52
+ onClose : () => {
53
+ console .log (" onClose Modal" )
54
+ }
55
+ });
56
+
57
+ const { show : showSideBar } = useRootLayout (SideBar , {
58
+ rootLayoutOption: {
59
+ shadeCover: {
60
+ color: ' #282C34' ,
61
+ opacity: 0.7 ,
62
+ tapToClose: true ,
63
+ },
64
+ animation: {
65
+ enterFrom: {
66
+ translateX: - 300 ,
67
+ duration: 300 ,
68
+ },
69
+ exitTo: {
70
+ translateX: - 300 ,
71
+ duration: 300 ,
72
+ },
73
+ },
74
+ },
75
+ onClose : () => {
76
+ console .log (" onClose SideBar" )
77
+ }
78
+ });
79
+ const { show : showSnackbar } = useRootLayout (SnackBar , {
80
+ rootLayoutOption: {
81
+ shadeCover: {
82
+ color: ' #282C34' ,
83
+ opacity: 0.7 ,
84
+ tapToClose: true ,
85
+ },
86
+ animation: {
87
+ enterFrom: {
88
+ translateY: - 300 ,
89
+ duration: 300 ,
90
+ },
91
+ exitTo: {
92
+ translateY: - 300 ,
93
+ duration: 300 ,
94
+ },
95
+ },
96
+ },
97
+ onClose : () => {
98
+ console .log (" onClose SnackBar" )
99
+ }
100
+ });
101
+ </script >
102
+
103
+ <template >
104
+ <Page actionBarHidden =" true" >
105
+ <RootLayout >
106
+ <StackLayout class =" p-3" >
107
+ <Label class =" text-center text-2xl" >RootLayout example</Label >
108
+ <Button @tap =" showBottomSheet" class =" mx-1 mt-8" text =" Open BottomSheet" ></Button >
109
+ <Button @tap =" showModal" class =" mx-1 mt-8" text =" Open Modal" ></Button >
110
+ <Button @tap =" showSideBar" class =" mx-1 mt-8" text =" Open Sidebar" ></Button >
111
+ <Button @tap =" showSnackbar" class =" mx-1 mt-8" text =" Open Snackbar" ></Button >
112
+
113
+ </StackLayout >
114
+ </RootLayout >
115
+ </Page >
116
+ </template >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <StackLayout height =" 100%" width =" 75%" class =" rounded-r-2xl bg-white pt-8 px-4 text-black" horizontalAlignment =" left" >
3
+ <Label row =" 0" class =" text-2xl" text =" Hello 👋!" ></Label >
4
+ <Label row =" 1" class =" mt-6 text-lg" text =" I am a Sidebar built with RootLayout 💪" textWrap =" true" ></Label >
5
+ </StackLayout >
6
+ </template >
7
+
Original file line number Diff line number Diff line change
1
+
2
+ <template >
3
+ <GridLayout rows =" auto, auto" class =" bg-white rounded-b-2xl p-6 text-black" verticalAlignment =" top" >
4
+ <Label row =" 0" class =" text-2xl" text =" Hello 👋!" ></Label >
5
+ <Label row =" 1" class =" mt-6 text-lg" text =" I am a Snackbar built with RootLayout 💪" textWrap =" true" ></Label >
6
+ </GridLayout >
7
+ </template >
You can’t perform that action at this time.
0 commit comments