我需要在本机反应中实现 Algolia 搜索过滤器。所有过滤器,排序都在工作,但无限滚动不起作用。我正在使用 FlatList 加载列表。下面是使用的代码
import {
InstantSearch,
connectInfiniteHits,
} from 'react-instantsearch-native';
import algoliasearch from 'algoliasearch/reactnative';
<InstantSearch
searchState={{refinementListFilter }}
searchClient={searchClient}
indexName={sortValueState}
>
<VirtualWidgets />
<InfiniteHits />
</InstantSearch>
const InfiniteHits = connectInfiniteHits(({ hits, hitsPerPage, hasMore, refineNext }) => {
const onEndReached = () => {
if (!onEndReachedCalledDuringMomentum) {
if (hasMore) {
try {
refineNext();
setonEndReachedCalledDuringMomentum(true);
} catch (error) {
console.log('onEndReached22', error);
}
}
}
};
return (
<FlatList
data={hits} //hits
ref={flatListRef}
renderItem={VehicleListItem}
style={{
paddingVertical: hpx(20),
}}
contentContainerStyle={{ alignItems: 'center' }}
onEndReached={() => onEndReached()}
onEndReachedThreshold={0.1}
onMomentumScrollBegin={() => {
setonEndReachedCalledDuringMomentum(false);
}}
/>
);
});
谁能帮忙