# Switch

开关

# 基本用法

switch-1

import { Segmented } from 'react-native-maui';

<Switch />

# 自定义样式

switch-2

import { Segmented } from 'react-native-maui';

<Switch
  activeBackgroundColor={'cyan'}
  inactiveBackgroundColor={'pink'}
/>
<Switch
  style={styles.switch1}
  activeBackgroundColor={'cyan'}
  inactiveBackgroundColor={'orange'}
  onChange={() => {}}
/>

# 属性

名称 描述 类型 默认值
value 开关是否开启 boolean false
style 容器样式 ViewStyle { height: 34, width: 55, borderRadius: 17, padding: 2 }
disabled 是否可点击 boolean false
activeBackgroundColor 开启时背影颜色 string '#3279FD'
inactiveBackgroundColor 关闭时背景颜色 string '#dcdcdc'
onChange 开启或者关闭之后的回调 (value: boolean) => void -
Last Updated: 7/13/2022, 11:26:38 AM