Skip to content

Commit 51937f7

Browse files
committed
fix long screen issue
1 parent d5b4e52 commit 51937f7

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/index.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,21 @@ export default class InfiniteScroll extends Component<Props, State> {
143143
// do nothing when dataLength is unchanged
144144
if (this.props.dataLength === prevProps.dataLength) return;
145145

146-
this.actionTriggered = false;
147-
148-
// update state when new data was sent in
149-
this.setState({
150-
showLoader: false,
151-
});
146+
const fetchAgain =
147+
this._infScroll &&
148+
this._scrollableNode &&
149+
this._scrollableNode.clientHeight > this._infScroll.scrollHeight;
150+
if (fetchAgain) {
151+
this.actionTriggered = true;
152+
this.setState({ showLoader: true });
153+
this.props.next();
154+
} else {
155+
this.actionTriggered = false;
156+
// update state when new data was sent in
157+
this.setState({
158+
showLoader: false,
159+
});
160+
}
152161
}
153162

154163
static getDerivedStateFromProps(nextProps: Props, prevState: State) {

0 commit comments

Comments
 (0)