Skip to content

Commit 6d1bacf

Browse files
committed
fix long screen issue
1 parent d5b4e52 commit 6d1bacf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/index.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,19 @@ 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;
146+
const fetchAgain = (this._infScroll && this._scrollableNode) && this._scrollableNode.clientHeight > this._infScroll.scrollHeight
147+
if(fetchAgain){
148+
this.actionTriggered = true;
149+
this.setState({ showLoader: true })
150+
this.props.next()
151+
}else {
152+
this.actionTriggered = false;
153+
// update state when new data was sent in
154+
this.setState({
155+
showLoader: false,
156+
});
157+
}
147158

148-
// update state when new data was sent in
149-
this.setState({
150-
showLoader: false,
151-
});
152159
}
153160

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

0 commit comments

Comments
 (0)