A simple React Native switch with effects
-
with NPM
$ npm install rn-slide-switch
It's a pretty easy to use this library. This is the usage example :
import React from 'react'
import SlideSwitch from 'rn-slide-switch'
const Preview = () => {
return (
<SlideSwitch
list={['option 1', 'option 2', 'option 3']}
initialIndex={2}
activeViewStyle={{backgroundColor: 'blue'}}
activeTextStyle={{color: 'white'}}
onChange={(i) => console.log(i)}
/>
)
}
propsName | propsType | isRequired | defaultProps |
---|---|---|---|
list | array |
true |
[] |
initialIndex | number |
false |
0 |
activeViewStyle | object |
false |
{backgroundColor: 'blue'} |
activeTextStyle | object |
false |
{color: 'white'} |
passiveViewStyle | object |
false |
{backgroundColor: 'white'} |
passiveTextStyle | object |
false |
{color: 'black'} |
Rafael Muradyan 💻 |