Coder Social home page Coder Social logo

trendingtechnology / react-native-switch-button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wrathchaos/react-native-switch-button

0.0 1.0 0.0 9.82 MB

Animated switch button with fully customizable React Native Component

Home Page: https://freakycoder.com

JavaScript 20.98% Starlark 2.44% Java 25.09% Ruby 2.96% Objective-C 18.18% TypeScript 30.35%

react-native-switch-button's Introduction

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

Property Type Default Description
text string undefined set the text of the button
activeImageSource Image Source undefined set the active image source
inactiveImageSource Image Source undefined set the inactive image source
isActive boolean false set the active state initially
onPress function default set your own logic for onPress functionality
mainColor string #f1bb7b change the main animated color
originalColor string #fff change the original/default animated color
tintColor string #f1bb7b change the tint color for the image
disableText boolean false disable the text part if you only want to use switch button itself
style ViewStyle default set or override the style object for the main container
textStyle TextStyle default set or override the style object for the text
imageStyle ImageStyle default set or override the style object for the image
textContainerStyle ViewStyle default set or override the style object for text container

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Author

FreakyCoder, [email protected]

License

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

react-native-switch-button's People

Contributors

wrathchaos avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.