Skip to content

OnEndReached is called once by default for initialization and once for updating data #1984

@Holmes-zf

Description

@Holmes-zf

return (

<FlashList
ref={listRef}
contentContainerStyle={styles.list}
renderItem={renderItem}
onRefresh={onRefresh}
refreshing={state.refreshStatus == RefreshStatus.HeaderRefreshing}
ItemSeparatorComponent={Separator}
keyExtractor={keyExtractor}
onEndReached={onEndReached}
onEndReachedThreshold={0.1}
ListEmptyComponent={DataEmpty}
ListFooterComponent={Footer}
estimatedItemSize={100}
{...props}
/>

);

不论是设置estimatedItemSize,还是固定父高度,依旧会调用onEndReached,这个设计我认为是不太合理的,为什么要自动调用这个函数,底部加载更多不应该是我手动触发的吗?需要初始化预加载还是如何都不应该不可控制或没有说明的默认调用onEndReached,还是说组件在初始化的时候,无法知道是手动下拉还是初始化?

Whether it's setting estimatedItemSize or fixing the parent height, the onEndReached function is still called. I think this design is not very reasonable. Why should this function be automatically called? Shouldn't I manually trigger the loading of more at the bottom? Should the preload be initialized or should there be no uncontrollable or unspecified default invocation of onEndReached, or should the component be initialized without knowing whether it is manually pulled down or initialized?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions