1.0.3 • Published 2 years ago

rn-slide-button v1.0.3

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

React Native Slide Button

A simple slide button using Reanimated 2 animation library.

Preview

@

Installation

npm install --save rn-slide-button

or

yarn add rn-slide-button

Dependencies

yarn add react-native-gesture-handler react-native-reanimated

Usage

import SlideButton from 'rn-slide-button';

// ...
<SlideButton title="Slide To Unlock"/>;
// ...

Component props

proptypedefaultdescription
widthnumberscreen widthbutton width.
heightnumber60button height.
borderRadiusnumber30button corner radius.
completeThresholdnumber70determinates whether the thumb will reach to the end or to start. (value should be 0-100)
paddingnumber5button content padding.
disabledbooleanfalsechanges button touchability.
reverseSlideEnabledbooleantrueenable/disable thumb's back sliding feature
titlestringSlide to savebutton title.
titleStyleobjectobjectbutton title styling.
titleContainerStyleobjectobjectbutton title container styling.
iconImage/ Elementnullthumb icon.
thumbStyleobjectobjectthumb container styling.
containerStyleobjectobjectbutton container styling.
underlayStyleobjectobjectthumb underlay view styling.
autoResetbooleanfalsethumb will reset its position if it's set to true
autoResetDelaynumber1080msdelay time to reset
animationbooleanfalsethum will animate if it's set to true
animationDurationnumber180msanimation duration time
onSlideStartfunc() => {}it will be invoked when sliding starts
onSlideEndfunc() => {}it will be invoked when sliding ends
onReachedToStartfunc() => {}it will be invoked when thumb reaches to start
onReachedToEndfunc() => {}it will be invoked when thumb reaches to end

License

MIT