Inf-scroll: Change region to 'main' to ignore long tag/following list.

## Issue:
2789 `Infinite scrolling should activate at end of listed claims, not subscription list`
This commit is contained in:
infiinte-persistence 2020-07-02 13:38:25 +08:00 committed by Sean Yesmunt
parent dad10f1118
commit 16ea14887c

View file

@ -1,5 +1,5 @@
// @flow
import { MAIN_WRAPPER_CLASS } from 'component/app/view';
import { MAIN_CLASS } from 'component/page/view';
import type { Node } from 'react';
import React, { useEffect } from 'react';
import classnames from 'classnames';
@ -71,10 +71,10 @@ export default function ClaimList(props: Props) {
useEffect(() => {
const handleScroll = debounce(e => {
if (page && pageSize && onScrollBottom) {
const mainElWrapper = document.querySelector(`.${MAIN_WRAPPER_CLASS}`);
const mainEl = document.querySelector(`.${MAIN_CLASS}`);
if (mainElWrapper && !loading && urisLength >= pageSize) {
const contentWrapperAtBottomOfPage = mainElWrapper.getBoundingClientRect().bottom - 0.5 <= window.innerHeight;
if (mainEl && !loading && urisLength >= pageSize) {
const contentWrapperAtBottomOfPage = mainEl.getBoundingClientRect().bottom - 0.5 <= window.innerHeight;
if (contentWrapperAtBottomOfPage) {
onScrollBottom();