1.0.1 • Published 5 years ago

@rn-components-kit/switch v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Switch

NPM version

English | 中文

Switching selector. It supports the following features:

  • customize color
  • customize size
  • two types: cupertino and material

How to use

npm install @rn-components-kit/switch --save
PreviewCode
Demo1 Code
Demo2 Code
Demo3 Code
Demo4 Code
Demo5 Code

Props

Reference

Props

style

Allows you to customize style

TypeRequiredDefault
objectno-

type

Two types (cupertino for IOS and material for Android)

TypeRequiredDefault
enum('cupertino', 'material')no'cupertino'

value

Determines whether switch is on when initial rendering

TypeRequiredDefault
booleannofalse

disabled

Determines whether switch is touchabled

TypeRequiredDefault
booleannofalse

width

Width of switch

TypeRequiredDefault
numberno40

height

Height of switch's track

TypeRequiredDefault
numberno20

thumbRadius

Radius of thumb

TypeRequiredDefault
numberno8

thumbColor

Color of thumb

TypeRequiredDefault
stringno'#FFF'

trackOnColor

Color of track when switch is "on" status

TypeRequiredDefault
stringno'#79D472'

trackOffColor

Color of track when switch is "off" status

TypeRequiredDefault
stringno'#CCC'

onValueChange

(value: boolean) => void

A callback will be triggered when switch's status changes

TypeRequiredDefault
functionno() => {}