native

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Copyright (c) 2025 Reliant Labs

Package native embeds the React Native component primitives that ship in `@<scope>/ui-native`. Distinct from the sibling `components` package which embeds the web (Tailwind/DOM) library — RN primitives are useless on the web (Tailwind class names mean nothing to a <View>) and DOM components are useless on RN, so the two libraries stay in separate packages with no overlap in registry.

Surface is deliberately small (~10 primitives). For anything bigger (data tables, sidebars, complex layouts) the answer on native is a real design system — Tamagui or Unistyles — not more primitives hand-rolled here. See the `ui-native-package` skill for the reasoning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Library

type Library struct{}

Library is the RN counterpart to components.Library. Kept as a distinct type so callers that statically depend on "the native library" don't accidentally pick up DOM components.

func NewLibrary

func NewLibrary() *Library

NewLibrary returns a Library handle. Stateless — the underlying registry lives in package globals.

func (*Library) Get

func (l *Library) Get(name string) (string, error)

Get returns the source code for a primitive by name.

func (*Library) GetEntry

func (l *Library) GetEntry(name string) (*Primitive, bool)

GetEntry returns the metadata for a primitive by name.

func (*Library) IndexBarrel

func (l *Library) IndexBarrel() string

IndexBarrel renders the canonical `src/index.ts` re-export barrel for the package. Generated rather than embedded so the export list always stays in lockstep with the primitive registry — adding a new primitive to `primitives` automatically picks it up in the barrel.

func (*Library) Primitives

func (l *Library) Primitives() []Primitive

Primitives returns the full list of RN primitives.

func (*Library) Tokens

func (l *Library) Tokens() (string, error)

Tokens returns the source of `tokens.ts`. Lives alongside the primitives in the same embed.FS but isn't a "primitive" in the catalogue sense — it's a single sibling file with no variants.

type Primitive

type Primitive struct {
	// Name is the kebab-cased file stem (e.g. "button", "safe-area-view").
	Name string `json:"name"`
	// Description is a one-line summary for documentation generation.
	Description string `json:"description"`
	// FilePath is the embed-relative path to the .tsx source.
	FilePath string `json:"-"`
}

Primitive describes a single React Native primitive shipped by the library. Mirrors the shape of components.Entry but with a flatter schema — there are no categories yet, only primitives.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL