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

Fix for onEndReached not getting called #46

Merged
merged 1 commit into from
Sep 5, 2022
Merged

Fix for onEndReached not getting called #46

merged 1 commit into from
Sep 5, 2022

Conversation

Vin-Xi
Copy link
Contributor

@Vin-Xi Vin-Xi commented Sep 5, 2022

Description

This PR focuses on fixing onEndReached not getting called. The reason why it sometimes doesn't get called is because of this particular line

layoutMeasurement.height + contentOffset.y >= contentSize.height - paddingToBottom

Where both sides sometimes evaluate to a 6 decimal place number and because of three different measurements (height,offset, total height), comparing them introduces inaccuracy. For example if the 6th decimal point is 0 on left hand side and its 1 on right hand side. Then even if we are at the end, this function will not get called because the fore mentioned line will evaluate to false. To fix this, I have removed the decimal points from the left hand side by using Math.Ceil. This will call the function by removing uncertainties of the decimal points.

Related Issues

N/A

Tests

N/A

Checklist

Before you create this PR confirms that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • [✅ ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [ ✅ ] Run yarn lint && yarn tsc
  • Run yarn test or yarn test -u if you need to update snapshot.
  • [ ✅ ] I am willing to follow-up on review comments in a timely manner.

@hyochan hyochan added 🍗 enhancement New feature or request 🛠 bugfix All kinds of bug fixes labels Sep 5, 2022
Copy link
Owner

@hyochan hyochan left a comment

Choose a reason for hiding this comment

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

Looks great~ Thanks a lot!

@hyochan hyochan merged commit 1cc6c69 into hyochan:main Sep 5, 2022
hyochan added a commit to hyochan/reanimated-masonry-list that referenced this pull request Oct 10, 2022
hyochan added a commit to hyochan/reanimated-masonry-list that referenced this pull request Oct 10, 2022
* chore: create LICENSE

* feat: avoid two taps requirement for android

* feat: add optional refreshControl

   Improvements from hyochan/react-native-masonry-list#39

* chore: vscode settings.json

* fix: onEndReached not getting called

   Improvements in hyochan/react-native-masonry-list#46

* build: update pkgs and fix typings

* fix: linting in example
@hotaryuzaki
Copy link

which version is it??
i use 1.4.1 and still have an issue in android, sometimes onEndReached not called.

@satyam16998
Copy link

@hyochan onEndReached is not called at all in any condition. Please check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠 bugfix All kinds of bug fixes 🍗 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants