🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@freakycoder/react-native-switch-button

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freakycoder/react-native-switch-button

Animated switch button with fully customizable React Native Component

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source
React Native Switch Button

Battle Tested ✅

React Native Switch Button

npm version npm Platform - Android and iOS License: MIT styled with prettier

React Native Switch Button

Installation

Add the dependency:

npm i @freakycoder/react-native-switch-button

Peer Dependencies

IMPORTANT! You need install them
"@freakycoder/react-native-bounceable": ">= 0.2.5"

Usage

Import

import SwitchButton from "@freakycoder/react-native-switch-button";

Fundamental Usage

<SwitchButton
  text="Notification"
  inactiveImageSource={require("./assets/notification.png")}
  activeImageSource={require("./assets/notification-3.png")}
  onPress={(isActive: boolean) => console.log(isActive)}
/>

Example Project 😍

You can checkout the example project 🥰

Simply run

  • npm i
  • react-native run-ios/android

should work of the example project.

Configuration - Props

PropertyTypeDefaultDescription
textstringundefinedset the text of the button
activeImageSourceImage Sourceundefinedset the active image source
inactiveImageSourceImage Sourceundefinedset the inactive image source
isActivebooleanfalseset the active state initially
onPressfunctiondefaultset your own logic for onPress functionality
mainColorstring#f1bb7bchange the main animated color
originalColorstring#fffchange the original/default animated color
tintColorstring#f1bb7bchange the tint color for the image
disableTextbooleanfalsedisable the text part if you only want to use switch button itself
styleViewStyledefaultset or override the style object for the main container
textStyleTextStyledefaultset or override the style object for the text
imageStyleImageStyledefaultset or override the style object for the image
textContainerStyleViewStyledefaultset or override the style object for text container

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Author

FreakyCoder, kurayogun@gmail.com

License

React Native Switch Button is available under the MIT license. See the LICENSE file for more info.

Keywords

switch

FAQs

Package last updated on 16 Aug 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