Skip to content

Commit

Permalink
Allow react 16 as peerDependency (#23)
Browse files Browse the repository at this point in the history
* install prop-types package

* import PropTypes from prop-types instead of React

* install create-react-class package

* use createReactClass instead of React.createClass

* allow react 16 as a peer dependency
  • Loading branch information
okize authored and benbriggs committed Nov 29, 2017
1 parent 1ca2816 commit 4fbfcc7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
"license": "Apache License 2.0",
"peerDependencies": {
"draft-js": ">=0.7.0",
"react": ">=15.0.2",
"react-dom": ">=15.0.2"
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"dependencies": {
"create-react-class": "^15.6.2",
"immutable": "^3.8.1",
"invariant": "^2.2.1"
"invariant": "^2.2.1",
"prop-types": "^15.6.0"
},
"devDependencies": {
"babel-cli": "^6.10.1",
Expand Down
6 changes: 4 additions & 2 deletions src/components/Editor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import {List} from 'immutable';
import {
Editor,
Expand Down Expand Up @@ -31,7 +33,7 @@ const propTypes = {
showButtons: PropTypes.bool
};

const EditorWrapper = React.createClass({
const EditorWrapper = createReactClass({
propTypes,

childContextTypes: {
Expand Down
6 changes: 4 additions & 2 deletions src/components/KeyCommandController.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import invariant from 'invariant';
import {List} from 'immutable';
import React, {PropTypes} from 'react';
import {EditorState} from 'draft-js';

const providedProps = {
Expand All @@ -9,7 +11,7 @@ const providedProps = {
handleKeyCommand: PropTypes.func
};

const KeyCommandController = (Component) => React.createClass({
const KeyCommandController = (Component) => createReactClass({
displayName: `KeyCommandController(${Component.displayName})`,

propTypes: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/OverlayWrapper.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';

export default React.createClass({
export default createReactClass({
getInitialState() {
const node = document.createElement('div');
document.body.appendChild(node);
Expand Down
6 changes: 4 additions & 2 deletions src/components/Toolbar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import KeyCommandController from './KeyCommandController';

const Toolbar = React.createClass({
const Toolbar = createReactClass({
propTypes: {
editorState: PropTypes.object,
onChange: PropTypes.func,
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/createPlugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import createReactClass from 'create-react-class';
import {OrderedSet} from 'immutable';
import memoize from '../util/memoize';
import compose from '../util/compose';
Expand Down Expand Up @@ -48,7 +50,7 @@ const createPlugin = ({

if (ToWrap.prototype && ToWrap.prototype.isReactComponent) {
// wrapping an Editor component
return React.createClass({
return createReactClass({
displayName,

propTypes: {
Expand Down

0 comments on commit 4fbfcc7

Please sign in to comment.