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

#104: Convert onEndReachedThreshold from pixels to ratio #148

Merged
merged 4 commits into from
Mar 11, 2022

Conversation

ElviraBurchik
Copy link
Contributor

Description

Resolves #104

RecyclerListView uses number of pixels for onEndReachedThreshold (ex: 100). FlatList uses percentage of screen (ex: 0.2). To simplify for a developer using RecyclerFlatList we do this conversion inside the wrapper.

I've added a new prop to recyclerlistview to accept relative value. It was not possible to do on the wrapper side.

Reviewers’ hat-rack 🎩

Run Twitter example and scroll down to the bottom. Close to the end on 50% of the screenonEndReached should appear in the console.

Screenshots or videos (if needed)

Checklist

Comment on lines 25 to 28
onEndReachedThreshold={0.5}
onEndReached={() => {
console.log("onEndReached");
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add this to the Twitter example when it serves no purpose here afaict? We already have a PaginatedList that leverages onEndReached.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it for testing purpose, you're right, PaginatedList fits better for it 👍

@@ -40,7 +40,7 @@
"metro-react-native-babel-preset": "^0.66.2",
"react": "17.0.2",
"react-native": "0.66.4",
"recyclerlistview": "3.1.0-beta.5",
"recyclerlistview": "3.1.0-beta.6",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you do a search-and-replace for this change? There are other places where recyclerlistview version is mentioned and they have not been changed (for example in documentation)

@ElviraBurchik ElviraBurchik force-pushed the feat/onEndReachedThreshold-percent-to-pixels branch from f7409f7 to 6b4824b Compare March 11, 2022 10:49
@@ -17,7 +17,7 @@ Check out [the Vault project](https://vault.shopify.io/projects/22845) to learn

### Adding a package to your project

Add the package to your project via `yarn add @shopify/flash-list recyclerlistview@3.1.0-beta.5` and run `pod install` in the `ios` directory.
Add the package to your project via `yarn add @shopify/flash-list recyclerlistview@3.1.0-beta.6` and run `pod install` in the `ios` directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md should also be updated

@ElviraBurchik ElviraBurchik force-pushed the feat/onEndReachedThreshold-percent-to-pixels branch from aadd8e7 to 35d6641 Compare March 11, 2022 16:39
@@ -40,7 +40,7 @@
"metro-react-native-babel-preset": "^0.66.2",
"react": "17.0.2",
"react-native": "0.66.4",
"recyclerlistview": "3.1.0-beta.5",
"recyclerlistview": "3.1.0-beta.6",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple readme files where version is referenced. Search all and change. It's there in install steps too.

@ElviraBurchik ElviraBurchik merged commit c5a353c into main Mar 11, 2022
@ElviraBurchik ElviraBurchik deleted the feat/onEndReachedThreshold-percent-to-pixels branch March 17, 2022 08:34
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.

Convert onEndReachedThreshold from pixels to ratio
3 participants