1
1
// @flow
2
- import * as React from 'react' ;
2
+ import React from 'react' ;
3
3
import PropTypes from 'prop-types' ;
4
4
import { DraggableCore } from 'react-draggable' ;
5
5
import { Resizable } from 'react-resizable' ;
6
6
import { perc , setTopLeft , setTransform } from './utils' ;
7
7
import classNames from 'classnames' ;
8
+ import type { Element as ReactElement , Node as ReactNode } from 'react' ;
8
9
9
- import type { ReactDraggableCallbackData , GridDragEvent , GridResizeEvent , Position , Size } from './utils' ;
10
+ import type { ReactDraggableCallbackData , GridDragEvent , GridResizeEvent , Position } from './utils' ;
10
11
11
12
type PartialPosition = { top : number , left : number } ;
12
13
type GridItemCallback < Data : GridDragEvent | GridResizeEvent > = ( i : string , w : number , h : number , Data ) => void ;
@@ -18,7 +19,7 @@ type State = {
18
19
} ;
19
20
20
21
type Props = {
21
- children : React . Element < any > ,
22
+ children : ReactElement < any > ,
22
23
cols : number ,
23
24
containerWidth : number ,
24
25
margin : [ number , number ] ,
@@ -275,7 +276,7 @@ export default class GridItem extends React.Component<Props, State> {
275
276
* @param {Element } child Child element.
276
277
* @return {Element } Child wrapped in Draggable.
277
278
*/
278
- mixinDraggable ( child : React . Element < any > ) : React . Element < any > {
279
+ mixinDraggable ( child : ReactElement < any > ) : ReactElement < any > {
279
280
return (
280
281
< DraggableCore
281
282
onStart = { this . onDragHandler ( 'onDragStart' ) }
@@ -294,7 +295,7 @@ export default class GridItem extends React.Component<Props, State> {
294
295
* @param {Object } position Position object (pixel values)
295
296
* @return {Element } Child wrapped in Resizable.
296
297
*/
297
- mixinResizable ( child : React . Element < any > , position : Position ) : React . Element < any > {
298
+ mixinResizable ( child : ReactElement < any > , position : Position ) : ReactElement < any > {
298
299
const { cols, x, minW, minH, maxW, maxH} = this . props ;
299
300
300
301
// 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> {
399
400
} ;
400
401
}
401
402
402
- render ( ) : React . Node {
403
+ render ( ) : ReactNode {
403
404
const { x , y , w , h , isDraggable , isResizable , useCSSTransforms } = this . props ;
404
405
405
406
const pos = this . calcPosition ( x , y , w , h , this . state ) ;
0 commit comments