diff --git a/.flowconfig b/.flowconfig index 38f7435d5..a646597fd 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,5 +1,5 @@ [version] -0.55.0 +0.59.0 [ignore] .*test diff --git a/lib/GridItem.jsx b/lib/GridItem.jsx index 04f340888..99e97abd1 100644 --- a/lib/GridItem.jsx +++ b/lib/GridItem.jsx @@ -81,25 +81,25 @@ export default class GridItem extends React.Component { h: PropTypes.number.isRequired, // All optional - minW: function (props, propName) { + minW: function (props: Props, propName: string) { const value = props[propName]; if (typeof value !== 'number') return new Error('minWidth not Number'); if (value > props.w || value > props.maxW) return new Error('minWidth larger than item width/maxWidth'); }, - maxW: function (props, propName) { + maxW: function (props: Props, propName: string) { const value = props[propName]; if (typeof value !== 'number') return new Error('maxWidth not Number'); if (value < props.w || value < props.minW) return new Error('maxWidth smaller than item width/minWidth'); }, - minH: function (props, propName) { + minH: function (props: Props, propName: string) { const value = props[propName]; if (typeof value !== 'number') return new Error('minHeight not Number'); if (value > props.h || value > props.maxH) return new Error('minHeight larger than item height/maxHeight'); }, - maxH: function (props, propName) { + maxH: function (props: Props, propName: string) { const value = props[propName]; if (typeof value !== 'number') return new Error('maxHeight not Number'); if (value < props.h || value < props.minH) return new Error('maxHeight smaller than item height/minHeight'); diff --git a/lib/ReactGridLayout.jsx b/lib/ReactGridLayout.jsx index 660d55733..65c29a02e 100644 --- a/lib/ReactGridLayout.jsx +++ b/lib/ReactGridLayout.jsx @@ -32,7 +32,7 @@ export type Props = { compactType: ?('horizontal' | 'vertical'), layout: Layout, margin: [number, number], - containerPadding: [number, number], + containerPadding: [number, number] | null, rowHeight: number, maxRows: number, isDraggable: boolean, @@ -83,7 +83,7 @@ export default class ReactGridLayout extends React.Component { draggableHandle: PropTypes.string, // Deprecated - verticalCompact: function(props) { + verticalCompact: function(props: Props) { if (props.verticalCompact === false && process.env.NODE_ENV !== 'production') { console.warn( // eslint-disable-line no-console '`verticalCompact` on is deprecated and will be removed soon. ' + @@ -95,7 +95,7 @@ export default class ReactGridLayout extends React.Component { // layout is an array of object with the format: // {x: Number, y: Number, w: Number, h: Number, i: String} - layout: function (props) { + layout: function (props: Props) { var layout = props.layout; // I hope you're setting the data-grid property on the grid items if (layout === undefined) return; @@ -155,7 +155,7 @@ export default class ReactGridLayout extends React.Component { // // Children must not have duplicate keys. - children: function (props, propName, _componentName) { + children: function (props: Props, propName: string) { var children = props[propName]; // Check children keys for duplicates. Throw if found. @@ -173,6 +173,10 @@ export default class ReactGridLayout extends React.Component { autoSize: true, cols: 12, className: '', + style: {}, + draggableHandle: '', + draggableCancel: '', + containerPadding: null, rowHeight: 150, maxRows: Infinity, // infinite vertical growth layout: [], diff --git a/lib/ResponsiveReactGridLayout.jsx b/lib/ResponsiveReactGridLayout.jsx index 6624b5987..37f2925ff 100644 --- a/lib/ResponsiveReactGridLayout.jsx +++ b/lib/ResponsiveReactGridLayout.jsx @@ -32,7 +32,7 @@ type Props = { onBreakpointChange: (Breakpoint, cols: number) => void, onLayoutChange: (Layout, {[key: Breakpoint]: Layout}) => void, onWidthChange: - (containerWidth: number, margin: [number, number], cols: number, containerPadding: [number, number]) => void + (containerWidth: number, margin: [number, number], cols: number, containerPadding: [number, number] | null) => void }; export default class ResponsiveReactGridLayout extends React.Component, State> { @@ -57,7 +57,7 @@ export default class ResponsiveReactGridLayout extends React.Component, // layouts is an object mapping breakpoints to layouts. // e.g. {lg: Layout, md: Layout, ...} - layouts(props, propName) { + layouts(props: Props<>, propName: string) { if (type(props[propName]) !== '[object Object]') { throw new Error('Layout property must be an object. Received: ' + type(props[propName])); }