React native FlatList VirtualizedList:您有一个更新缓慢的大列表
对不起,如果这是一些其他职位的重复。我试图按照我能找到的建议解决方案进行操作,但我一直得到这个React native FlatList VirtualizedList:您有一个更新缓慢的大列表,react-native,expo,react-native-flatlist,React Native,Expo,React Native Flatlist,对不起,如果这是一些其他职位的重复。我试图按照我能找到的建议解决方案进行操作,但我一直得到这个VirtualizedList:您有一个更新缓慢的大列表…error 我有一张底片和一张单子 const renderBottomSheetRestaurantList = () => ( <View style={{ height: topSnapPoint }}> <FlatList ref={restaurantList} data={r
VirtualizedList:您有一个更新缓慢的大列表…
error
我有一张底片和一张单子
const renderBottomSheetRestaurantList = () => (
<View style={{ height: topSnapPoint }}>
<FlatList
ref={restaurantList}
data={restaurants}
keyExtractor={(item) => `row-${item.id}`}
renderItem={renderRestaurantRows}
onEndReached={() => {
setLoadMore(true);
}}
/>
</View>
);
const [loadMore, setLoadMore] = useState(false);
useEffect(() => {
if (loadMore) {
initSearch({ searchQuery, region, filterOptions, priceOptions, loadMore });
}
return () => {
setLoadMore(false);
};
}, [filterOptions, initSearch, loadMore, priceOptions, region, searchQuery]);
onEndReached
被命中三次并加载60条记录,然后我得到错误消息:
VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc. Object {
"contentLength": 5760.33349609375,
"dt": 2381,
"prevDt": 1025,
}
这当然不是一个很长的清单
我一定是做错了什么,但是什么
const RestaurantListRow: React.FC<Restaurant & RestaurantNavigationProps> = React.memo(
(item) => {
const {
id,
name,
rating,
reviews,
meals,
location,
coordinates,
open_now,
opening_hours,
} = item;
return (
<View>
<RestaurantDetails
id={id}
name={name}
rating={rating}
reviews={reviews}
meals={meals}
location={location}
coordinates={coordinates}
open_now={open_now}
opening_hours={opening_hours}
containerStyles={styles.something}
/>
<Divider />
</View>
);
},
() => true
);
export default RestaurantListRow;
VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc. Object {
"contentLength": 5760.33349609375,
"dt": 2381,
"prevDt": 1025,
}