diff options
-rw-r--r-- | package-lock.json | 1 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/components/Feed/Feed.tsx | 16 |
3 files changed, 13 insertions, 6 deletions
diff --git a/package-lock.json b/package-lock.json index 896898a..6f3ba0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1690,6 +1690,7 @@ "version": "9.21.10", "resolved": "https://registry.npmjs.org/@types/react-virtualized/-/react-virtualized-9.21.10.tgz", "integrity": "sha512-f5Ti3A7gGdLkPPFNHTrvKblpsPNBiQoSorOEOD+JPx72g/Ng2lOt4MYfhvQFQNgyIrAro+Z643jbcKafsMW2ag==", + "dev": true, "requires": { "@types/prop-types": "*", "@types/react": "*" diff --git a/package.json b/package.json index 15972e6..4073159 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "dependencies": { "@material-ui/core": "^4.10.1", "@material-ui/icons": "^4.9.1", - "@types/react-virtualized": "^9.21.10", "axios": "^0.19.2", "lodash": "^4.17.15", "react": "^16.13.1", @@ -40,6 +39,7 @@ "@types/node": "^12.12.44", "@types/react": "^16.9.35", "@types/react-dom": "^16.9.8", + "@types/react-virtualized": "^9.21.10", "@typescript-eslint/eslint-plugin": "^3.1.0", "@typescript-eslint/parser": "^3.1.0", "eslint": "^6.8.0", diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx index 785dd79..c532f45 100644 --- a/src/components/Feed/Feed.tsx +++ b/src/components/Feed/Feed.tsx @@ -1,8 +1,9 @@ import React from 'react'; import { Poll } from 'which-types'; -import PollCard from '../PollCard/PollCard'; import { WindowScroller, AutoSizer, List } from 'react-virtualized'; +import PollCard from '../PollCard/PollCard'; + interface PropTypes { polls: Poll[]; } @@ -14,21 +15,26 @@ interface RenderPropTypes { } const Feed: React.FC<PropTypes> = ({ polls }) => { - const RenderItem: React.FC<RenderPropTypes> = ({ index, style, key }) => { const poll = polls[index]; return ( <div key={key} style={style}> <PollCard initialPoll={poll} /> </div> - ) + ); }; return ( <WindowScroller> - {({height, isScrolling, registerChild, onChildScroll, scrollTop}) => ( + {({ + height, + isScrolling, + registerChild, + onChildScroll, + scrollTop + }) => ( <AutoSizer disableHeight> - {({width}) => ( + {({ width }) => ( <div ref={registerChild}> <List autoHeight |