npm i --save preact-to-nativescript
- Version: 0.0.9
- GitHub: https://github.com/hizoul/preact-to-nativescript
- NPM: https://www.npmjs.com/package/preact-to-nativescript
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
preact-to-nativescript
This Library is experimental!
Documentation
Usage
The following is assumed to be executed at the project root of a NativeScript project
- Install the library
npm i preact-to-nativescript
- 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"}, [])])]))
}
})
- Run your NativeScript app
Demo Application
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
- Document and enable usage / registration of plugin components
- probably more that isn't in scope yet
Credits
- developit by providing this untested document implementation that turned into the core of this library. He also authored undom from which some document mock code was borrowed. And he also authored preact without which this wouldn't even be possible.
- staydecent for providing a code example that showed that preact-to-nativescript is not impossible wizardry but achievable by writing the right wrapper