# native-shell > native-shell: AI-generated UI, native in your app. iOS and Android apps load TSX modules at run time — signed, sandboxed by the host, and rendered with real UIKit and Android views. Apps are TSX modules run by QuickJS on a native Rust runtime; the toolchain is the single `nsh` binary (`nsh init my-app`, `nsh run my-app/App.tsx`). Every page below is also served as Markdown at its URL plus `.md`. ## Guide - [Introduction](https://native-shell.com/docs.md): What native-shell is: a shell that lets native iOS and Android apps load UI modules after they ship, with standalone apps as a second use. - [Installation](https://native-shell.com/docs/installation.md): Get the nsh command, from a prebuilt distribution or a source checkout, and the Xcode and Android tools each target needs. - [Getting started](https://native-shell.com/docs/getting-started.md): Write a module with nsh init, develop it with hot reload, host it in your iOS or Android app, and ship updates as signed packages; or package it as a standalone app. - [Embedding in iOS Apps](https://native-shell.com/docs/embedding-ios.md): Add NativeShell.xcframework to an existing iOS app, show nsh apps in an NshAppView, and load bundles, signed packages or a dev server. - [Embedding in Android Apps](https://native-shell.com/docs/embedding-android.md): Add nsh.aar to an existing Android app, show nsh apps in an NshView, and load bundles, signed packages or a dev server. - [Native Components](https://native-shell.com/docs/native-components.md): Use views of the host app (maps, players, any UIView or Android View) inside a nsh app, with props, events, commands and sizing. - [Signed Packages](https://native-shell.com/docs/signed-packages.md): Ship app code that host apps download and verify: keys, certificates, nsh publish, verification, revocation and rollback protection. - [Sandbox and Capabilities](https://native-shell.com/docs/sandbox-and-capabilities.md): The limits every nsh app runs under (memory, time, nodes), the language hardening of release builds, and capabilities declared in nsh.json and granted by host apps. - [Project structure](https://native-shell.com/docs/project-structure.md): The files of an nsh app, every key of nsh.json, the TypeScript setup in .nsh/types, assets, and how modules and packages are imported. - [CLI](https://native-shell.com/docs/cli.md): Every nsh subcommand and flag - init, build, trace, dev, run, package, and the signing commands keygen, certify, publish, verify and revoke. - [JSX and components](https://native-shell.com/docs/jsx-and-components.md): How nsh compiles JSX, what a component is, how props, children, control flow, refs and spreads work, and how tags name elements and components. - [Reactivity](https://native-shell.com/docs/reactivity.md): Signals, computed values, effects, batch, untracked, cleanup and context - how nsh updates exactly what changed, and the mistakes to avoid. - [Styling](https://native-shell.com/docs/styling.md): The style prop - camelCase properties with flexbox, grid and CSS effects - colors, borders, corners, shadows, gradients, filters, transforms and transitions, with platform differences. - [Tailwind](https://native-shell.com/docs/tailwind.md): Style elements with Tailwind CSS classes resolved natively - class and classList, variants for pressed states, dark mode and breakpoints, the theme in nsh.json, and the build-time class check. - [Layout](https://native-shell.com/docs/layout.md): Flexbox with a column default, CSS grid, sizes and percentages, aspect ratio, absolute positioning, measuring with onLayout, responsive layouts and right-to-left. - [Text](https://native-shell.com/docs/text.md): Showing text with the text element - nested spans and links, inline views, fonts and decorations, truncation, system text size, selection and onTextLayout. - [Images and assets](https://native-shell.com/docs/images-and-assets.md): Showing images with the image element - imported assets and @2x files, remote URLs, resize modes, placeholders, blur, tint, load events, and Image.getSize / Image.prefetch. - [Fonts](https://native-shell.com/docs/fonts.md): The system font and generic families, importing .ttf and .otf files, families with several weights and italics, and using fonts from Tailwind classes. - [Touch and gestures](https://native-shell.com/docs/touch-and-gestures.md): Presses and press feedback, hit areas, pointerEvents, raw touches, the responder system, PanResponder, and native pan, pinch and rotation gestures. - [Scrolling](https://native-shell.com/docs/scrolling.md): The scroll element, paging and snapping, zooming, pull to refresh, scroll events, scroll-linked effects with scrollValue, the keyboard in scroll views, and scrolling from code. - [Lists](https://native-shell.com/docs/lists.md): Long and endless lists with List from nsh/list - recycling, item identity, columns, sticky headers, inverted chat lists, horizontal lists, loading more, viewability and scrolling to an item. - [Navigation](https://native-shell.com/docs/navigation.md): Native navigation stacks with createNavigator, Stack and Screen, header options, keeping the user on a screen with preventBack, modals, and the Android back button. - [Forms and the keyboard](https://native-shell.com/docs/forms-and-keyboard.md): Text input with the input element - controlled and uncontrolled values, keyboard types, the return key, focus, selection, growing multiline inputs - and keeping content clear of the software keyboard. - [Animation](https://native-shell.com/docs/animation.md): Style transitions and keyframe animations, native values with timing, spring and decay, interpolation, composite animations, Easing, LayoutAnimation, and what runs on the UI thread. - [Canvas](https://native-shell.com/docs/canvas.md): Drawing with Canvas from nsh/canvas - the 2D context subset, paths and Path2D, gradients, text, images, redrawing from signals, and animating drawings with native values. - [Web view and video](https://native-shell.com/docs/web-view-and-video.md): Showing web pages with WebView and playing video with Video - sources, messaging between the page and the app, navigation, playback control, refs and capabilities. - [Networking](https://native-shell.com/docs/networking.md): HTTP with fetch - JSON, headers, uploads with FormData, streaming responses and request bodies, cancelling with AbortController, errors, and the network capabilities an app declares. - [Device and environment](https://native-shell.com/docs/device-and-environment.md): Reading the window size, color scheme, font scale, safe areas, the platform, pixel density and layout direction, and reacting when they change. - [Accessibility](https://native-shell.com/docs/accessibility.md): Making apps work with VoiceOver and TalkBack - labels, roles, states, values, custom actions, grouping and hiding, announcements and focus, text size, and reduced motion. - [Platform-specific code](https://native-shell.com/docs/platform-specific.md): Writing one app for iOS and Android - platform-only props in ios={{}} / android={{}} / desktop={{}}, the nsh/ios and nsh/android modules, Platform.OS and Platform.select, and platform Tailwind variants. - [Web (WebAssembly)](https://native-shell.com/docs/web.md): Run nsh apps in a browser with the WebAssembly build of the runtime, which renders to the DOM; it powers the live demos on this site. - [Packaging](https://native-shell.com/docs/packaging.md): Build installable apps with nsh package for iOS devices, the iOS simulator and Android, with app metadata, icons and signing. - [Dev Server and Debugging](https://native-shell.com/docs/dev-server-and-debugging.md): Run apps with nsh run and nsh dev, connect simulators, emulators and devices, and use hot module replacement, logs, the error overlay and source-mapped stacks. - [Testing with nsh trace](https://native-shell.com/docs/testing-and-trace.md): Run an app headless with nsh trace, read the native view operations and timings it prints, simulate taps and scrolling, and use it in CI; testID for UI tests. - [Performance](https://native-shell.com/docs/performance.md): How nsh keeps apps fast (native runtime, batched crossings, native animations, virtualized lists), what that means for your code, and how to measure with nsh trace. - [Architecture](https://native-shell.com/docs/architecture.md): How an nsh app runs: the build pipeline, the engine and main threads, the path from a signal change to native views, the native reactive graph, text layout and the crates. - [Comparing approaches](https://native-shell.com/docs/comparison.md): The ways a mobile client can show UI that arrives after release — web views, server-driven UI, mini-program containers, over-the-air updates of cross-platform frameworks — compared with nsh. ## Elements - [Elements](https://native-shell.com/elements.md): The host elements every nsh app is built from, and the props, events and ref methods they all share. - [view](https://native-shell.com/elements/view.md): The basic container element: layout, backgrounds, borders, shadows, press handling and gestures. - [text](https://native-shell.com/elements/text.md): The element that draws text: nested spans, links, line limits, font scaling, inline views and text layout events. - [image](https://native-shell.com/elements/image.md): The element that shows a bundled or remote image, with placeholders, blur, fades, tinting and load events. - [scroll](https://native-shell.com/elements/scroll.md): The native scroll view: vertical and horizontal scrolling, paging and snapping, pull to refresh, zooming and scroll events. - [input](https://native-shell.com/elements/input.md): The native text field: controlled and uncontrolled text, keyboards, autofill, selection, multiline inputs and focus. - [list](https://native-shell.com/elements/list.md): The virtualized, recycling list: rows, columns, sticky headers, inverted chat lists, viewability and scrolling to items. - [canvas](https://native-shell.com/elements/canvas.md): The canvas element and the Canvas component: custom drawing with an HTML Canvas 2D context, replayed natively. - [web-view](https://native-shell.com/elements/web-view.md): The web view element and the WebView component: web pages and inline HTML inside an app, with messaging both ways. - [video](https://native-shell.com/elements/video.md): The video element and the Video component: native video playback with your own or the system's controls. - [modal](https://native-shell.com/elements/modal.md): The modal element and the Modal component: content presented over everything else, as a full screen, a sheet or a dialog. - [if / each](https://native-shell.com/elements/control-flow.md): The built-in control flow tags: renders a branch by a condition, renders a keyed row per item of an array. ## Components - [Mobile UI](https://native-shell.com/components.md): The nsh/ui/mobile UI set, its components and modules, and how to theme them from nsh.json. - [Button](https://native-shell.com/components/button.md): A press target with a label in four variants, with native press feedback and a disabled state. - [Card](https://native-shell.com/components/card.md): A rounded surface with an optional header and footer around your content, elevated or outlined. - [Group](https://native-shell.com/components/group.md): Settings-style rows in a rounded box, divided by hairlines, with an optional caption and footnote. - [ListView](https://native-shell.com/components/list-view.md): A virtualized, recycling list of your rows, padded and divided, in a plain or inset style. - [SafeAreaView](https://native-shell.com/components/safe-area-view.md): A view padded by the insets of system UI, a screen's header or a modal, plus safeArea() and useSafeAreaInsets(). - [SelectList](https://native-shell.com/components/select-list.md): A scrolling list of string options with a check mark on the chosen one, controlled or uncontrolled. - [Sheet](https://native-shell.com/components/sheet.md): A bottom sheet over a dimmed backdrop that the user drags down, taps outside or backs out of to close. - [StatusBar](https://native-shell.com/components/status-bar.md): Control the status bar's content color and visibility by rendering StatusBar or calling its functions. - [Stepper](https://native-shell.com/components/stepper.md): A number with − and + buttons within a range; holding a button keeps stepping; a ref reads and sets it. - [TextField](https://native-shell.com/components/text-field.md): A labeled single-line text input with a clear button, focus ring and secure entry. - [KeyboardAvoidingView](https://native-shell.com/components/keyboard-avoiding-view.md): Keep content outside scroll views, such as a message bar, above the software keyboard, moving with it. - [Alert](https://native-shell.com/components/alert.md): Show the platform's alert dialog and await the index of the button the user pressed. - [ActionSheet](https://native-shell.com/components/action-sheet.md): Show the platform's action sheet with a list of actions and await the index of the action chosen. - [Keyboard](https://native-shell.com/components/keyboard.md): Dismiss the software keyboard and read its height and animation duration reactively. - [Navigation](https://native-shell.com/components/navigation.md): Native navigation stacks with createNavigator, Stack and Screen, header options, back handling and Modal. ## API - [Modules](https://native-shell.com/modules.md): The modules an nsh app imports, what each one exports, and how they are organized. - [nsh](https://native-shell.com/modules/nsh.md): The core module: signals, computed values, effects, context, mount and the element and style types. - [nsh/animated](https://native-shell.com/modules/nsh-animated.md): Native values, animation drivers, composed animations, easings and layout animation. - [nsh/list](https://native-shell.com/modules/nsh-list.md): List, a virtualized and recycling list on a native scroll view, with all its props, events and ref methods. - [nsh/canvas](https://native-shell.com/modules/nsh-canvas.md): Canvas, the 2D drawing context, Path2D and gradients, with the parts of HTML Canvas 2D that nsh supports. - [nsh/device](https://native-shell.com/modules/nsh-device.md): The window size, color scheme, font scale, platform, pixel ratio and right-to-left layout. - [nsh/gesture](https://native-shell.com/modules/nsh-gesture.md): PanResponder, pan gestures built on the gesture responder system. - [nsh/image](https://native-shell.com/modules/nsh-image.md): Image.getSize and Image.prefetch, image information and loading ahead. - [nsh/native](https://native-shell.com/modules/nsh-native.md): nativeComponent, which turns a native view registered by the embedding app into a typed component. - [nsh/accessibility](https://native-shell.com/modules/nsh-accessibility.md): Screen reader and reduced motion settings, announcements and accessibility focus. - [nsh/ios](https://native-shell.com/modules/nsh-ios.md): iOS-only APIs: isAvailable and InputAccessoryView, a bar over the keyboard. - [nsh/android](https://native-shell.com/modules/nsh-android.md): Android-only APIs: isAvailable, Toast, BackHandler and setStatusBarBackgroundColor. - [nsh/webview](https://native-shell.com/modules/nsh-webview.md): WebView, a native web page view (WKWebView, android.webkit.WebView), with its props, events and ref methods. - [nsh/video](https://native-shell.com/modules/nsh-video.md): Video, a native video player (AVPlayer, MediaPlayer), with its props, events and ref methods. - [Web APIs](https://native-shell.com/modules/web-apis.md): The browser-style globals available to every nsh app — fetch, streams, URL, encoding, Blob and FormData, events and abort signals, timers and console — and where they differ from browsers. - [Style reference](https://native-shell.com/modules/style-reference.md): Every style key nsh accepts, grouped by LayoutStyle, ViewStyle, TextStyle and ImageStyle, with its type and meaning. - [Tailwind reference](https://native-shell.com/modules/tailwind-reference.md): Every Tailwind utility and variant nsh resolves natively, the arbitrary value syntax, and how to extend the theme in nsh.json. ## 指南(中文) - [简介](https://native-shell.com/zh-CN/docs.md): native-shell 是什么:让原生 iOS、Android 应用在发布之后加载 UI 模块的 Shell,独立应用是次要用途。 - [安装](https://native-shell.com/zh-CN/docs/installation.md): 从预构建的发行包或源码仓库获取 nsh 命令,以及各目标平台所需的 Xcode 和 Android 工具。 - [快速开始](https://native-shell.com/zh-CN/docs/getting-started.md): 用 nsh init 编写一个模块,借助热重载开发,把它承载到你的 iOS 或 Android 应用里,并以签名包下发更新;也可以打包成独立应用。 - [嵌入 iOS 应用](https://native-shell.com/zh-CN/docs/embedding-ios.md): 把 NativeShell.xcframework 加入现有 iOS 应用,在 NshAppView 中显示 nsh 应用,并加载 bundle、签名包或连接开发服务器。 - [嵌入 Android 应用](https://native-shell.com/zh-CN/docs/embedding-android.md): 把 nsh.aar 加入现有 Android 应用,在 NshView 中显示 nsh 应用,并加载 bundle、签名包或连接开发服务器。 - [原生组件](https://native-shell.com/zh-CN/docs/native-components.md): 在 nsh 应用中使用宿主应用的视图(地图、播放器、任意 UIView 或 Android View),支持 props、事件、命令和尺寸上报。 - [签名包](https://native-shell.com/zh-CN/docs/signed-packages.md): 发布由宿主应用下载并验证的应用代码:密钥、证书、nsh publish、验证、吊销与回滚保护。 - [沙箱与能力](https://native-shell.com/zh-CN/docs/sandbox-and-capabilities.md): 每个 nsh 应用运行时受到的限制(内存、时间、节点),release 构建的语言加固,以及在 nsh.json 中声明、由宿主应用授予的能力。 - [项目结构](https://native-shell.com/zh-CN/docs/project-structure.md): nsh 应用包含的文件、nsh.json 的每个键、.nsh/types 中的 TypeScript 配置、资源,以及模块和包的导入方式。 - [命令行](https://native-shell.com/zh-CN/docs/cli.md): nsh 的全部子命令与参数:init、build、trace、dev、run、package,以及签名相关的 keygen、certify、publish、verify 和 revoke。 - [JSX 与组件](https://native-shell.com/zh-CN/docs/jsx-and-components.md): nsh 如何编译 JSX、组件是什么,props、children、控制流、ref 和展开如何工作,以及标签如何对应元素与组件。 - [响应式](https://native-shell.com/zh-CN/docs/reactivity.md): signal、computed、effect、batch、untracked、cleanup 和 context:nsh 如何只更新真正变化的部分,以及需要避开的常见错误。 - [样式](https://native-shell.com/zh-CN/docs/styling.md): style 属性:camelCase 属性,支持 flexbox、grid 和 CSS 效果,包括颜色、边框、圆角、阴影、渐变、滤镜、变换和过渡,以及各平台的差异。 - [Tailwind](https://native-shell.com/zh-CN/docs/tailwind.md): 用原生解析的 Tailwind CSS 类给元素加样式:class 与 classList,按下状态、深色模式和断点等变体,nsh.json 中的主题,以及构建时的类名检查。 - [布局](https://native-shell.com/zh-CN/docs/layout.md): 默认纵向排列的 Flexbox、CSS 网格、尺寸与百分比、宽高比、绝对定位、用 onLayout 测量、响应式布局以及从右到左布局。 - [文字](https://native-shell.com/zh-CN/docs/text.md): 用 text 元素显示文字:嵌套 span 与链接、行内视图、字体与装饰线、截断、系统字号、选择以及 onTextLayout。 - [图片与资源](https://native-shell.com/zh-CN/docs/images-and-assets.md): 用 image 元素显示图片:导入的资源与 @2x 文件、远程 URL、缩放模式、占位图、模糊、着色、加载事件,以及 Image.getSize / Image.prefetch。 - [字体](https://native-shell.com/zh-CN/docs/fonts.md): 系统字体与通用字体族、导入 .ttf 和 .otf 文件、含多个字重和斜体的字体族,以及在 Tailwind 类中使用字体。 - [触摸与手势](https://native-shell.com/zh-CN/docs/touch-and-gestures.md): 按压与按压反馈、点击区域、pointerEvents、原始触摸事件、手势响应者系统、PanResponder,以及原生的拖动、捏合与旋转手势。 - [滚动](https://native-shell.com/zh-CN/docs/scrolling.md): scroll 元素、分页与吸附、缩放、下拉刷新、滚动事件、用 scrollValue 实现滚动联动效果、滚动视图中的键盘,以及从代码滚动。 - [列表](https://native-shell.com/zh-CN/docs/lists.md): 用 nsh/list 的 List 渲染长列表和无限列表:复用、条目标识、多列、吸顶标题、倒置的聊天列表、横向列表、加载更多、可见性,以及滚动到指定条目。 - [导航](https://native-shell.com/zh-CN/docs/navigation.md): 用 createNavigator、Stack 和 Screen 构建原生导航栈,标题栏选项,用 preventBack 把用户留在当前页面,模态视图,以及 Android 返回键。 - [表单与键盘](https://native-shell.com/zh-CN/docs/forms-and-keyboard.md): 用 input 元素输入文本:受控与非受控的值、键盘类型、回车键、焦点、选区、自动增高的多行输入框,以及让内容避开软键盘。 - [动画](https://native-shell.com/zh-CN/docs/animation.md): 样式过渡与关键帧动画,原生值的 timing、spring 和 decay,插值,组合动画,Easing,LayoutAnimation,以及哪些部分运行在 UI 线程上。 - [画布](https://native-shell.com/zh-CN/docs/canvas.md): 用 nsh/canvas 的 Canvas 绘图:2D 上下文子集、路径与 Path2D、渐变、文字、图片、根据 signal 重绘,以及用原生值驱动绘制动画。 - [网页视图与视频](https://native-shell.com/zh-CN/docs/web-view-and-video.md): 用 WebView 显示网页、用 Video 播放视频:来源、页面与应用之间的消息、导航、播放控制、ref 以及能力声明。 - [网络](https://native-shell.com/zh-CN/docs/networking.md): 用 fetch 发起 HTTP 请求:JSON、请求头、用 FormData 上传、流式响应与请求体、用 AbortController 取消、错误处理,以及应用声明的网络能力。 - [设备与环境](https://native-shell.com/zh-CN/docs/device-and-environment.md): 读取窗口尺寸、配色方案、字体缩放、安全区域、平台、像素密度和布局方向,并在它们变化时作出响应。 - [无障碍](https://native-shell.com/zh-CN/docs/accessibility.md): 让应用配合 VoiceOver 和 TalkBack 使用:标签、角色、状态、值、自定义操作、分组与隐藏、播报与焦点、文字大小以及减少动态效果。 - [平台特定代码](https://native-shell.com/zh-CN/docs/platform-specific.md): 为 iOS 和 Android 编写同一个应用:ios={{}} / android={{}} / desktop={{}} 中的平台专属属性,nsh/ios 与 nsh/android 模块,Platform.OS 与 Platform.select,以及平台相关的 Tailwind 变体。 - [Web(WebAssembly)](https://native-shell.com/zh-CN/docs/web.md): 用 WebAssembly 版运行时在浏览器里运行 nsh 应用,渲染到 DOM;本站的实时演示都由它驱动。 - [打包](https://native-shell.com/zh-CN/docs/packaging.md): 用 nsh package 为 iOS 真机、iOS 模拟器和 Android 构建可安装的应用,包括应用元数据、图标和签名。 - [开发服务器与调试](https://native-shell.com/zh-CN/docs/dev-server-and-debugging.md): 用 nsh run 和 nsh dev 运行应用,连接模拟器、Android 模拟器和真机,并使用模块热替换、日志、错误浮层和经 source map 映射的调用栈。 - [用 nsh trace 测试](https://native-shell.com/zh-CN/docs/testing-and-trace.md): 用 nsh trace 无界面运行应用,读懂它打印的原生视图操作和耗时,模拟点击和滚动,并在 CI 中使用;以及用于 UI 测试的 testID。 - [性能](https://native-shell.com/zh-CN/docs/performance.md): nsh 如何让应用保持高速(原生运行时、批量跨线程、原生动画、虚拟化列表),这对你的代码意味着什么,以及如何用 nsh trace 测量。 - [架构](https://native-shell.com/zh-CN/docs/architecture.md): nsh 应用是如何运行的:构建流程、引擎线程与主线程、从 signal 变化到原生视图的路径、原生响应式图、文本布局以及各个 crate。 - [方案对比](https://native-shell.com/zh-CN/docs/comparison.md): 手机客户端显示发布之后才到来的界面有哪些做法——WebView、服务端驱动 UI、小程序容器、跨平台框架的热更新——以及它们与 nsh 的比较。 ## 元素(中文) - [元素](https://native-shell.com/zh-CN/elements.md): 构成每个 nsh 应用的宿主元素,以及它们共有的属性、事件和 ref 方法。 - [view](https://native-shell.com/zh-CN/elements/view.md): 最基础的容器元素:布局、背景、边框、阴影、按压处理和手势。 - [text](https://native-shell.com/zh-CN/elements/text.md): 绘制文本的元素:嵌套片段、链接、行数限制、字体缩放、行内视图和文本布局事件。 - [image](https://native-shell.com/zh-CN/elements/image.md): 显示打包资源或远程图片的元素,支持占位图、模糊、淡入、着色和加载事件。 - [scroll](https://native-shell.com/zh-CN/elements/scroll.md): 原生滚动视图:纵向和横向滚动、分页与吸附、下拉刷新、缩放以及滚动事件。 - [input](https://native-shell.com/zh-CN/elements/input.md): 原生文本输入框:受控与非受控文本、键盘、自动填充、选区、多行输入和焦点。 - [list](https://native-shell.com/zh-CN/elements/list.md): 虚拟化、可复用单元格的列表:行、多列、吸顶标题、倒序聊天列表、可见性回调和滚动到指定项。 - [canvas](https://native-shell.com/zh-CN/elements/canvas.md): canvas 元素与 Canvas 组件:用 HTML Canvas 2D 上下文自定义绘制,并在原生侧回放。 - [web-view](https://native-shell.com/zh-CN/elements/web-view.md): web view 元素与 WebView 组件:在应用中显示网页和内联 HTML,并支持双向通信。 - [video](https://native-shell.com/zh-CN/elements/video.md): video 元素与 Video 组件:原生视频播放,可使用自定义控件或系统控件。 - [modal](https://native-shell.com/zh-CN/elements/modal.md): modal 元素与 Modal 组件:在所有内容之上呈现内容,可以是全屏、底部弹出的 sheet 或对话框。 - [if / each](https://native-shell.com/zh-CN/elements/control-flow.md): 内置的控制流标签: 按条件渲染一个分支, 为数组的每一项渲染一个带 key 的行。 ## 组件(中文) - [移动端 UI](https://native-shell.com/zh-CN/components.md): nsh/ui/mobile UI 套件:其中的组件与模块,以及如何通过 nsh.json 设置主题。 - [Button](https://native-shell.com/zh-CN/components/button.md): 带文字标签的按压目标,有四种变体,提供原生按压反馈和禁用状态。 - [Card](https://native-shell.com/zh-CN/components/card.md): 包裹你的内容的圆角卡片,可带页眉和页脚,有带阴影和仅描边两种样式。 - [Group](https://native-shell.com/zh-CN/components/group.md): 设置页风格的行,放在圆角框内并以细线分隔,可带标题说明和脚注。 - [ListView](https://native-shell.com/zh-CN/components/list-view.md): 渲染你的行的虚拟化、可回收列表,自带内边距和分隔线,有 plain 和 inset 两种样式。 - [SafeAreaView](https://native-shell.com/zh-CN/components/safe-area-view.md): 按系统 UI、页面标题栏或模态框的 inset 添加内边距的视图,以及 safeArea() 和 useSafeAreaInsets()。 - [SelectList](https://native-shell.com/zh-CN/components/select-list.md): 带勾选标记的可滚动字符串选项列表,支持受控与非受控两种用法。 - [Sheet](https://native-shell.com/zh-CN/components/sheet.md): 覆盖在半透明遮罩上的底部面板,用户可以下拉、点按外部或按返回键关闭。 - [StatusBar](https://native-shell.com/zh-CN/components/status-bar.md): 通过渲染 StatusBar 或调用其函数,控制状态栏内容的颜色以及是否显示。 - [Stepper](https://native-shell.com/zh-CN/components/stepper.md): 带 − 和 + 按钮、限定范围的数字;按住按钮会连续步进;可通过 ref 读取和设置数值。 - [TextField](https://native-shell.com/zh-CN/components/text-field.md): 带标签的单行文本输入框,支持清除按钮、聚焦边框和密码输入。 - [KeyboardAvoidingView](https://native-shell.com/zh-CN/components/keyboard-avoiding-view.md): 让滚动视图之外的内容(例如消息输入栏)始终位于软键盘上方,并随键盘一起移动。 - [Alert](https://native-shell.com/zh-CN/components/alert.md): 显示平台的警告对话框,并通过 await 得到用户所按按钮的序号。 - [ActionSheet](https://native-shell.com/zh-CN/components/action-sheet.md): 显示平台的操作表,列出一组操作,并通过 await 得到所选操作的序号。 - [Keyboard](https://native-shell.com/zh-CN/components/keyboard.md): 收起软键盘,并以响应式方式读取键盘的高度和动画时长。 - [导航](https://native-shell.com/zh-CN/components/navigation.md): 用 createNavigator、Stack 和 Screen 构建原生导航栈,涵盖标题栏选项、返回处理和 Modal。 ## API(中文) - [模块](https://native-shell.com/zh-CN/modules.md): nsh 应用可以导入的模块、各模块导出的内容以及它们的组织方式。 - [nsh](https://native-shell.com/zh-CN/modules/nsh.md): 核心模块:signal、computed、effect、context、mount,以及元素和样式的类型。 - [nsh/animated](https://native-shell.com/zh-CN/modules/nsh-animated.md): 原生值、动画驱动、组合动画、缓动曲线和布局动画。 - [nsh/list](https://native-shell.com/zh-CN/modules/nsh-list.md): List:基于原生滚动视图、虚拟化并复用单元格的列表,以及它的全部属性、事件和 ref 方法。 - [nsh/canvas](https://native-shell.com/zh-CN/modules/nsh-canvas.md): Canvas、2D 绘图上下文、Path2D 与渐变,以及 nsh 支持的 HTML Canvas 2D 子集。 - [nsh/device](https://native-shell.com/zh-CN/modules/nsh-device.md): 窗口尺寸、配色方案、字体缩放、平台信息、像素密度和从右到左布局。 - [nsh/gesture](https://native-shell.com/zh-CN/modules/nsh-gesture.md): PanResponder:基于手势响应者系统的拖动手势。 - [nsh/image](https://native-shell.com/zh-CN/modules/nsh-image.md): Image.getSize 和 Image.prefetch:获取图片信息和预加载图片。 - [nsh/native](https://native-shell.com/zh-CN/modules/nsh-native.md): nativeComponent:把宿主应用注册的原生视图变成带类型的组件。 - [nsh/accessibility](https://native-shell.com/zh-CN/modules/nsh-accessibility.md): 屏幕阅读器和减弱动态效果设置、无障碍播报与无障碍焦点。 - [nsh/ios](https://native-shell.com/zh-CN/modules/nsh-ios.md): iOS 专有 API:isAvailable 和 InputAccessoryView(键盘上方的工具栏)。 - [nsh/android](https://native-shell.com/zh-CN/modules/nsh-android.md): Android 专有 API:isAvailable、Toast、BackHandler 和 setStatusBarBackgroundColor。 - [nsh/webview](https://native-shell.com/zh-CN/modules/nsh-webview.md): WebView:原生网页视图(WKWebView、android.webkit.WebView),以及它的属性、事件和 ref 方法。 - [nsh/video](https://native-shell.com/zh-CN/modules/nsh-video.md): Video:原生视频播放器(AVPlayer、MediaPlayer),以及它的属性、事件和 ref 方法。 - [Web API](https://native-shell.com/zh-CN/modules/web-apis.md): 每个 nsh 应用都能直接使用的浏览器风格全局对象——fetch、流、URL、文本编码、Blob 与 FormData、事件与中止信号、定时器和 console——以及它们与浏览器的差异。 - [样式参考](https://native-shell.com/zh-CN/modules/style-reference.md): nsh 支持的全部样式属性,按 LayoutStyle、ViewStyle、TextStyle 和 ImageStyle 分组,列出类型与含义。 - [Tailwind 参考](https://native-shell.com/zh-CN/modules/tailwind-reference.md): nsh 原生解析的全部 Tailwind 工具类与变体、任意值语法,以及如何在 nsh.json 中扩展主题。