npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-switch-component

v2.3.0

Published

A customizable switch component for React Native

Readme

Switch Component

The Switch component is compatible with both iOS and Android. The steps to include it in your React Native project are outlined below.

Dependencies

To use the Switch component, you need to install the following dependencies:

  • react-native-reanimated: For animations and transitions in the Switch.
  • react-native: The core library for building your React Native app.

You can install these dependencies using npm or yarn.

UI and Using

Switch Component Video

Get Started

Follow these steps to include the Switch component in your project:

  1. Install the necessary dependency:

First, you need to add the react-native-switch-component package to your project. This package helps you manage animations.

npm i react-native-switch-component

or


yarn add react-native-switch-component
  1. Usage with Default Values:
const App = () => {
  return (
    <Switch />
  );
};
export default App;
  1. Usage with Customized Values:
const App = () => {
  return (
    <Switch
      activeIconColor="white"
      activeBgColor="#02D95A"
      passiveIconColor="white"
      passiveBgColor="lightgray"
      dumping={20}
      startPosition={0}
      endPosition={20}
    />
  );
};
export default App;

Customizable Switch Component

This Switch component allows for extensive customization, including the ability to modify icon colors, background colors, animations, and more. You can also personalize its appearance with additional styling properties for the Switch, container, and inner box.

Props

| Property | Type | Default | Description | |------------------------|-------------------------------|------------|-----------------------------------------------------------------------------| | activeIconColor | string | white | Defines the color of the icon when the Switch is active. | | activeBgColor | string | #02D95A | Defines the background color when the Switch is active. | | passiveIconColor | string | white | Defines the color of the icon when the Switch is passive. | | passiveBgColor | string | lightgray| Defines the background color when the Switch is passive. | | dumping | number | 20 | Controls the speed (slowing down) of the animation. | | startPosition | number | 0 | Defines the starting position of the Switch's movement. | | endPosition | number | 20 | Defines the ending position of the Switch's movement. | | style | StyleProp<ViewStyle> | undefined| Allows customization of the Switch component's overall style. | | styleBoxContainer | StyleProp<ViewStyle> | undefined| Enables customization of the container's style surrounding the Switch. | | styleBox | StyleProp<ViewStyle> | undefined| Allows you to style the inner box or the toggle itself within the Switch. |

Customization

With the new style, styleBoxContainer, and styleBox properties, you can fully customize the appearance of the Switch component, its container, and the inner box, allowing it to fit seamlessly into your app's design.

Example

<Switch 
  activeIconColor="blue"
  activeBgColor="green"
  passiveIconColor="gray"
  passiveBgColor="lightgray"
  dumping={20}
  startPosition={0}
  endPosition={20}
  style={{ flex:1, justifyContent: 'center', alignItems: 'center' }}
  styleBoxContainer={{ width: 20, height: 20 }}
  styleBox={{ borderRadius: 10 }}
/>