Recyclerlistview: Pull to refresh lagging.

Created on 14 Nov 2018  路  7Comments  路  Source: Flipkart/recyclerlistview

I have RLV with RefreshControl and when i refresh, refresh indicator starts to appear and disappear. my RLV jumping. This issue present only with small amount of elements.

`
{ this.state.dataProvider && this.state.data.length > 0 &&

                <RecyclerListView
                    ref={(ref) => this.recyclerView = ref}
                    canChangeSize
                    scrollViewProps={{
                        contentContainerStyle: {paddingBottom: (isIphoneX() ? 140 : 90)},
                        stickyHeaderIndices: [1],
                        refreshControl:  
                            <RefreshControl 
                                refreshing={this.state.refreshing} 
                                onRefresh={async () => {
                                    this.setState({
                                        refreshing: true
                                    });
                                    await this.loadEmployees();
                                    this.setState({
                                        refreshing: false
                                    });
                                }}
                            />
                    }}
                    layoutProvider={this._layoutProvider} 
                    dataProvider={this.state.dataProvider} 
                    rowRenderer={this._rowRenderer}                        
                />    
            }
        </View>

`

Most helpful comment

@LVBK nice job!
After reviewing the source code, i found that _pendingScrollToOffset is used for fix scroll offset after render() called. The _pendingScrollToOffset.y maybe below 0, so in the componentDidUpdate function i add a condition like this:

image

Hope this defect would be fixed in the next released version.

All 7 comments

Can you provide an expo sample to check?

@naqvitalha
When using RLV with small amount items. Then try to pull to refresh on iOS. this bug may appear. Just try many times.
Simulator Screen Shot - iPhone 8 - 2019-10-05 at 11 38 41
Simulator Screen Shot - iPhone 8 - 2019-10-05 at 11 38 34

@naqvitalha
When i go deep inside RLV source code. Finally i find out _pendingScrollToOffset. It may keep RLV content offset larger than 0 after RLV did update.
I made changed like image below. Please tell me what features will lose or go wrong.
Screenshot 2019-10-05 at 3 29 20 PM

@LVBK nice job!
After reviewing the source code, i found that _pendingScrollToOffset is used for fix scroll offset after render() called. The _pendingScrollToOffset.y maybe below 0, so in the componentDidUpdate function i add a condition like this:

image

Hope this defect would be fixed in the next released version.

@xmuSistone yeah, you're right.

@xmuSistone Thanks for the solution.

@LVBK Could you provide a demo to reproduce the issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

waheedakhtar694 picture waheedakhtar694  路  6Comments

VilleKokkarinen picture VilleKokkarinen  路  6Comments

Komeyl94 picture Komeyl94  路  9Comments

ajinkyadesai11-git picture ajinkyadesai11-git  路  4Comments

leifermendez picture leifermendez  路  8Comments