Skip to content

Commit

Permalink
fix(React): fix deprecation warnings caused by import *
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML committed Aug 31, 2017
1 parent c052b59 commit be65823
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.*/node_modules/fbjs/.*
.*/node_modules/express/.*
.*/node_modules/serve-index/.*
<PROJECT_ROOT>/build/.*

[include]

Expand Down
7 changes: 4 additions & 3 deletions lib/Resizable.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @flow
import * as React from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {DraggableCore} from 'react-draggable';
import cloneElement from './cloneElement';
import type {Element as ReactElement, Node as ReactNode} from 'react';

type Axis = 'both' | 'x' | 'y' | 'none';
type State = {
Expand All @@ -21,7 +22,7 @@ export type ResizeCallbackData = {
size: {width: number, height: number}
};
export type Props = {
children: React.Element<any>,
children: ReactElement<any>,
width: number,
height: number,
handleSize: [number, number],
Expand Down Expand Up @@ -196,7 +197,7 @@ export default class Resizable extends React.Component<Props, State> {
};
}

render(): React.Node {
render(): ReactNode {
// eslint-disable-next-line no-unused-vars
const {children, draggableOpts, width, height, handleSize,
lockAspectRatio, axis, minConstraints, maxConstraints, onResize,
Expand Down
5 changes: 3 additions & 2 deletions lib/ResizableBox.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @flow
import * as React from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import Resizable from './Resizable';
import type {Props as ResizableProps, ResizeCallbackData} from './Resizable';
import type {Node as ReactNode} from 'react';

type State = {width: number, height: number};

Expand Down Expand Up @@ -43,7 +44,7 @@ export default class ResizableBox extends React.Component<ResizableProps, State>
}
}

render(): React.Node {
render(): ReactNode {
// Basic wrapper around a Resizable instance.
// If you use Resizable directly, you are responsible for updating the child component
// with a new width and height.
Expand Down
5 changes: 3 additions & 2 deletions lib/cloneElement.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// @flow
import * as React from 'react';
import React from 'react';
import type {Element as ReactElement} from 'react';

// React.addons.cloneWithProps look-alike that merges style & className.
module.exports = function cloneElement(element: React.Element<any>, props: Object): React.Element<any> {
module.exports = function cloneElement(element: ReactElement<any>, props: Object): ReactElement<any> {
if (props.style && element.props.style) {
props.style = {...element.props.style, ...props.style};
}
Expand Down
2 changes: 1 addition & 1 deletion test/TestLayout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import Resizable from '../lib/Resizable';
import ResizableBox from '../lib/ResizableBox';
import 'style-loader!css-loader!../css/styles.css';
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TestLayout from './TestLayout';
import * as React from 'react';
import React from 'react';
import ReactDOM from 'react-dom';

document.addEventListener("DOMContentLoaded", function(event) {
Expand Down

0 comments on commit be65823

Please sign in to comment.