Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing orientation causes items to be misaligned #77

Open
bajh opened this issue Dec 13, 2020 · 0 comments
Open

changing orientation causes items to be misaligned #77

bajh opened this issue Dec 13, 2020 · 0 comments

Comments

@bajh
Copy link

bajh commented Dec 13, 2020

If I change orientations while a SideSwipe instance is rendered, the items will initially be misaligned, see screenshot below. If I swipe around a bit the carousel item will lock back into its proper place and work fine from that point on. The problem seems to only exist immediately after the orientation change. No idea if this is a bug or if there's something I can add to get around it, but any help would be very much appreciated!

Code:

    <View style={{flex: 1}}>
      <SideSwipe
        index={ix}
        itemWidth={width}
        style={{width}}
        data={images}
        contentOffset={0}
        onIndexChange={ix => setIx(ix)}
        renderItem={({item: image, itemIndex}) => {
          return (
            <GalleryImage image={image} index={itemIndex} navigation={navigation} />
          )
        }}
      />
  </View>

Example:

Initially loaded with portrait orientation:

image

Immediately after switching to landscape:

image

After swiping around in landscape:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant