Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as app from "tns-core-modules/application";
  2. import {parse} from "tns-core-modules/ui/builder";
  3. import {Frame, Page} from "tns-core-modules/ui/frame";
  4.  
  5. const frame = new Frame();
  6.  
  7. const page1 = <Page>parse(
  8.     `<Page><StackLayout><Button text="to Page 2" tap="{{ toPage2 }}"/></StackLayout></Page>`
  9. );
  10.  
  11. const page2 = <Page>parse(
  12. `
  13. <Page>
  14.     <StackLayout>
  15.         <Button text="to Page 1" tap="{{ toPage1 }}"/>
  16.         <TabView>
  17.             <TabViewItem title="First Tab">
  18.                 <StackLayout>
  19.                     <Label text="First Tab"/>
  20.                 </StackLayout>
  21.             </TabViewItem>
  22.             <TabViewItem title="Second Tab">
  23.                 <StackLayout>
  24.                     <Label text="Second Tab"/>
  25.                 </StackLayout>
  26.             </TabViewItem>
  27.         </TabView>
  28.     </StackLayout>
  29. </Page>`
  30. );
  31.  
  32. page1.bindingContext = {
  33.     toPage2: () => frame.navigate(() => page2)
  34. };
  35.  
  36. page2.bindingContext = {
  37.     toPage1: () => frame.navigate(() => page1)
  38. };
  39.  
  40. app.run({
  41.     create: () => {
  42.         frame.navigate(() => page1);
  43.         return frame
  44.     }
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement