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

swiping after orientation change does not work as expected when initial index is defined

Open nivshaked opened this issue 7 years ago • 4 comments

  • react-native-swiper v1.5.13
  • react-native v0.43.0

when changing orientation the first swipe goes to the index defined as the initial index, instead of the index swiped to.

thx :)

nivshaked avatar Oct 14 '17 19:10 nivshaked

I'm seeing this issue as well, regardless if the initial index is defined. Did you ever figure out a workaround?

skicson avatar Jan 09 '19 14:01 skicson

Hey! I found a workaround for this issue:

  • I keep the current index in my component's state
  • I pass the index as a prop when creating the Swiper
<Swiper
    index={this.state.index}
    onIndexChanged={index => {
        this.setState({ index });
    }}
/>

ericluong avatar Apr 16 '19 12:04 ericluong

@ericluong you save my life <3

nguyenvanphuc2203 avatar Aug 26 '19 04:08 nguyenvanphuc2203

That not work for me on functional components.

After set state with hook, component move to wrong "tab" index

luisfuertes avatar Aug 18 '21 13:08 luisfuertes