-
Notifications
You must be signed in to change notification settings - Fork 427
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
Add a new prop - onEndReachedThresholdRelative #695
Add a new prop - onEndReachedThresholdRelative #695
Conversation
src/core/RecyclerListView.tsx
Outdated
if (windowBound - lastOffset <= Default.value<number>(this.props.onEndReachedThreshold, 0)) { | ||
const threshold = windowBound - lastOffset | ||
|
||
const triggerOnEndThresholdRelative = windowBound * Default.value<number>(this.props.onEndReachedThresholdRelative, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the bound here refers to maxScrollOffset so this compute can be wrong. Our check needs to be something like threshold <= this._layout.height * relative_threshold
src/core/RecyclerListView.tsx
Outdated
const threshold = windowBound - lastOffset | ||
|
||
const triggerOnEndThresholdRelative = windowBound * Default.value<number>(this.props.onEndReachedThresholdRelative, 0); | ||
const triggerOnEndThreshold = windowBound * Default.value<number>(this.props.onEndReachedThreshold, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This multiplication is not needed
README.md
Outdated
@@ -90,6 +90,7 @@ In case you cannot determine heights of items in advance just set `forceNonDeter | |||
| externalScrollView | No | { new (props: ScrollViewDefaultProps): BaseScrollView } | Use this to pass your on implementation of BaseScrollView | | |||
| onEndReached | No | () => void | Callback function executed when the end of the view is hit (minus onEndThreshold if defined) | | |||
| onEndReachedThreshold | No | number | Specify how many pixels in advance for the onEndReached callback | | |||
| onEndReachedThresholdRelative | No | number | Specify the percent of a view in advance for the onEndReached callback | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rephrase this IMO. It's a little difficult to understand right now.
@ElviraBurchik you will need to look into the lint issues. CI checks are failing |
- Update new prop description in readme
@naqvitalha I've addressed your comments and fix lint issues, but looks like I can't re-run CI check myself. |
What
Adds a new prop
onEndReachedThresholdRelative
identical to theonEndReachedThreshold
of FlatList.It allows to specify 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