1.1.1 • Published 4 years ago

react-native-draggable-switch v1.1.1

Weekly downloads
221
License
MIT
Repository
github
Last release
4 years ago

npm version Build Status Greenkeeper Badge Coverage Status Codacy Badge

React Native Draggable Switch

A stateless, JS-only, animated, draggable switch component that maintains itself at 60fps.

Demo

GIF DEMO

Getting started

yarn add react-native-draggble-switch

Usage

...
import Switch from 'react-native-draggable-switch';

...
render() {
  ...
  return (
    <Switch
     width={50}
     height={30}
     value={this.state.isSwitchOn}
     onValueChange={(isSwitchOn) => this.setState({ isSwitchOn })}
    />
  )
}
...

Props Definitions

<Switch />

PropExplanationTypeDefaultRequired
widthThe width of the switchnumbertrue
heightThe height of the switchnumbertrue
valueThe value of the switch, indicating if the switch is on or offbooleantrue
onValueChangeThe callback function for when the value is changed in Switch, providing the updated value in paramsfunctiontrue
disabledIf user touch is disabledbooleanfalsefalse
containerStyleStyle for Switch outer containerViewStylenullfalse
circleStyleStyle for the dragging circle of the switchViewStylenullfalse
backgroundColorBackground color of the Switch when it is not onstring'#F6F7FA'false
circleColorColor of the dragging circlestring'#FFFFFF'false
activeColorBackground color of the Switch when it is onstring'#66D0B1'false
disabledColorBackground color of the Switch when it is disabledstring'#A1A1A1'false
1.1.1

4 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago