1.0.4 • Published 3 years ago

react-native-multiswitch-selector v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

https://user-images.githubusercontent.com/33498670/154785463-2a7fd8f5-a7aa-473c-892e-6fe86ec7ca95.mov

https://user-images.githubusercontent.com/33498670/154785433-86e5e46d-b69c-4239-976e-d9c53ae5ebc2.mov

Install

yarn add react-native-multiswitch-selector

peer dependency:

yarn add react-native-linear-gradient

Usage

import { MultiSwitch } from 'react-native-multiswitch-selector';

export const App = () => {
  const [allStates] = useState(['Father', 'Mother', 'Brother'])
  const [switchState, setSwitchState] = useState(allStates[0])
  return (
    <MultiSwitch
      allStates={allStates}
      currentState={switchState}
      changeState={setSwitchState}
    />
  )
}
PropExplanationTypeDefaultRequired
allStatesstring[]true
currentStatestringtrue
changeState(s: string) => voidtrue
mode'default' or 'white''default'false
disabledbooleanfalsefalse
activePositionManualnumberundefinedfalse
animationConfigAnimated.TimingAnimationConfigfalse
renderStateText(s: string) => string(s: string) => sfalse
styleRootViewStyle{}false
styleAllStatesContainerViewStyle{}false
styleActiveStateViewStyle{}false
styleActiveStateTextTextStyle{}false
styleActiveStateGradientstring, string'#81cf34', '#619c27'false
styleInactiveStateViewStyle{}false
styleInactiveStateTextTextStyle{}false

Examples from videos

npm version downloads