0.0.4 • Published 2 years ago

react-native-toggle-with-text v0.0.4

Weekly downloads
-
License
license
Repository
github
Last release
2 years ago

Toggle-button--with-text-component

A react native component that show toggle button with text

  • Pure JS.
  • Compatible with both iOS and Android.
  • Highly customizable.

first image states - button is in active state / second image states - button is in inActive state

Tech

  • use disabled boolean to disable the button
  • onActive function will be trigger in first render
  • you can use your own images for active or inactive states

Installation

npm i react-native-toggle-with-text

Example

Import this module:

import ToggleButtonWithText from 'react-native-toggle-with-text';

Use as a component:

<ToggleButtonWithText 
        onActive={() => console.log('online')} 
        onDisable={() => console.log('offline')} />
PropTypeOptionalDefaultDescription
activeTextStringYESonlineActive state text
inActiveTextStringYESofflineinActive state text
ActiveImageStringYESActive imagethis is the image for active state
inActiveImageStringYESinActive imageInActive imagethis is the image for inactive state
activeImageStyleStringYESdefualtstyle of active image style
inActiveImageStyleStringYESdefualtstyle of inactive image style
backgroundActiveStringYES'transparent'background color of active state
backgroundInactiveStringYES'transparent'background color of inactive state
containerWidthnumberYES100button width
containerheightnumberYES30button height
borderRadiusnumberYES15button border radius
textStyleobjectYESdefualtstyle of text
disabledbooleanYESfalseenable button interaction
onActivefunctionYES' 'this is a function trigger when button in active state
onInActivefunctionYES' 'this is a function trigger when button in inActive state

Development

Any suggestion is welcome.