static propTypes = {
onClick: PropTypes.func,
+ visible: PropTypes.bool,
+ }
+
+ static defaultProps = {
+ visible: true,
}
render() {
+ const { visible } = this.props;
+
return (
- <button className='load-more' onClick={this.props.onClick}>
+ <button className='load-more' disabled={!visible} style={{ opacity: visible ? 1 : 0 }} onClick={this.props.onClick}>
<FormattedMessage id='status.load_more' defaultMessage='Load more' />
</button>
);
render () {
const { statusIds, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props;
- let loadMore = null;
+ const loadMore = <LoadMore visible={!isLoading && statusIds.size > 0 && hasMore} onClick={this.handleLoadMore} />;
let scrollableArea = null;
- if (!isLoading && statusIds.size > 0 && hasMore) {
- loadMore = <LoadMore onClick={this.handleLoadMore} />;
- }
-
if (isLoading || statusIds.size > 0 || !emptyMessage) {
scrollableArea = (
<div className='scrollable' ref={this.setRef}>