Merge pull request #260 from TrySound/upgrade-flow

Upgrade flow and fix issues
This commit is contained in:
Brian Vaughn
2019-06-11 08:14:35 -07:00
committed by GitHub
5 changed files with 54 additions and 18 deletions
+12 -9
View File
@@ -1,10 +1,8 @@
{
"name": "react-window",
"version": "1.8.2",
"description":
"React components for efficiently rendering large, scrollable lists and tabular data",
"author":
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
"description": "React components for efficiently rendering large, scrollable lists and tabular data",
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
"contributors": [
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)"
],
@@ -36,7 +34,10 @@
],
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"files": ["dist", "src/*.js"],
"files": [
"dist",
"src/*.js"
],
"scripts": {
"flow": "flow check --max-warnings=0 src && flow check website",
"precommit": "lint-staged",
@@ -45,8 +46,7 @@
"lint": "eslint '**/*.js'",
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build:flow":
"cp flow-template dist/index.cjs.js.flow && cp flow-template dist/index.esm.js.flow",
"build:flow": "cp flow-template dist/index.cjs.js.flow && cp flow-template dist/index.esm.js.flow",
"build:source": "rollup -c",
"build": "del dist && mkdir dist && yarn build:flow && yarn build:source",
"start": "rollup -c -w",
@@ -56,7 +56,10 @@
"website:run": "cd website && yarn start"
},
"lint-staged": {
"{website,src}/**/*.{js,json,css}": ["prettier --write", "git add"],
"{website,src}/**/*.{js,json,css}": [
"prettier --write",
"git add"
],
"**/*.js": "eslint --max-warnings 0"
},
"dependencies": {
@@ -91,7 +94,7 @@
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-standard": "^3.0.1",
"flow-bin": "^0.80.0",
"flow-bin": "^0.101.0",
"gh-pages": "^1.1.0",
"lint-staged": "^7.0.5",
"prettier": "^1.12.1",
+2 -2
View File
@@ -5,10 +5,10 @@ import createListComponent from './createListComponent';
import type { Props, ScrollToAlign } from './createListComponent';
const FixedSizeList = createListComponent({
getItemOffset: ({ itemSize, size }: Props<any>, index: number): number =>
getItemOffset: ({ itemSize }: Props<any>, index: number): number =>
index * ((itemSize: any): number),
getItemSize: ({ itemSize, size }: Props<any>, index: number): number =>
getItemSize: ({ itemSize }: Props<any>, index: number): number =>
((itemSize: any): number),
getEstimatedTotalSize: ({ itemCount, itemSize }: Props<any>) =>
+18 -2
View File
@@ -46,6 +46,22 @@ type OnScrollCallback = ({
type ScrollEvent = SyntheticEvent<HTMLDivElement>;
type ItemStyleCache = { [key: string]: Object };
type OuterProps = {|
children: React$Node,
className: string | void,
onScroll: ScrollEvent => void,
style: {
[string]: mixed,
},
|};
type InnerProps = {|
children: React$Node,
style: {
[string]: mixed,
},
|};
export type Props<T> = {|
children: RenderComponent<T>,
className?: string,
@@ -56,7 +72,7 @@ export type Props<T> = {|
initialScrollLeft?: number,
initialScrollTop?: number,
innerRef?: any,
innerElementType?: React$ElementType,
innerElementType?: string | React$AbstractComponent<InnerProps, any>,
innerTagName?: string, // deprecated
itemData: T,
itemKey?: (params: {|
@@ -67,7 +83,7 @@ export type Props<T> = {|
onItemsRendered?: OnItemsRenderedCallback,
onScroll?: OnScrollCallback,
outerRef?: any,
outerElementType?: React$ElementType,
outerElementType?: string | React$AbstractComponent<OuterProps, any>,
outerTagName?: string, // deprecated
overscanColumnCount?: number,
overscanColumnsCount?: number, // deprecated
+18 -2
View File
@@ -39,6 +39,22 @@ type onScrollCallback = ({
type ScrollEvent = SyntheticEvent<HTMLDivElement>;
type ItemStyleCache = { [index: number]: Object };
type OuterProps = {|
children: React$Node,
className: string | void,
onScroll: ScrollEvent => void,
style: {
[string]: mixed,
},
|};
type InnerProps = {|
children: React$Node,
style: {
[string]: mixed,
},
|};
export type Props<T> = {|
children: RenderComponent<T>,
className?: string,
@@ -46,7 +62,7 @@ export type Props<T> = {|
height: number | string,
initialScrollOffset?: number,
innerRef?: any,
innerElementType?: React$ElementType,
innerElementType?: string | React$AbstractComponent<InnerProps, any>,
innerTagName?: string, // deprecated
itemCount: number,
itemData: T,
@@ -56,7 +72,7 @@ export type Props<T> = {|
onItemsRendered?: onItemsRenderedCallback,
onScroll?: onScrollCallback,
outerRef?: any,
outerElementType?: React$ElementType,
outerElementType?: string | React$AbstractComponent<OuterProps, any>,
outerTagName?: string, // deprecated
overscanCount: number,
style?: Object,
+4 -3
View File
@@ -3692,9 +3692,10 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
flow-bin@^0.80.0:
version "0.80.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.80.0.tgz#04cc1ee626a6f50786f78170c92ebe1745235403"
flow-bin@^0.101.0:
version "0.101.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.101.0.tgz#c56fa0afb9c151eeba7954136e9066d408691063"
integrity sha512-2xriPEOSrGQklAArNw1ixoIUiLTWhIquYV26WqnxEu7IcXWgoZUcfJXufG9kIvrNbdwCNd5RBjTwbB0p6L6XaA==
follow-redirects@^1.0.0:
version "1.4.1"