npm install --save react-native-switchbutton
yarn add react-native-switchbutton
import Switch from 'react-native-switchbutton';
//使用 方法 和 RN官 方 的 Switch类似,
<Switch/>
View props...
disabled bool
如果为true,这个组件不能 进行交互 。
onValueChange function
当 值改变的时候调用此回调函数 ,参 数 为新的 值。
value bool
表示 此开关是否 打 开。默 认为false(关闭状 态)。
onTintColor ColorPropType
开启状 态时的 背景 颜色。
thumbTintColor ColorPropType
开关上 圆形按钮的 背景 颜色。
tintColor ColorPropType
关闭状 态时的 边框颜色(iOS)或 背景 颜色(Android)。
useNative bool
使用 RN官 方 提供 的 switch
tintColorUsage string
tintColor的 使用 ,border和 background可 供 选择,仅在useNative为false时有效
useNativeDriver
是 否 使用 原生 动画,仅在useNative为false时有效