Skip to content

hmmhmmhm/svelte-native

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WIP proof of concept for wiring svelte 3 up to nativescript. based on the wonderful nativescript-vue.

App.html

<page xmlns="tns" actionBar="{ab ? ab.nativeView : null}">
    <actionBar bind:this="{ab}" title="Svelte Native"></actionBar>
    <stackLayout>
        <label text="{msg}"></label>
        <button text="hi" on:tap="{toggle}"></button>
    </stackLayout>
</page>

<script>
  export let msg = 'Hello World!'
  let ab;
  const toggle = () => {
      msg = "Hi from svelte"
  }
</script>

Main.ts

import App from './components/App.html';
import { DocumentNode } from 'svelte-native'
import { run, on, launchEvent } from 'tns-core-modules/application'
import { Frame } from 'tns-core-modules/ui/frame'
import { Page } from 'tns-core-modules/ui/page'
import { ActionBar } from 'tns-core-modules/ui/action-bar'

import { svelteNative } from 'svelte-native'

svelteNative(App, {msg: "Hi from launcher"});

About

Svelte controlling native components via Nativescript

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 33.6%
  • TypeScript 33.0%
  • HTML 28.6%
  • CSS 4.7%
  • Other 0.1%