npm install rn-swipe-button --save
import SwipeButton from 'rn-swipe-button';
<SwipeButton />
Android |
iOS |
iOS gif |
Android RTL |
containerStyles: PropTypes.object, disabled: PropTypes.bool, disableResetOnTap: PropTypes.bool, // After swipe success, tapping on the button resets it. Set this prop to true to disable this behavior. disabledRailBackgroundColor: PropTypes.string, disabledThumbIconBackgroundColor: PropTypes.string, disabledThumbIconBorderColor: PropTypes.string, enableReverseSwipe: PropTypes.bool, forceReset: PropTypes.func, // RNSwipeButton will call this function by passing a "reset" function as argument. Calling "reset" will reset the swipe thumb. height: PropTypes.number, onSwipeFail: PropTypes.func, onSwipeStart: PropTypes.func, onSwipeSuccess: PropTypes.func, railBackgroundColor: PropTypes.string, railBorderColor: PropTypes.string, railFillBackgroundColor: PropTypes.string, railFillBorderColor: PropTypes.string, railStyles: PropTypes.object, resetAfterSuccessAnimDelay: PropTypes.number, This is delay before resetting the button after successful swipe When shouldResetAfterSuccess = true resetAfterSuccessAnimDuration: PropTypes.number, screenReaderEnabled: PropTypes.bool, shouldResetAfterSuccess: PropTypes.bool, // If set to true, buttun resets automatically after swipe success with default delay of 1000ms swipeSuccessThreshold: PropTypes.number, // Ex: 70. Swipping 70% will be considered as successful swipe thumbIconBackgroundColor: PropTypes.string, thumbIconBorderColor: PropTypes.string, thumbIconComponent: PropTypes.node, Pass any react component to replace swipable thumb icon thumbIconImageSource: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), thumbIconStyles: PropTypes.object, thumbIconWidth: PropTypes.number, title: PropTypes.string, titleColor: PropTypes.string, titleFontSize: PropTypes.number, titleMaxFontScale: PropTypes.number, // Ex: 2. will limit font size increasing to 200% when user increases font size in device properties titleMaxLines: PropTypes.number, // Use other title related props for additional UI customization titleStyles: PropTypes.object, width: PropTypes.number,
git close https://github.com/UdaySravanK/RNSwipeButton.git
cd RNSwipeButton/examples/RNSwipeButtonDemo
yarn
To run on an android emulator
yarn android
To run on an ios simulator
yarn ios
pod deintegrate & pod install
Mapping the local npm package using `npm link` is not working for me but you can give a try and update this readme to help others.
As a workaroud, simply copy the `src` folder from the `RNSwipeButton` and paste it in `RNSwipeButtonDemo` app. In the demo app, you see `App.tsx`. When you open it, you will see a commented import and a note. Simply use the copied source code. I understand it is not the ideal way to work but this is a simple component and won't take more than 10seconds to do this.