File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,34 @@ import InfiniteScroll from 'react-infinite-scroller';
5656</div >
5757```
5858
59+ ### Custom parent element
60+
61+ You can define a custom ` parentNode ` element to base the scroll calulations on.
62+
63+ ```
64+ class InfiniteScrollOverride extends InfiniteScroll {
65+
66+ /**
67+ * We are overriding the getParentElement function to use a custom element as the scrollable element
68+ *
69+ * @param {any} el the scroller domNode
70+ * @returns {any} the parentNode to base the scroll calulations on
71+ *
72+ * @memberOf InfiniteScrollOverride
73+ */
74+ getParentElement(el) {
75+ if (this.props.scrollParent) {
76+ return this.props.scrollParent;
77+ }
78+ return super.getParentElement(el);
79+ }
80+
81+ render() {
82+ return super.render();
83+ }
84+ }
85+ ```
86+
5987## Props
6088
6189| Name | Type | Default | Description|
You can’t perform that action at this time.
0 commit comments