import React from 'react'; import { Poll } from 'which-types'; import { WindowScroller, AutoSizer, List } from 'react-virtualized'; import CircularProgress from '@material-ui/core/CircularProgress'; import PollCard from '../PollCard/PollCard'; import {makeStyles} from "@material-ui/core"; interface PropTypes { polls: Poll[]; } interface RenderPropTypes { index: number; key: string; style: React.CSSProperties; } const useStyles = makeStyles(theme => ({ loader: { width:'100%', textAlign:'center', marginTop:theme.spacing(10) } })); const Feed: React.FC = ({ polls }) => { const classes = useStyles(); const RenderItem: React.FC = ({ index, style, key }) => { const poll = polls[index]; return (
); }; const loader =
const list = {({ height, isScrolling, registerChild, onChildScroll, scrollTop }) => ( {({ width }) => (
)}
)}
return polls.length ? list : loader; }; export default Feed;