跳到正文
cccskills
免费在 GitHub 公开

react-native

Build native mobile interfaces from JSON specifications with @json-render/react-native. Use standard or custom components, connect form inputs to application state, and update visible content in response to taps and other interactions.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

React Native renderer for json-render that turns JSON specs into native mobile UIs. Use when working with @json-render/react-native, building React Native UIs from JSON, creating mobile component catalogs, or rendering AI-generated specs on mobile.

查看安装方法

适用场景

  • Building mobile screens from JSON specifications
  • Connecting form inputs to application state
  • Switching tab content in response to taps
  • Defining custom mobile components for AI-generated screens

包含的文件(1)

  • SKILL.md6.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

@json-render/react-native

React Native renderer that converts JSON specs into native mobile component trees with standard components, data binding, visibility, actions, and dynamic props.

Quick Start

import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react-native/schema";
import {
  standardComponentDefinitions,
  standardActionDefinitions,
} from "@json-render/react-native/catalog";
import { defineRegistry, Renderer, type Components } from "@json-render/react-native";
import { z } from "zod";

// Create catalog with standard + custom components
const catalog = defineCatalog(schema, {
  components: {
    ...standardComponentDefinitions,
    Icon: {
      props: z.object({ name: z.string(), size: z.number().nullable(), color: z.string().nullable() }),
      slots: [],
      description: "Icon display",
    },
  },
  actions: standardActionDefinitions,
});

// Register only custom components (standard ones are built-in)
const { registry } = defineRegistry(catalog, {
  components: {
    Icon: ({ props }) => <Ionicons name={props.name} size={props.size ?? 24} />,
  } as Components<typeof catalog>,
});

// Render
function App({ spec }) {
  return (
    <StateProvider initialState={{}}>
      <VisibilityProvider>
        <ActionProvider handlers={{}}>
          <Renderer spec={spec} registry={registry} />
        </ActionProvider>
      </VisibilityProvider>
    </StateProvider>
  );
}

Standard Components

Layout

  • Container - wrapper with padding, background, border radius
  • Row - horizontal flex layout with gap, alignment
  • Column - vertical flex layout with gap, alignment
  • ScrollContainer - scrollable area (vertical or horizontal)
  • SafeArea - safe area insets for notch/home indicator
  • Pressable - touchable wrapper that triggers actions on press
  • Spacer - fixed or flexible spacing
  • Divider - thin line separator

Content

  • Heading - heading text (levels 1-6)
  • Paragraph - body text
  • Label - small label text
  • Image - image display with sizing modes
  • Avatar - circular avatar image
  • Badge - small status badge
  • Chip - tag/chip for categories

Input

  • Button - pressable button with variants
  • TextInput - text input field
  • Switch - toggle switch
  • Checkbox - checkbox with label
  • Slider - range slider
  • SearchBar - search input

Feedback

  • Spinner - loading indicator
  • ProgressBar - progress indicator

Composite

  • Card - card container with optional header
  • ListItem - list row with title, subtitle, accessory
  • Modal - bottom sheet modal

Visibility Conditions

Use visible on elements. Syntax: { "$state": "/path" }, { "$state": "/path", "eq": value }, { "$state": "/path", "not": true }, [ cond1, cond2 ] for AND.

Pressable + setState Pattern

Use Pressable with the built-in setState action for interactive UIs like tab bars:

{
  "type": "Pressable",
  "props": {
    "action": "setState",
    "actionParams": { "statePath": "/activeTab", "value": "home" }
  },
  "children": ["home-icon", "home-label"]
}

Dynamic Prop Expressions

Any prop value can be a data-driven expression resolved at render time:

  • { "$state": "/state/key" } - reads from state model (one-way read)
  • { "$bindState": "/path" } - two-way binding: use on the natural value prop (value, checked, pressed, etc.) of form components.
  • { "$bindItem": "field" } - two-way binding to a repeat item field. Use inside repeat scopes.
  • Nested lists use { "repeat": { "statePath": { "$item": "comments" } } } inside an enclosing repeat.
  • { "$cond": <condition>, "$then": <value>, "$else": <value> } - conditional value
{
  "type": "TextInput",
  "props": {
    "value": { "$bindState": "/form/email" },
    "placeholder": "Email"
  }
}

Components do not use a statePath prop for two-way binding. Use { "$bindState": "/path" } on the natural value prop instead.

Built-in Actions

The setState action is handled automatically by ActionProvider and updates the state model directly, which re-evaluates visibility conditions and dynamic prop expressions:

{ "action": "setState", "actionParams": { "statePath": "/activeTab", "value": "home" } }

Providers

ProviderPurpose
StateProviderShare state across components (JSON Pointer paths). Accepts optional store prop for controlled mode.
ActionProviderHandle actions dispatched from components
VisibilityProviderEnable conditional rendering based on state
ValidationProviderForm field validation

External Store (Controlled Mode)

Pass a StateStore to StateProvider (or JSONUIProvider / createRenderer) to use external state management:

import { createStateStore, type StateStore } from "@json-render/react-native";

const store = createStateStore({ count: 0 });

<StateProvider store={store}>{children}</StateProvider>

store.set("/count", 1); // React re-renders automatically

When store is provided, initialState and onStateChange are ignored.

Key Exports

ExportPurpose
defineRegistryCreate a type-safe component registry from a catalog
RendererRender a spec using a registry
schemaReact Native element tree schema
standardComponentDefinitionsCatalog definitions for all standard components
standardActionDefinitionsCatalog definitions for standard actions
standardComponentsPre-built component implementations
createStandardActionHandlersCreate handlers for standard actions
useStateStoreAccess state context
useStateValueGet single value from state
useBoundPropTwo-way state binding via $bindState/$bindItem
useStateBinding(deprecated) Legacy two-way binding by path
useActionsAccess actions context
useActionGet a single action dispatch function
useUIStreamStream specs from an API endpoint
createStateStoreCreate a framework-agnostic in-memory StateStore
StateStoreInterface for plugging in external state management

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

codegen

免费

Helps build custom code exporters from json-render UI specifications. Covers walking the UI tree, collecting components, state references, and actions, and formatting property values for JSX, the markup syntax used in React.

中文简介正在准备中。当前显示英语简介。

  • Build a custom exporter for Next.js or Remix
  • List components and actions used in a UI specification
  • Convert property values into JSX attributes
vercel-labs/json-render1.9万2026年10月14日 更新

core

免费

Define the structure and available components for AI-generated JSON screens or videos. Build generation prompts, process incremental updates, connect values to application state, and validate or repair definitions before passing them to a renderer.

中文简介正在准备中。当前显示英语简介。

  • Define allowed components for AI-generated screens
  • Build prompts for generating or editing JSON definitions
  • Assemble definitions from streamed AI responses
vercel-labs/json-render1.9万2026年10月14日 更新

devtools

免费

Debug json-render interfaces with an inspector panel that shows screen specifications, editable runtime state, action history, and streamed updates. Select a rendered page element to locate its definition and investigate display or interaction problems.

中文简介正在准备中。当前显示英语简介。

  • Investigate missing or incorrectly displayed elements
  • Inspect and edit application state at runtime
  • Review action results and errors
vercel-labs/json-render1.9万2026年10月14日 更新

Set up an inspection panel in React json-render apps to examine UI definitions, edit state, and review action and stream timelines. The skill also covers opening or toggling the panel and recording events from React code.

中文简介正在准备中。当前显示英语简介。

  • Adding an inspection panel to a React app
  • Inspecting UI definitions, state, and action history
  • Opening or toggling the panel from React code
vercel-labs/json-render1.9万2026年10月14日 更新

Add and troubleshoot the json-render inspection panel in SolidJS applications. This skill covers panel setup for examining specifications, editing state, reviewing action and stream timelines, browsing component catalogs, and selecting page elements for inspection.

中文简介正在准备中。当前显示英语简介。

  • Add an inspection panel to a SolidJS app
  • Inspect JSON specifications and edit application state
  • Review action and stream timelines
vercel-labs/json-render1.9万2026年10月14日 更新

Add and troubleshoot a developer panel in Svelte 5 json-render apps. Inspect JSON screen definitions, edit application state, review action and streaming timelines, browse component catalogs, and select elements directly from the page.

中文简介正在准备中。当前显示英语简介。

  • Add a developer panel to a Svelte app
  • Inspect screen definitions and edit application state
  • Review action and streaming timelines
vercel-labs/json-render1.9万2026年10月14日 更新

查看 vercel-labs 的全部技能

报告此技能的问题