1.0.12 ā€¢ Published 1 year ago

react-native-toggle-input v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago
NPM VERSIONNPM WEEKLY DOWNLOADSGITHUB STARYOUTUBE VIEWSNPM LIFETIME DOWNLOADS

šŸŸ¢ Customizable React Native Toggle Switch with easy to use props"

  • Use the color of your choice
  • Use bordered or filled toggle switch upon your choice
  • Works on all the platforms Android, Ios and Web in the same way
  • Zero dependencies

Compatibility

iOSAndroidWebExpo
āœ…āœ…āœ…āœ…

šŸ”Œ Installation

$ npm install react-native-toggle-input

OR

$ yarn add react-native-toggle-input

šŸ˜Ž Basic Usage

import Toggle from 'react-native-toggle-input'

const App = () => {

  const [toggle, setToggle] = React.useState(false);
  

  return(
    <Toggle toggle={toggle} setToggle={setToggle} />
  )

};

For Live Demo (Expo Snack)

ā­ Props

NameTypeDescription
colorStringColor of the toggle switch (Optional)
sizeNumberSize of the toggle switch (Optional)
filledbooleanIf you want to use filled toggle switch set it to true (Optional)
circleColorStringUse the color you want to give to the circle inside swith (Required for filled switch)
togglebooleanDefault value of the toggle switch (Required)
setToggleFunctionPass the function that will be used to set toggle status (Required)
onTrueFunctionPass the function that will executed after the switch has been turned on
onFalseFunctionPass the function that will executed after the switch has been turned off

šŸ˜Ž Advanced Usage

import Toggle from 'react-native-toggle-input'

const App = () => {

  const [toggle, setToggle] = React.useState(false);
  

  return(
    <Toggle 
        color={"#4C956C"}
        size={30}
        filled={true}
        circleColor={"white"}
        toggle={toggle}
        setToggle={setToggle}
    />
  )

};

ā–¶ļø Watch Tutorial Video

Watch video

For Live Demo (Expo Snack)