0.0.4-alpha.1 • Published 1 year ago

@dominative/solid v0.0.4-alpha.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

DOMiNATIVE-Solid

Custom render and patches for SolidJS to work with DOMiNATIVE on NativeScript

Playground


Installation

Via npm:

npm install @dominative/solid dominative undom-ng solid-js

Note: dominative, undom-ng, solid-js are peer dependencies, you have to install them manually.


Usage

import { Application } from "@nativescript/core"
import { render } from "@dominative/solid"
import { createSignal } from "solid-js"

const App = () => {
	const [count, setCount] = createSignal(0)
	const increment = () => {
		setCount(c => c + 1)
	}
	return <>
	<actionbar title="Hello, SolidJS!"></actionbar>
	<stacklayout>
		<label>You have taapped {count()} time(s)</label>
		<button class="-primary" on:tap={increment}>Tap me!</button>
	</stacklayout>
	</>
}

const create = () => {
	render(App, document.documentElement)
	return document
}

Application.run({ create })

Caveats

Event handling

Use on:raw-EventName and oncapture:RawEvent-Name to register event handlers instead of on___. It may be a little annoying, but NativeScript uses case sensitive event names and don't have native event bubbling, which means delegation couldn't function.

To enable capture and bubble phase of an event, please refer to this doc

License

MIT