Flipkart / recyclerlistview

High performance listview for React Native and web!
Apache License 2.0
5.17k stars 422 forks source link

Pull to refresh lagging. #273

Open mmamoyco opened 5 years ago

mmamoyco commented 5 years ago

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.

` <View style={{minHeight: Dimensions.get('window').height, width: Dimensions.get('window').width}}>
{ 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>

`

naqvitalha commented 5 years ago

Can you provide an expo sample to check?

LVBK commented 4 years ago

@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

LVBK commented 4 years ago

@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

xmuSistone commented 4 years ago

@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.

LVBK commented 4 years ago

@xmuSistone yeah, you're right.

arunreddy10 commented 4 years ago

@xmuSistone Thanks for the solution.

arunreddy10 commented 4 years ago

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

aim8526 commented 3 years ago

is issue still open or solved?

saurabh874 commented 3 years ago

Hi i am facing same is anyone have solution for same? even when i drag the list for pull_to_refresh it is automatically release not like flatlist.

aim8526 commented 3 years ago

Hi i am facing same is anyone have solution for same? even when i drag the list for pull_to_refresh it is automatically release not like flatlist.

I try to add this param and pull to refresh start working... <RecyclerListView scrollViewProps={{ refreshControl: ( <RefreshControl refreshing={loader} onRefresh={() => { // start loader // do the stuff u want //stop the loader }} /> ), }} />

saurabh874 commented 3 years ago

thanks @aim8526 but my problem is pull_to_refresh it is automatically release without drop it.

AlexSirenko commented 2 years ago

Lagging when items in the list fit less the container height