11// @flow
2- import * as React from 'react' ;
2+ import React from 'react' ;
33import PropTypes from 'prop-types' ;
44import { DraggableCore } from 'react-draggable' ;
55import { Resizable } from 'react-resizable' ;
66import { perc , setTopLeft , setTransform } from './utils' ;
77import classNames from 'classnames' ;
8+ import type { Element as ReactElement , Node as ReactNode } from 'react' ;
89
9- import type { ReactDraggableCallbackData , GridDragEvent , GridResizeEvent , Position , Size } from './utils' ;
10+ import type { ReactDraggableCallbackData , GridDragEvent , GridResizeEvent , Position } from './utils' ;
1011
1112type PartialPosition = { top : number , left : number } ;
1213type GridItemCallback < Data : GridDragEvent | GridResizeEvent > = ( i : string , w : number , h : number , Data ) => void ;
@@ -18,7 +19,7 @@ type State = {
1819} ;
1920
2021type Props = {
21- children : React . Element < any > ,
22+ children : ReactElement < any > ,
2223 cols : number ,
2324 containerWidth : number ,
2425 margin : [ number , number ] ,
@@ -275,7 +276,7 @@ export default class GridItem extends React.Component<Props, State> {
275276 * @param {Element } child Child element.
276277 * @return {Element } Child wrapped in Draggable.
277278 */
278- mixinDraggable ( child : React . Element < any > ) : React . Element < any > {
279+ mixinDraggable ( child : ReactElement < any > ) : ReactElement < any > {
279280 return (
280281 < DraggableCore
281282 onStart = { this . onDragHandler ( 'onDragStart' ) }
@@ -294,7 +295,7 @@ export default class GridItem extends React.Component<Props, State> {
294295 * @param {Object } position Position object (pixel values)
295296 * @return {Element } Child wrapped in Resizable.
296297 */
297- mixinResizable ( child : React . Element < any > , position : Position ) : React . Element < any > {
298+ mixinResizable ( child : ReactElement < any > , position : Position ) : ReactElement < any > {
298299 const { cols, x, minW, minH, maxW, maxH} = this . props ;
299300
300301 // This is the max possible width - doesn't go to infinity because of the width of the window
@@ -399,7 +400,7 @@ export default class GridItem extends React.Component<Props, State> {
399400 } ;
400401 }
401402
402- render ( ) : React . Node {
403+ render ( ) : ReactNode {
403404 const { x , y , w , h , isDraggable , isResizable , useCSSTransforms } = this . props ;
404405
405406 const pos = this . calcPosition ( x , y , w , h , this . state ) ;
0 commit comments