Updated StatusList, ScrollableList to use given props
• Updated: - StatusList, ScrollableList to use given props • Fixed: - Issue with scrolling back to top onLoadMore
This commit is contained in:
@@ -228,8 +228,6 @@ export default class ScrollableList extends PureComponent {
|
||||
} = this.props
|
||||
const childrenCount = React.Children.count(children);
|
||||
|
||||
const loadMore = (hasMore && onLoadMore) ? <LoadMore visible={!isLoading} onClick={this.handleLoadMore} /> : null
|
||||
|
||||
if (showLoading) {
|
||||
if (Placeholder) {
|
||||
return (
|
||||
@@ -248,9 +246,7 @@ export default class ScrollableList extends PureComponent {
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<ColumnIndicator type='loading' />
|
||||
)
|
||||
return <ColumnIndicator type='loading' />
|
||||
} else if (isLoading || childrenCount > 0 || hasMore || !emptyMessage) {
|
||||
return (
|
||||
<div onMouseMove={this.handleMouseMove}>
|
||||
@@ -278,14 +274,18 @@ export default class ScrollableList extends PureComponent {
|
||||
))
|
||||
}
|
||||
|
||||
{loadMore}
|
||||
{
|
||||
(hasMore && onLoadMore && !isLoading) &&
|
||||
<LoadMore onClick={this.handleLoadMore} />
|
||||
}
|
||||
|
||||
{
|
||||
isLoading &&
|
||||
<ColumnIndicator type='loading' />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -224,11 +224,15 @@ class StatusList extends ImmutablePureComponent {
|
||||
isPartial,
|
||||
group,
|
||||
promotedStatuses,
|
||||
...other
|
||||
scrollKey,
|
||||
hasMore,
|
||||
emptyMessage,
|
||||
onScrollToTop,
|
||||
onScroll,
|
||||
} = this.props
|
||||
const { fetchedContext, refreshing } = this.state
|
||||
|
||||
if (isPartial || isLoading && statusIds.size === 0) {
|
||||
if (isPartial || (isLoading && statusIds.size === 0)) {
|
||||
return (
|
||||
<Fragment>
|
||||
<StatusPlaceholder />
|
||||
@@ -320,10 +324,16 @@ class StatusList extends ImmutablePureComponent {
|
||||
<ScrollableList
|
||||
ref={this.setRef}
|
||||
isLoading={isLoading}
|
||||
showLoading={(isLoading && statusIds.size === 0) || refreshing}
|
||||
showLoading={(isLoading && statusIds.size === 0)}
|
||||
onLoadMore={onLoadMore && this.handleLoadOlder}
|
||||
onReload={this.handleOnReload}
|
||||
{...other}
|
||||
placeholderComponent={StatusPlaceholder}
|
||||
placeholderCount={1}
|
||||
scrollKey={scrollKey}
|
||||
hasMore={hasMore}
|
||||
emptyMessage={emptyMessage}
|
||||
onScrollToTop={onScrollToTop}
|
||||
onScroll={onScroll}
|
||||
>
|
||||
{scrollableContent}
|
||||
</ScrollableList>
|
||||
|
||||
Reference in New Issue
Block a user