|
1 | 1 | // @flow |
2 | | -import React from 'react'; |
| 2 | +import * as React from 'react'; |
3 | 3 | import PropTypes from 'prop-types'; |
4 | 4 | import {DraggableCore} from 'react-draggable'; |
5 | 5 | import cloneElement from './cloneElement'; |
@@ -29,14 +29,13 @@ export type Props = { |
29 | 29 | axis: Axis, |
30 | 30 | minConstraints: [number, number], |
31 | 31 | maxConstraints: [number, number], |
32 | | - onResizeStop?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any, |
33 | | - onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any, |
34 | | - onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any, |
| 32 | + onResizeStop?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any, |
| 33 | + onResizeStart?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any, |
| 34 | + onResize?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any, |
35 | 35 | draggableOpts?: ?Object |
36 | 36 | }; |
37 | 37 |
|
38 | | -export default class Resizable extends React.Component { |
39 | | - |
| 38 | +export default class Resizable extends React.Component<Props, State> { |
40 | 39 | static propTypes = { |
41 | 40 | // |
42 | 41 | // Required Props |
@@ -78,7 +77,6 @@ export default class Resizable extends React.Component { |
78 | 77 | // These will be passed wholesale to react-draggable's DraggableCore |
79 | 78 | draggableOpts: PropTypes.object |
80 | 79 | }; |
81 | | - props: Props; |
82 | 80 |
|
83 | 81 | static defaultProps = { |
84 | 82 | handleSize: [20, 20], |
@@ -158,7 +156,7 @@ export default class Resizable extends React.Component { |
158 | 156 | * @return {Function} Handler function. |
159 | 157 | */ |
160 | 158 | resizeHandler(handlerName: string): Function { |
161 | | - return (e: SyntheticEvent | MouseEvent, {node, deltaX, deltaY}: DragCallbackData) => { |
| 159 | + return (e: SyntheticEvent<> | MouseEvent, {node, deltaX, deltaY}: DragCallbackData) => { |
162 | 160 |
|
163 | 161 | // Axis restrictions |
164 | 162 | const canDragX = this.props.axis === 'both' || this.props.axis === 'x'; |
@@ -198,7 +196,7 @@ export default class Resizable extends React.Component { |
198 | 196 | }; |
199 | 197 | } |
200 | 198 |
|
201 | | - render(): React.Element<any> { |
| 199 | + render(): React.Node { |
202 | 200 | // eslint-disable-next-line no-unused-vars |
203 | 201 | const {children, draggableOpts, width, height, handleSize, |
204 | 202 | lockAspectRatio, axis, minConstraints, maxConstraints, onResize, |
|
0 commit comments