import { pageMetadata } from "@/lib/page-metadata" export const metadata = pageMetadata("docs/api/react-native") # @json-render/react-native React Native renderer with standard components, providers, and hooks. ## Standard Components ### Layout
ComponentPropsDescription
Containerpadding, background, borderRadius, borderColor, flexBasic wrapper with styling
Rowgap, align, justify, flex, wrapHorizontal flex layout
Columngap, align, justify, flexVertical flex layout
ScrollContainerdirectionScrollable area (vertical or horizontal)
SafeAreaedgesSafe area insets for notch/home indicator
Pressableaction, actionParamsTouchable wrapper that triggers actions
Spacersize, flexFixed or flexible spacing
Dividercolor, thicknessThin line separator
### Content
ComponentPropsDescription
Headingtext, level, align, colorHeading text (levels 1-6)
Paragraphtext, align, colorBody text
Labeltext, color, boldSmall label text
Imageuri, width, height, resizeMode, borderRadiusImage display
Avataruri, size, fallbackCircular avatar
Badgelabel, color, textColorStatus badge
Chiplabel, selected, colorTag/chip
### Input
ComponentPropsDescription
Buttonlabel, variant, size, disabled, action, actionParamsPressable button
TextInputplaceholder, value (use $bindState), secure, keyboardType, multilineText input field
Switchchecked (use $bindState), labelToggle switch
Checkboxchecked (use $bindState), labelCheckbox with label
Slidervalue (use $bindState), min, max, stepRange slider
SearchBarplaceholder, value (use $bindState)Search input
### Feedback
ComponentPropsDescription
Spinnersize, colorLoading indicator
ProgressBarprogress, color, trackColorProgress indicator
### Composite
ComponentPropsDescription
Cardtitle, subtitle, paddingCard container
ListItemtitle, subtitle, leading, trailing, action, actionParamsList row
Modalvisible, titleBottom sheet modal
## Providers ### StateProvider ```tsx {children} ```
PropTypeDescription
storeStateStoreExternal store (controlled mode). When provided, initialState and onStateChange are ignored.
initialStateRecord<string, unknown>Initial state model (uncontrolled mode).
onStateChange{'(changes: Array<{ path: string; value: unknown }>) => void'}Callback when state changes (uncontrolled mode). Called once per set or update with all changed entries.
#### External Store (Controlled Mode) Pass a `StateStore` to bypass the internal state and wire json-render to any state management library: ```tsx import { createStateStore, type StateStore } from "@json-render/react-native"; const store = createStateStore({ count: 0 }); {children} // Mutate from anywhere — components re-render automatically: store.set("/count", 1); ``` The `store` prop is also available on `JSONUIProvider` and `createRenderer`. ### ActionProvider ```tsx }> {children} ``` ### VisibilityProvider ```tsx {children} ``` Conditions in specs use the `VisibilityCondition` format with `$state` paths (e.g. `{ "$state": "/path" }`, `{ "$state": "/path", "eq": value }`). See [visibility](/docs/visibility) for the full syntax. ### ValidationProvider ```tsx {children} ``` ## defineRegistry Create a type-safe component registry. Standard components are built-in; only register custom components. ```tsx import { defineRegistry, type Components } from '@json-render/react-native'; const { registry } = defineRegistry(catalog, { components: { Icon: ({ props }) => , } as Components, }); ``` ## Hooks ### useUIStream ```typescript const { spec, // Spec | null - current UI state isStreaming, // boolean - true while streaming error, // Error | null send, // (prompt: string) => Promise clear, // () => void - reset spec and error } = useUIStream({ api: string, onComplete?: (spec: Spec) => void, onError?: (error: Error) => void, }); ``` ### useStateStore ```typescript const { state, get, set, update } = useStateStore(); ``` ### useStateValue ```typescript const value = useStateValue(path: string); ``` ### useStateBinding (deprecated) > **Deprecated.** Use `useBoundProp` with `$bindState` expressions instead. ```typescript const [value, setValue] = useStateBinding(path: string); ``` ### useActions ```typescript const { execute } = useActions(); ``` ### useIsVisible ```typescript const isVisible = useIsVisible(condition?: VisibilityCondition); ``` ## Catalog Exports ```typescript import { standardComponentDefinitions, standardActionDefinitions } from "@json-render/react-native/catalog"; import { schema } from "@json-render/react-native/schema"; ```
ExportPurpose
standardComponentDefinitionsCatalog definitions for all 25+ standard components
standardActionDefinitionsCatalog definitions for standard actions (setState, navigate)
schemaReact Native element tree schema