diff --git a/README.md b/README.md index 7a141d2a..3b90aa36 100644 --- a/README.md +++ b/README.md @@ -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 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 | | onVisibleIndicesChanged | No | TOnItemStatusChanged | Provides visible index; helpful in sending impression events | | onVisibleIndexesChanged | No | TOnItemStatusChanged | (Deprecated in 2.0 beta) Provides visible index; helpful in sending impression events | | renderFooter | No | () => JSX.Element \| JSX.Element[] \| null | Provide this method if you want to render a footer. Helpful in showing a loader while doing incremental loads | diff --git a/src/core/RecyclerListView.tsx b/src/core/RecyclerListView.tsx index ec133b7e..32c965de 100644 --- a/src/core/RecyclerListView.tsx +++ b/src/core/RecyclerListView.tsx @@ -87,6 +87,7 @@ export interface RecyclerListViewProps { onRecreate?: (params: OnRecreateParams) => void; onEndReached?: () => void; onEndReachedThreshold?: number; + onEndReachedThresholdRelative?: number; onVisibleIndexesChanged?: TOnItemStatusChanged; onVisibleIndicesChanged?: TOnItemStatusChanged; renderFooter?: () => JSX.Element | JSX.Element[] | null; @@ -126,6 +127,7 @@ export default class RecyclerListView
(this.props.onEndReachedThreshold, 0)) {
+ const threshold = windowBound - lastOffset;
+
+ const listLength = this.props.isHorizontal ? this._layout.width : this._layout.height;
+ const triggerOnEndThresholdRelative = listLength * Default.value