From 86987d5fd49a8f78ba6a5a8984d8e217e04d28ac Mon Sep 17 00:00:00 2001 From: Clay Diffrient Date: Thu, 13 Apr 2017 07:33:42 -0600 Subject: [PATCH] Use create-react-class to avoid React.createClass deprecations fixes #367 --- lib/components/Modal.js | 3 ++- lib/components/ModalPortal.js | 3 ++- package.json | 1 + yarn.lock | 25 ++++++++++++------------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/components/Modal.js b/lib/components/Modal.js index f3c9c0a0..03ea092b 100644 --- a/lib/components/Modal.js +++ b/lib/components/Modal.js @@ -8,6 +8,7 @@ var refCount = require('../helpers/refCount'); var elementClass = require('element-class'); var renderSubtreeIntoContainer = require("react-dom").unstable_renderSubtreeIntoContainer; var Assign = require('lodash.assign'); +var createReactClass = require('create-react-class') var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {}; var AppElement = ExecutionEnvironment.canUseDOM ? document.body : {appendChild: function() {}}; @@ -16,7 +17,7 @@ function getParentElement(parentSelector) { return parentSelector(); } -var Modal = React.createClass({ +var Modal = createReactClass({ displayName: 'Modal', statics: { diff --git a/lib/components/ModalPortal.js b/lib/components/ModalPortal.js index 4045636c..74799d6a 100644 --- a/lib/components/ModalPortal.js +++ b/lib/components/ModalPortal.js @@ -3,6 +3,7 @@ var div = React.DOM.div; var focusManager = require('../helpers/focusManager'); var scopeTab = require('../helpers/scopeTab'); var Assign = require('lodash.assign'); +var createReactClass = require('create-react-class'); // so that our CSS is statically analyzable var CLASS_NAMES = { @@ -18,7 +19,7 @@ var CLASS_NAMES = { } }; -var ModalPortal = module.exports = React.createClass({ +var ModalPortal = module.exports = createReactClass({ displayName: 'ModalPortal', shouldClose: null, diff --git a/package.json b/package.json index bf3026e4..0001ce36 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "webpack-dev-server": "1.11.0" }, "dependencies": { + "create-react-class": "^15.5.2", "element-class": "^0.2.0", "exenv": "1.2.0", "lodash.assign": "^4.2.0", diff --git a/yarn.lock b/yarn.lock index 79f8554e..a93db225 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1087,6 +1087,13 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +create-react-class@^15.5.2: + version "15.5.2" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.2.tgz#6a8758348df660b88326a0e764d569f274aad681" + dependencies: + fbjs "^0.8.9" + object-assign "^4.1.1" + cross-spawn@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" @@ -1563,19 +1570,7 @@ eyes@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" -fbjs@^0.8.1, fbjs@^0.8.4: - version "0.8.8" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.8.tgz#02f1b6e0ea0d46c24e0b51a2d24df069563a5ad6" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - -fbjs@^0.8.9: +fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.9: version "0.8.12" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04" dependencies: @@ -3202,6 +3197,10 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0" +object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + object-component@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"