gameboyVito / react-native-ultimate-listview

A high performance FlatList providing customised pull-to-refresh | auto-pagination & infinite-scrolling | gridview layout | swipeable-row.
https://www.npmjs.com/package/react-native-ultimate-listview
MIT License
540 stars 87 forks source link

onFetch is spammed #36

Closed acrocat closed 6 years ago

acrocat commented 6 years ago

It feels like the ListView is ignoring the threshold completely and just calls onFetch successively until an empty array is returned.

                    <UltimateListView
                        onFetch={props.onFetch}
                        keyExtraction={(item , index) => `${item.name} - ${index}`}
                        item={(rowData) => {
                            return <EventListCard
                                    onPress={() => { props.tappedResult(rowData) }}
                                    event={rowData} />
                        }}
                    />

The fetch method being called:

        _fetch (page = 1 , startFetch , abortFetch) {
            if (term = this.props.navigation.state.params.term) {
                this._performSearch(term , page).then(data => {
                    // We have the data from the search
                    return startFetch(data , 20);
                });
            } else {
                console.log("We do not have a search term");
                return abortFetch();
            }
        }

Any help, even a work around for this would be appreciated.

acrocat commented 6 years ago

Turns out this is an issue with nesting a FlatList inside a ScrollView. I am now instead rendering the UltimateListView as the root component and putting my 'non-list' components in the header of that FlatList.