import * as React from 'react';
import VisibilitySensor from 'react-visibility-sensor';
export class VirtualList extends React.PureComponent {
    constructor() {
        super(...arguments);
        this.onChangeVisibility = (isVisible, i) => {
            if (isVisible && i >= this.props.itemsToShow - 2) {
                this.props.onShowMoreItems();
            }
            if (this.props.onVisibilityChange) {
                this.props.onVisibilityChange(isVisible, i);
            }
        };
    }
    render() {
        return (React.createElement("div", { className: this.props.className, ref: this.props.onRef }, this.props.items.slice(0, this.props.itemsToShow).map((item, i) => (React.createElement(VisibilitySensor, { key: item.key, 
            // tslint:disable-next-line:jsx-no-lambda
            onChange: (isVisible) => this.onChangeVisibility(isVisible, i), containment: this.props.containment, partialVisibility: true }, item)))));
    }
}
//# sourceMappingURL=VirtualList.js.map