forked from halfnelson/svelte-native
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNav.ts
More file actions
30 lines (24 loc) · 759 Bytes
/
Nav.ts
File metadata and controls
30 lines (24 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { navigate } from '@nativescript-community/svelte-native'
import { writable } from 'svelte/store'
import RadSideDrawerElement from '@nativescript-community/svelte-native-nativescript-ui/sidedrawer';
import { Trace } from '@nativescript/core'
export let current_page = writable(null);
let nav_frame;
let drawer: RadSideDrawerElement;
export function init(navFrame, navDrawer: RadSideDrawerElement, startPage) {
nav_frame = navFrame;
drawer = navDrawer;
current_page.set(startPage)
}
export function goto(view, props) {
current_page.set(view);
navigate({
page: view,
props: props,
clearHistory: true,
frame: nav_frame
});
}
export function toggleDrawer() {
drawer.toggleDrawerState();
}