Skip to content
Render preact-Components to NativeScript
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
docs
.babelrc
.eslintrc.js
.gitignore
.npmignore
.travis.yml
README.md
changelog.md
index.d.ts
index.js
package-lock.json
package.json
preact.js

README.md

preact-to-nativescriptBuild Status Coverage Status dependencies npm

This Library is experimental!

Documentation

Usage

The following is assumed to be executed at the project root of a NativeScript project

  1. Install the library
npm i preact-to-nativescript
  1. Adjust your NativeScript app.js
var application = require("application")
var preactToNativeScript = require("preact-to-nativescript")
var render = preactToNativeScript.render
var h = preactToNativeScript.Preact.h

application.start({
  create: () => {
    return render(h("page", {}, [h("actionBar", {title: "Custom Title"}), h("stackLayout", {}, [h("label", {text: "preact-to-nativescript page"}, [])])]))
  }
})
  1. Run your NativeScript app

Demo Application

Demo

TBD

  • dont ship own preact version
  • Handle unmounting properly when navigating via Nativescripts API (custom routing in pure js works fine though!)
  • ActionBar Known Limitations
    • SystemIcon is not respected
    • NavigationButton doesn't properly render
  • probably more that isn't in scope yet

Credits

You can’t perform that action at this time.