i6mi6 / react-native-parallax-scroll-view

A ScrollView-like component with parallax and sticky header support.
ISC License
2.3k stars 380 forks source link

FlatList onReachedEnd and stickySection is not working #97

Open bactn opened 6 years ago

bactn commented 6 years ago

I tried to put a FlatList inside your ParallaxScrollView. Basically, It seems to be worked well, but when I try to use FlatList's StickySectionHeader and onReachedEnd callback, none of them works. OnReachedEnd is never called and StickySectionHeader makes no effects.

I tried to put some logs into renderItems method and I figured out, FlatList always re-render all its items when scroll. As I know, FlatList only draws its items one by one when item appears on screen. When I use FlatList without ParallaxScrollView, It works well

Please help

kinandwair commented 6 years ago

Hi try something like this onEndReached={this._ItemLoadMore()} don't use .bind(this) this works for me

bactn commented 6 years ago

Thanks for your suggestion! I also called to load more when initialization screen. But It doesn't work for me. This is my code which using: <FlatList contentContainerStyle={styles.container} ref="ListView" initialNumToRender={this.props.data.length} data={this.props.data} stickySectionHeadersEnabled={true} renderItem={({ item }) => ( this.renderRow(item) )} onEndReached={this.onFlatListEndReached(0)} onEndReachedThreshold={0.1} stickyHeaderIndices={this.state.stickyHeaderIndices} />