import PropTypes from 'prop-types'; import React from 'react'; import PTRComponent from 'react-simple-pull-to-refresh'; /** * PullToRefresh: * Wrapper around a third-party PTR component with Soapbox defaults. */ export default class PullToRefresh extends React.Component { static propTypes = { children: PropTypes.node.isRequired, onRefresh: PropTypes.func, } handleRefresh = () => { const { onRefresh } = this.props; if (onRefresh) { return onRefresh(); } else { // If not provided, do nothing return new Promise(resolve => resolve()); } } render() { const { children, onRefresh, ...rest } = this.props; return ( {children} ); } }