Skip to content

Commit

Permalink
Update gridComponent to use ComponentType
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-l committed Oct 28, 2018
1 parent 97eefe0 commit e48ce2c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/createGridComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ type RenderComponentProps<T> = {|
rowIndex: number,
style: Object,
|};
export type RenderComponent<T> = (props: RenderComponentProps<T>) => React$Node;
export type RenderComponent<T> = React$ComponentType<
$Shape<RenderComponentProps<T>>
>;

type ScrollDirection = 'forward' | 'backward';

Expand Down
22 changes: 22 additions & 0 deletions src/test.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,25 @@ const assertCustomType = (value: ItemData) => {};
{Item}
</VariableSizeGrid>;
}

{
class Item extends React.PureComponent<{ data: void }> {
render() {
const { data } = this.props;
assertVoid(data);
// $FlowFixMe itemData is undefined by default
assertEmpty(data);
return null;
}
}
<VariableSizeGrid
width={0}
height={0}
rowHeight={0}
rowCount={0}
columnWidth={0}
columnCount={0}
>
{Item}
</VariableSizeGrid>;
}

0 comments on commit e48ce2c

Please sign in to comment.