This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
RadioButton
用于单选控件的 Jetpack Compose RadioButton 组件。
Android
Included in Expo Go
用于从一组选项中选择单个选项的单选按钮组件。映射到官方 Jetpack Compose RadioButton API。


安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本单选按钮
带有 onClick 处理函数的独立单选按钮。
BasicRadioButton.tsx
单选按钮组(推荐)
单选按钮组推荐遵循 Compose 无障碍指南:
- 使用带有
selectableGroup()修饰符的Column包裹单选按钮组,以便屏幕阅读器将这些选项视为一个组 - 在每个
Row上应用带有role: 'radioButton'的selectable修饰符,使整行(包括标签)都可以点击 - 不要向
RadioButton本身传递onClick,由行处理交互。这样可以提供更大的触摸目标
RadioGroup.tsx
API
import { RadioButton } from '@expo/ui/jetpack-compose';