Skip to content

Commit

Permalink
Remove deprecation warning in react 15.6.0 about React.DOM.noscript
Browse files Browse the repository at this point in the history
  • Loading branch information
ingro authored and diasbruno committed Jun 15, 2017
1 parent 937f835 commit 91e1a67
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion examples/basic/app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
var React = require('react');
var ReactDOM = require('react-dom');
var Modal = require('../../lib/index');
var createReactClass = require('create-react-class');

var appElement = document.getElementById('example');

Modal.setAppElement('#example');

var App = React.createClass({
var App = createReactClass({

getInitialState: function() {
return { modalIsOpen: false, modal2: false };
Expand Down
5 changes: 3 additions & 2 deletions lib/components/Modal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var React = require('react');
var ReactDOM = require('react-dom');
var DOMFactories = require('react-dom-factories');
var PropTypes = require('prop-types');
var ExecutionEnvironment = require('exenv');
var ModalPortal = React.createFactory(require('./ModalPortal'));
Expand All @@ -8,7 +9,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 createReactClass = require('create-react-class');

var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {};
var AppElement = ExecutionEnvironment.canUseDOM ? document.body : {appendChild: function() {}};
Expand Down Expand Up @@ -145,7 +146,7 @@ var Modal = createReactClass({
},

render: function () {
return React.DOM.noscript();
return DOMFactories.noscript();
}
});

Expand Down
4 changes: 3 additions & 1 deletion lib/components/ModalPortal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
var React = require('react');
var div = React.DOM.div;
var DOMFactories = require('react-dom-factories');
var focusManager = require('../helpers/focusManager');
var scopeTab = require('../helpers/scopeTab');
var Assign = require('lodash.assign');
var createReactClass = require('create-react-class');

var div = DOMFactories.div;

// so that our CSS is statically analyzable
var CLASS_NAMES = {
overlay: 'ReactModal__Overlay',
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"element-class": "^0.2.0",
"exenv": "1.2.0",
"lodash.assign": "^4.2.0",
"prop-types": "^15.5.7"
"prop-types": "^15.5.7",
"react-dom-factories": "^1.0.0"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0",
Expand Down
5 changes: 3 additions & 2 deletions specs/Modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import Modal from '../lib/components/Modal';
import createReactClass from 'create-react-class';
import * as ariaAppHider from '../lib/helpers/ariaAppHider';
import {
isBodyWithReactModalOpenClass, findDOMWithClass,
Expand Down Expand Up @@ -62,7 +63,7 @@ describe('State', () => {

it('renders into the body, not in context', () => {
var node = document.createElement('div');
var App = React.createClass({
var App = createReactClass({
render() {
return (
<div>
Expand Down Expand Up @@ -346,7 +347,7 @@ describe('State', () => {
var node = document.createElement('div');
var modal = null;

var App = React.createClass({
var App = createReactClass({
getInitialState: function () {
return { testHasChanged: false };
},
Expand Down

0 comments on commit 91e1a67

Please sign in to comment.