Skip to content

Setting index property scrolls to wrong offset when using flexbox layout #651

@loganrockmore

Description

@loganrockmore

Which OS ?

iOS 11

Version

react-native-swiper v1.5.13

How to reproduce it

Here is the view that reproduces the problem:

<View style={{backgroundColor: 'white', flex: 1, alignItems: 'center', justifyContent: 'center',}}>
  <View style={{width: 300, height: 300,}}>
    <Swiper index={1} loop={false}>
      <View style={{backgroundColor: 'blue', flex: 1,}} />
      <View style={{backgroundColor: 'orange', flex: 1,}} />
      <View style={{backgroundColor: 'black', flex: 1,}} />
    </Swiper>
  </View>
</View>

Since the Swiper is using flex: 1 to render at a size that's smaller than the window, setting the index={1} scrolls the scroll view too far.

Expected behaviour

screen shot 2017-11-09 at 6 12 45 pm

Actual behaviour

screen shot 2017-11-09 at 6 12 54 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions