2.0.7 • Published 1 year ago

react-native-multi-toggle-switch-fixed v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-multi-toggle-switch-fixed

MultiToggle Switch for React-Native, Expo Compatible (Web, Android, iOS)

Disclaimer

Original Autor kiok46, It was no longer being maintained so i gave it a refresh

https://github.com/kiok46/react-native-multi-toggle-switch

Try it

Expo Snack React Navite Multi Toggle Switch

https://snack.expo.dev/@navajathe/react-native-multi-toggle-switch-fixed

Android and iOS Demo

Installation

npm i react-native-multi-toggle-switch-fixed

Usage

First step: import the component:

import MultiToggleSwitch from 'react-native-multi-toggle-switch-fixed';

Second step: Use it.

    <MultiToggleSwitch defaultActiveIndex = {1}> 

        <MultiToggleSwitch.Item primaryColor={'darkgray'} onPress={() => alert('iOS')}>
            <Ionicons name={'logo-apple'} size={30} />
        </MultiToggleSwitch.Item>

        <MultiToggleSwitch.Item primaryColor={'#f7df1e'} onPress={() => alert('Web')}>
            <Ionicons name={'laptop-outline'} size={30} />   
        </MultiToggleSwitch.Item>
            
        <MultiToggleSwitch.Item primaryColor={'#a4c639'} onPress={() => alert('Android')}>
            <Ionicons name={'logo-android'} size={30} />
        </MultiToggleSwitch.Item> 

    </MultiToggleSwitch>

API

PropertyTypeDefaultDescription
defaultActiveIndexnumber0Item index which should be active when the component renders
primaryColorstring#124E96Color of icon when in non-active state & Color of icon background when in active state
secondaryColorstringwhiteColor of icon when in active state & Color of icon background when in non-active state
itemContainerstylenullStyle of item container
activeContainerStylestylenullStyle of item container when active
itemsContainerstylenullStyle of container containing all items
itemsContainerBackgroundStylestylenullBackground Style of container containing items
onPressfunctionFunction to be called as soon as the user presses any item

TODO

  • Make it usable again