react-native-deck-swiper icon indicating copy to clipboard operation
react-native-deck-swiper copied to clipboard

Triggering swipeLeft on button which is outside of Swiper; Triggering function while swiping left or right

Open web-mickey opened this issue 5 years ago • 3 comments

Hi,

  • I have application where I have some buttons outside of Swiper component and would like to swipe left or right when I press the button. How can I do it?

  • I would like to show something while I am swiping to left or right. I know there is a function "onSwiping" but how can I know that I am swiping left or right to show different text?

web-mickey avatar Dec 10 '19 15:12 web-mickey

Hi,

  • I have application where I have some buttons outside of Swiper component and would like to swipe left or right when I press the button. How can I do it?
  • I would like to show something while I am swiping to left or right. I know there is a function "onSwiping" but how can I know that I am swiping left or right to show different text?

Have you find any solution for this please share.

gauravsbagul avatar Mar 05 '20 10:03 gauravsbagul

@gauravsbagul @Mikowhy-owl

<Swiper ref={swiper=>{ this.swiper = swiper }}/>

In your <Swiper /> add a reference, and you can use this reference to swipe the card left or right on a button click which is outside the swiper. To swipe left this.swiper.swipeLeft(); To swipe right this.swiper.swipeRight();

in-techouse avatar Mar 28 '20 15:03 in-techouse

Hi found the solution <Swiper ref={'swiper'} key={this.state.questions.length} {swiperItems} </Swiper>

and this.refs.swiper.scrollBy(1);

gauravsbagul avatar Mar 28 '20 15:03 gauravsbagul