UdaySravanK/RNSwipeButton

Different function calls on success of both RightToLeftSwipe and LeftToRightSwipe

Closed this issue · 1 comments

Hi, I wanted to use both LeftToRightSwipe and RightToLeftSwipe and call different functions . Is that possible at the moment ?

Hi @NishilE , Currently this component has only one callback for both types. This is because the same button cannot have both behaviors at the same time.
If you want you can have it implemented as below

const YourComponent = ({isRTL = false, rtlCallback, regularCallback}) => {
  return (
   <>
     { isRTL ? 
       <SwipeButton onSwipeSuccess={rtlCallback} enableRightToLeftSwipe/> : 
       <SwipeButton onSwipeSuccess={regularCallback} />
     }
   </>
  )
}

Please close this issue if this response answers your question. Feel free to discuss further if you have more questions.