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

Wrong position when rendering large list #479

Closed
dnish opened this issue Feb 13, 2019 · 1 comment
Closed

Wrong position when rendering large list #479

dnish opened this issue Feb 13, 2019 · 1 comment

Comments

@dnish
Copy link

dnish commented Feb 13, 2019

I'm having an issue when rendering a large list and setting the firstItem to an item within the list. When I render the carousel, it suddenly looks like this:

img_2d08fee859c1-1

This is how the carousel looks on a small list:

img_c05a8c392d1d-1

This is how I init the component:

   <Carousel
                    ref="covers"
                    data={this.getUserFiles()}
                    renderItem={this.renderCover}
                    sliderWidth={viewportWidth}
                    itemWidth={viewportWidth * 0.8}
                    inactiveSlideScale={0.9}
                    inactiveSlideOpacity={0.6}
                    snapOnAndroid={true}
                    onSnapToItem={this.onSnap}
                    firstItem={PlayerStore.playlist.currentIndex}
                    layoutCardOffset={18}
                />


const styles = StyleSheet.create({

    covers: {
        height: viewportWidth * 0.8,
    },
    cover: {
        width: viewportWidth * 0.8,
        height: viewportWidth * 0.8
    },

});

If I set useScrollView = true it is working fine again, but I want to use the FlatList component due to performance reasons. Any idea how I can fix the wrong position?

Tested on iPhone XS.

@bd-arc
Copy link
Contributor

bd-arc commented Feb 14, 2019

This is a well-known and unfortunate FlatList bug.

See #363 for more info. #250 seems like the only way to get rid of it...

@bd-arc bd-arc closed this as completed Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants