1.0.3 • Published 7 years ago

react-native-sf-switch v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

react-native-sf-switch

switch

show

安装

npm install react-native-sf-switch

Props

parametertyperequireddescriptiondefault
widthnumberno宽度80
heightnumberno高度30
checkedboolno是否选中false
disabledboolno是否不可修改0
durationnumberno动画时间(单位毫秒)300'
borderColorstringno边框颜色'rgba(233,233,233,1)'
disabledOpacitynumberno不可修改时的透明度(0.0-1.0)0.5
containerColorstringno背景颜色'red'
containerStyleobjectno容器样式(主要设置位置相关)null
onChangefuncnochange 事件触发的回调函数null
tagfuncnumber标示0

例子

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import SFSwitch from "react-native-sf-switch"

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <SFSwitch/>
        <SFSwitch disabled={true} containerStyle={{
          marginTop:20
        }}/>
        <SFSwitch containerStyle={{
          marginTop:20
        }} checked={true}/>
        <SFSwitch containerStyle={{
          marginTop:20
        }} checked={true} disabled={true}/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  }
});