nativescript-preact
by staydecent | v0.0.3
Native mobile applications using Preact and NativeScript.
npm i --save nativescript-preact

NativeScript Preact

This plugin integrates Preact and NativeScript, allowing you to build cross-platform iOS and Android apps using Preact.

Why? Because I prefer the (P)React pattern of building UIs over what Angular offers, and find that NativeScript has several technical advantages over ReactNative.

Getting Started

A proper template repo and documentation is needed. For now, you can copy the demo-app folder from this repo as a starting point.

This is Alpha Software!

This is a very early working example, and should not be used for a production app unless you really know what you're doing. I hope to build a side-project using this as well as add unit tests for all NativeScript components.

How it Works

This was made possible by undom library, allowing Preact to rending into a pure JavaScript DOM, within the NativeScript runtime. Currently, I'm shipping a modified undom with basic MutationObserver API implemented which is what nativescript-preact uses to sync changes from the DOM to the NativeScript widgets. I aimed to keep this code generalized (and hopefully small), so the bridge code is easier to maintain and less prone to bugs.

Get Involved!

File issues! Feel free to post questions as issues here or look for the #preact channel on the NativeScript Slack Community.