1
0
Fork 0
forked from fedi/mastodon

Fix (PR #3585) Add hasMore to propTypes and cover handleScroll. (#3589)

This commit is contained in:
Naoki Kosaka 2017-06-06 01:18:56 +09:00 committed by Eugen Rochko
parent 61fcdbbf7e
commit a0880edc6e
2 changed files with 4 additions and 2 deletions

View file

@ -27,6 +27,7 @@ class Followers extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
}; };
componentWillMount () { componentWillMount () {
@ -44,7 +45,7 @@ class Followers extends ImmutablePureComponent {
handleScroll = (e) => { handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target; const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight) { if (scrollTop === scrollHeight - clientHeight && this.props.hasMore) {
this.props.dispatch(expandFollowers(Number(this.props.params.accountId))); this.props.dispatch(expandFollowers(Number(this.props.params.accountId)));
} }
} }

View file

@ -27,6 +27,7 @@ class Following extends ImmutablePureComponent {
params: PropTypes.object.isRequired, params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired, dispatch: PropTypes.func.isRequired,
accountIds: ImmutablePropTypes.list, accountIds: ImmutablePropTypes.list,
hasMore: PropTypes.bool,
}; };
componentWillMount () { componentWillMount () {
@ -44,7 +45,7 @@ class Following extends ImmutablePureComponent {
handleScroll = (e) => { handleScroll = (e) => {
const { scrollTop, scrollHeight, clientHeight } = e.target; const { scrollTop, scrollHeight, clientHeight } = e.target;
if (scrollTop === scrollHeight - clientHeight) { if (scrollTop === scrollHeight - clientHeight && this.props.hasMore) {
this.props.dispatch(expandFollowing(Number(this.props.params.accountId))); this.props.dispatch(expandFollowing(Number(this.props.params.accountId)));
} }
} }