A home for Preact on native iOS and Android.
Status: Experimental prototype · Documentation · MIT License
NativeScript Preact is an independent community integration of Preact with NativeScript. Write JSX and use Preact state to update real native UI components on iOS and Android. No WebView.
The first prototype includes four typed components: Page, StackLayout, Label, and Button. The demo has a counter, a reset action, and conditional mounting. Rendering uses the original Preact 11.0.1 through a small DOM-compatible adapter backed by NativeScript views.
This is an experiment, not a production release. There is no published package yet. Navigation, modals, lists, inputs, inline styles, and HMR are not supported by this prototype.
Use Node.js 22, npm, the NativeScript CLI, and a configured native development environment. iOS requires macOS and Xcode.
git clone https://github.com/getcortexlabs/nativescript-preact.git
cd nativescript-preact
npm ci
npm run build
cd demo
npm ci
ns run android --no-hmrFor iOS, run ns run ios --no-hmr from demo. Rebuild the root package after changing the adapter. The demo resolves it locally through file:...
import { useState } from 'preact/hooks';
import { Button, Label, Page, run, StackLayout } from 'nativescript-preact';
function App() {
const [count, setCount] = useState(0);
return (
<Page actionBarHidden>
<StackLayout>
<Label text={`Count: ${count}`} />
<Button text="Add one" onTap={() => setCount(value => value + 1)} />
</StackLayout>
</Page>
);
}
run(<App />);See the prototype guide for supported properties, events, and limitations.
Read the project documentation for the introduction, design goals, current status, and roadmap.
The website source lives in docs. To work on it locally, see the contribution guide.
- Expand native component and property coverage.
- Validate more component and native lifecycle interactions.
- Explore native navigation and development tooling.
Ideas, use cases, and documentation improvements are welcome. Start with the contribution guide or open an issue to join the discussion.
Supported by Cortex Labs.
MIT © 2026 Rafael Augusto.
