-
Notifications
You must be signed in to change notification settings - Fork 274
Loading items on container height dynamically changed #192
base: master
Are you sure you want to change the base?
Conversation
Ping |
Do you have any objections? |
src/react-infinite.jsx
Outdated
@@ -305,6 +305,15 @@ var Infinite = React.createClass({ | |||
if (isMissingVisibleRows) { | |||
this.onInfiniteLoad(); | |||
} | |||
|
|||
if (this.props.containerHeight !== prevProps.containerHeight) { |
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.
containerHeight
is computed in generateComputedProps
so you can't get the previous value by this way
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.
Fixed
src/react-infinite.jsx
Outdated
|
||
if (this.props.containerHeight !== prevProps.containerHeight) { | ||
const scrollTop = this.utils.getScrollTop(); | ||
const newApertureState = infiniteHelpers.recomputeApertureStateFromOptionsAndScrollTop(this.state, scrollTop); |
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.
You may rely on handleScroll
for the rest ?
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.
Yes, thanks, it is much simpler now
@@ -448,6 +448,37 @@ describe("React Infinite's Infinite Scroll Capabilities", function() { | |||
expect(infiniteSpy).not.toHaveBeenCalled(); | |||
}); | |||
|
|||
it('triggers the onInfiniteLoad function when containerHeight changes', function() { |
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.
you may provide the case where useWindowAsScrollContainer
is true
so when containerHeight
changes, onInfiniteLoad
is not called
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.
Fixed
…containerHeight value source.
In my case, the container size is not fixed and is changed according to page size (flexible markup).
The problem appears when the page is resized without scroll events on
react-infinite
component, it leads to empty space below previously loaded requests. The PR fixes it.The PR includes tests.