SuperAPI AI 工具集

json-render-react-native

前端与建站

查看项目

更新于 10-16 08:05

技能介绍

用途:@json-render/react-native 用于把 JSON 规格渲染为 React Native 原生移动界面,适合需要以数据驱动方式构建移动 UI 的场景。

主要能力:提供标准组件集,包括布局类(Container、Row、Column、ScrollContainer、SafeArea、Pressable、Spacer、Divider)、内容类(Heading、Paragraph、Label、Image、Avatar、Badge、Chip)、输入类(Button、TextInput、Switch、Checkbox、Slider、SearchBar)、反馈类(Spinner、ProgressBar)和复合类(Card、ListItem、Modal)。支持可见性条件、动态属性表达式、内置动作以及多个 Provider。

使用方式:通过 defineCatalog 结合 schema 和 standardComponentDefinitions 定义目录,用 defineRegistry 注册自定义组件,再用 Renderer 渲染规格。动态属性支持 $state 单向读取、$bindState 与 $bindItem 双向绑定、$cond 条件值。内置 setState 动作由 ActionProvider 自动处理,更新状态模型后会重新求值可见性与动态属性。Provider 包括 StateProvider、ActionProvider、VisibilityProvider、ValidationProvider。可通过 createStateStore 传入外部 StateStore 进入受控模式。常用导出包括 defineRegistry、Renderer、schema、standardComponentDefinitions、useStateStore、useStateValue、useBoundProp、useActions、useUIStream、createStateStore 等。

限制:双向绑定应使用自然值属性上的 $bindState,组件不使用 statePath 属性。传入外部 store 时 initialState 与 onStateChange 会被忽略。useStateBinding 已废弃。该资料未提供收费、价格或平台支持范围等信息。