From 505ae21c1639e3a320ef48165dda7a948fbc9bc4 Mon Sep 17 00:00:00 2001 From: Andres Castro Date: Thu, 26 Nov 2015 09:03:02 -0600 Subject: [PATCH] add ReactDOM and update .getDOMNode() to ReactDOM.findDOMNode instead --- example/example.js | 4 +++- example/index.html | 1 + lib/select-box.js | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/example/example.js b/example/example.js index e1cf532..a7fe71e 100644 --- a/example/example.js +++ b/example/example.js @@ -1,4 +1,6 @@ var React = require('react') +var ReactDOM = require('react-dom') + var SelectBox = React.createFactory(require('../lib/select-box')) var div = React.createElement.bind(null,'div') @@ -56,4 +58,4 @@ var Example = React.createFactory(React.createClass({displayName: 'Example', } })) -React.render(Example(null), document.body) +ReactDOM.render(Example(null), document.querySelector('#main')) diff --git a/example/index.html b/example/index.html index 336501b..5d82050 100644 --- a/example/index.html +++ b/example/index.html @@ -6,6 +6,7 @@ +
diff --git a/lib/select-box.js b/lib/select-box.js index c5ba34a..8742797 100644 --- a/lib/select-box.js +++ b/lib/select-box.js @@ -1,6 +1,7 @@ "use strict" var React = require('react') +var ReactDOM = require('react-dom') var div = React.createElement.bind(null, 'div') var button = React.createElement.bind(null, 'button') @@ -100,7 +101,7 @@ module.exports = React.createClass({displayName: 'exports', } else { this.updatePendingValue(val, cb) || this.props.onChange(val) this.handleClose() - this.refs.button.getDOMNode().focus() + ReactDOM.findDOMNode(this.refs.button).focus(); } }.bind(this) }, @@ -140,7 +141,7 @@ module.exports = React.createClass({displayName: 'exports', handleOpen: function (event) { interceptEvent(event) this.setState({open: true}, function () { - this.refs.menu.getDOMNode().focus() + ReactDOM.findDOMNode(this.refs.menu).focus(); }) },