跳到主要内容
新架构实战课 实操 + 基建 + 原理全维度包揽,抢先掌握 React Native 新架构精髓 立即查看 >Version: 0.79

🚧 CheckBox

Removed. Use one of the community packages instead.

渲染一个单选框(目前仅 Android 可用)。

This is a controlled component that requires an onValueChange callback that updates the value prop in order for the component to reflect user actions. If the value prop is not updated, the component will continue to render the supplied value prop instead of the expected result of any user actions.

示例


文档

Props

继承所有View 的 Props.

disabled

If true the user won't be able to toggle the checkbox. Default value is false.

类型必需
bool

onChange

Used in case the props change removes the component.

类型必需
function

onValueChange

Invoked with the new value when the value changes.

类型必需
function

testID

用来在端到端测试中定位此视图。

类型必需
string

value

The value of the checkbox. If true the checkbox will be turned on. Default value is false.

类型必需
bool