You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

  1. import Status from './status';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import PureRenderMixin from 'react-addons-pure-render-mixin';
  4. const StatusList = React.createClass({
  5. propTypes: {
  6. statuses: ImmutablePropTypes.list.isRequired,
  7. onReply: React.PropTypes.func,
  8. onReblog: React.PropTypes.func,
  9. onFavourite: React.PropTypes.func,
  10. onDelete: React.PropTypes.func,
  11. onScrollToBottom: React.PropTypes.func,
  12. me: React.PropTypes.number
  13. },
  14. mixins: [PureRenderMixin],
  15. handleScroll (e) {
  16. const { scrollTop, scrollHeight, clientHeight } = e.target;
  17. if (scrollTop === scrollHeight - clientHeight) {
  18. this.props.onScrollToBottom();
  19. }
  20. },
  21. render () {
  22. const { statuses, onScrollToBottom, ...other } = this.props;
  23. return (
  24. <div style={{ overflowY: 'scroll', flex: '1 1 auto', overflowX: 'hidden' }} className='scrollable' onScroll={this.handleScroll}>
  25. <div>
  26. {statuses.map((status) => {
  27. return <Status key={status.get('id')} {...other} status={status} />;
  28. })}
  29. </div>
  30. </div>
  31. );
  32. }
  33. });
  34. export default StatusList;