JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1120
  • Score
    100M100P100Q104134F
  • License MIT

SolidJS to work with NativeScript

Package Exports

  • @nativescript-community/solid-js
  • @nativescript-community/solid-js/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nativescript-community/solid-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NativeScript SolidJS

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

Playground


Installation

Via npm:

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

Note: dominative, undom-ng, solid-js are peer dependencies, you have to install them manually. As the benefit for using peer dependencies, you'll be able to upgrade these dependencies directly from upstream, no need to wait for an update with @nativescript-community/solid-js


Usage

import { Application } from "@nativescript/core"
import { render } from "@nativescript-community/solid-js"
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.body)
    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