Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-switch-toggle

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-switch-toggle

Highly customizable animating react native switch toggle component.

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2K
decreased by-37.93%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-switch-toggle

Simple switch toggle component for react-native. This component supports horizontal switch toggle with animation with several options like start/end background colors, start/end circle colors, and duration for animation.

Npm Version Downloads CI codecov code style: prettier LICENSE PRs Welcome supports iOS supports Android supports web runs with expo

News

Current package is fully redesigned in 2.0.0. We recommend you to use this package version >=2.0.0.

Alternative

Do you enjoy using react-native-switch-toggle? Then think about using dooboo-ui which is our ui integrated ilbrary. It included SwitchToggle from 0.1.6.

yarn add doobo-ui

Props

necessarytypesdefault
switchOnbooleanfalse
onPressfunc() => {}
containerStylestyles{ width: 80, height: 40, borderRadius: 25 ... }
circleStylestyles{ width: 32, height: 32, borderRadius: 16 ... }
backgroundColorOnstring'black'
backgroundColorOffstring'#C4C4C4'
circleColorOnstring'white'
circleColorOffstring'#C4C4C4'
durationnumber300
typenumber0 - Normal switch, 1 - Switch with a text
buttonTextstringText on-top of the button
backTextRightstringText to appear in right side when button toggled to left
backTextLeftstringText to appear in left side when button toggled to right
buttonTextStylestylesStyles for text on the button
textRightStylestylesStyles for text in right
textLeftStylestylesStyles for text in left
buttonStylestylesStyles for the button
buttonContainerStylestylesStyles for button container
rightContainerStylestylesStyles for right text container
leftContainerStylestylesStyles for left text container

Getting started

$ npm install react-native-switch-toggle --save

import SwitchToggle from "react-native-switch-toggle";
Basic Style
<SwitchToggle switchOn={on} onPress={() => off(!on)} />
Custom Color
<SwitchToggle
  switchOn={on}
  onPress={() => off(!on)}
  circleColorOff='#C4C4C4'
  circleColorOn='#00D9D5'
  backgroundColorOn='#6D6D6D'
  backgroundColorOff='#C4C4C4'
/>

Custom Size

<SwitchToggle
  switchOn={on}
  onPress={() => off(!on)}
  containerStyle={{
    marginTop: 16,
    width: 106,
    height: 48,
    borderRadius: 25,
    padding: 5,
  }}
  circleStyle={{
    width: 40,
    height: 40,
    borderRadius: 20,
  }}
/>

Keywords

FAQs

Package last updated on 12 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc