Jetpack 组合
用于使用 @expo/ui 构建原生 Android 界面的 Jetpack Compose 组件。
Android
Bundled version:
~55.0.15
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
@expo/ui/jetpack-compose中的Jetpack Compose组件允许你使用Jetpack Compose从React Native构建完全原生的Android界面。
🌐 The Jetpack Compose components in @expo/ui/jetpack-compose allow you to build fully native Android interfaces using Jetpack Compose from React Native.
安装
🌐 Installation
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
用法
🌐 Usage
使用 @expo/ui/jetpack-compose 的组件需要将其封装在 Host 组件中。Host 是 Jetpack Compose 视图的容器。
🌐 Using a component from @expo/ui/jetpack-compose requires wrapping it in a Host component. The Host is a container for Jetpack Compose views.
import { Host, Button } from '@expo/ui/jetpack-compose'; export function SaveButton() { return ( <Host matchContents> <Button onClick={() => alert('Saved!')}>Save changes</Button> </Host> ); }