gameboyVito/react-native-ultimate-listview

onFetch is spammed

acrocat opened this issue · 1 comments

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.

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.