如何解决Flatlist不支持同时设置onViewableItemsChanged和viewabilityConfigCallbackPairs
我有一个这样的单位列表:
<AnimatedFlatList
onViewableItemsChanged={({ viewableItems }) =>
console.log("Data: " + JSON.stringify(viewableItems))
}
ref={scrollRef => {
this.scrollRef = scrollRef;
}}
data={this.getDataSource()}
contentContainerStyle={[
!_.isEmpty(this.getPageActions())
? { paddingBottom: this.getScaledHeight(80) }
: {},this.getContentContainerStyle(),]}
onScrollToIndexFailed={info => {
const scrollView = this.getScrollViewNode(this.scrollRef);
if (scrollView)
scrollView.scrollToOffset({
offset: info.averageItemLength * info.index,animated: true,});
const wait = new Promise(resolve => setTimeout(resolve,100));
wait.then(() => {
if (scrollView)
scrollView.scrollToIndex({
index: info.index,});
});
}}
onScroll={this._onScroll}
showsVerticalScrollIndicator={false}
removeClippedSubviews={false}
ListHeaderComponent={this._renderListHeader}
ListFooterComponent={this._renderListFooter}
ItemSeparatorComponent={this._renderDivider}
keyExtractor={this._keyExtractor}
onEndReachedThreshold={0.5}
onEndReached={() => {
if (this.paginationEnabled()) this.onEndReached();
}}
{...this.getlistProps()}
renderItem={this._renderItem}
/>
我已经设置了onViewableItemsChanged,但是在应用启动后,我不断收到错误消息: 单位列表不支持同时设置onViewableItemsChanged和viewabilityConfigCallbackPairs
我看不到设置了 viewabilityConfigCallbackPairs 。因此无法弄清楚这里出了什么问题。有人可以帮忙吗?
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。