Repository navigation
v2.0.0
Solid 2.0 support for NativeScript. Requires solid-js 2.x; stay on 0.1.x for Solid 1.8–1.9.
Breaking changes
- Peer dependencies are now
solid-js@^2.0.0,@solidjs/universal@^2.0.0, and@solidjs/babel-plugin@^2.0.0.babel-preset-solidis no longer used.npm install @nativescript-community/solid-js@^2 solid-js@^2 @solidjs/universal@^2 npm install -D @solidjs/babel-plugin@^2 npm uninstall babel-preset-solid solid-refresh
- The renderer is built on
@solidjs/universal;solid-js/universalno longer exists in Solid 2. useis no longer exported. Solid 2 removeduse:directives; pass a ref instead, e.g.ref={myDirective(options)}. Refs can be arrays.spread()drops itsisSVGargument, andeffect()takes Solid 2's two-phase(compute, apply)form. Both only matter if you call the renderer directly.- The webpack config no longer registers
solid-refresh. It has no Solid 2 release; NativeScript's own HMR still replaces modules.
Features
- Re-exports Solid 2 control flow:
For,Repeat,Show,Switch,Match,Loading,Reveal,Errored. - New
refandapplyRefexports for Solid 2's compiled refs. createElementapplies the static props the compiler hoists.- Each compiled insertion point gets its own anchor, so sibling blocks keep source order when one of them renders empty.
Build
nativescript.webpack.jscompiles with@solidjs/babel-plugin(generate: 'universal',hydratable: false).solid-js,@solidjs/signals, and@solidjs/universalare pinned to their browser bundles. Solid 2 resolves thenodecondition to its SSR build, which renders once and never updates.- The
@NativeClasstransform loadstypescriptonly when it runs, so JavaScript-only apps build without it.
Migrating an app
See the README's Upgrading from Solid 1.x section. In short: Suspense → Loading, ErrorBoundary → Errored, SuspenseList → Reveal, <Index> → <For keyed={false}>, onMount → onSettled, and solid-js/store is merged into solid-js. Event handlers keep the on: / oncapture: prefixes.
Full changelog: v0.1.2...v2.0.0 (#16)