Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1410 Changed function name to LoadAutoScroll #1453

Merged
merged 3 commits into from
Nov 24, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/frontend/src/components/Posts/LoadAutoScroll.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

function LoadMoreButton({ onScroll }) {
function LoadAutoScroll({ onClick }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other way around, this prop needs to be onScroll and below on the propTypes you need onScroll too. You can see how it's called at

<LoadAutoScroll onScroll={() => nextPage()} key={`load-more-button-${pages.length}`} />
, which is sending an onScroll function.

const classes = useStyles();
const $buttonRef = useRef(null);

Expand All @@ -30,7 +30,7 @@ function LoadMoreButton({ onScroll }) {
(entries) =>
entries.forEach((entry) => {
if (entry.isIntersecting) {
onScroll();
onClick();
}
}),
options
Expand All @@ -51,8 +51,8 @@ function LoadMoreButton({ onScroll }) {
);
}

LoadMoreButton.propTypes = {
LoadAutoScroll.propTypes = {
onClick: PropTypes.func,
};

export default LoadMoreButton;
export default LoadAutoScroll;