OnEndReached is called once by default for initialization and once for updating data
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 393
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided FlashList usage with onEndReached, onEndReachedThreshold, estimatedItemSize, and updating data. Trace the FlashList onEndReached entry point to distinguish initialization from user-triggered loading, then define the expected behavior and verify it with a regression test; no source file or test path is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100