Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added onEndReached and onEndReachedThreshold props #33

Merged
merged 2 commits into from
Jan 20, 2022

Conversation

davebcn87
Copy link
Collaborator

@davebcn87 davebcn87 commented Jan 18, 2022

Description

Added onEndReached and onEndReachedThreshold props to be able to add pagination to our lists. You can see a pagination example in the List.tsx file. Solves #31.

onEndReached

Called once when the scroll position gets within onEndReachedThreshold of the rendered content.

onEndReachedThreshold

How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.

Usage

<RecyclerFlatList
  onEndReached={() => {
    var elems = this.state.elems;
    elems.push(...this._generateArray(elems.length, 20))
    this.setState({ elems: elems })
  }}
  onEndReachedThreshold={0.5}
/>

RecyclerFlatList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
List.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
ExamplesScreen.tsx Outdated Show resolved Hide resolved
PaginatedList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
RecyclerFlatList.tsx Outdated Show resolved Hide resolved
@davebcn87 davebcn87 merged commit 78b9aa1 into main Jan 20, 2022
@davebcn87 davebcn87 deleted the feature/on-end-reached-props branch January 20, 2022 09:21
@shopify-shipit shopify-shipit bot temporarily deployed to production January 20, 2022 10:00 Inactive
This was referenced Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants