Skip to content

Commit eac64fc

Browse files
committed
merge react-14 into master
2 parents aedad0b + 49dc673 commit eac64fc

14 files changed

+57
-55
lines changed

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-overlays",
3-
"version": "0.4.4",
3+
"version": "0.50.0-alpha4",
44
"description": "Utilities for creating robust overlay components",
55
"author": "Jason Quense <[email protected]>",
66
"repository": "react-bootstrap/react-overlays",
@@ -39,7 +39,7 @@
3939
"major": "release major"
4040
},
4141
"peerDependencies": {
42-
"react": ">=0.13.0"
42+
"react": "^0.14.0-alpha"
4343
},
4444
"devDependencies": {
4545
"babel": "5.6.14",
@@ -48,7 +48,6 @@
4848
"babel-loader": "^5.3.0",
4949
"babel-plugin-object-assign": "^1.2.1",
5050
"chai": "^3.2.0",
51-
"component-playground": "jquense/component-playground",
5251
"css-loader": "^0.15.6",
5352
"es5-shim": "^4.1.7",
5453
"eslint": "^0.24.0",
@@ -75,9 +74,10 @@
7574
"mt-changelog": "^0.6.1",
7675
"node-libs-browser": "^0.5.2",
7776
"raw-loader": "^0.5.1",
78-
"react": "^0.13.3",
79-
"react-bootstrap": "^0.24.2",
77+
"react": "^0.14.0-beta3",
78+
"react-bootstrap": "0.24.5-react-pre.0",
8079
"react-component-metadata": "^1.2.2",
80+
"react-dom": "^0.14.0-beta3",
8181
"react-hot-loader": "^1.2.7",
8282
"release-script": "^0.2.1",
8383
"rimraf": "^2.4.2",

src/Modal.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,6 @@ const Modal = React.createClass({
287287

288288
modalManager.add(this, container, this.props.containerClassName);
289289

290-
this.iosClickHack();
291-
292290
this._onDocumentKeyupListener =
293291
addEventListener(doc, 'keyup', this.handleDocumentKeyUp);
294292

@@ -389,16 +387,9 @@ const Modal = React.createClass({
389387
}
390388
},
391389

392-
iosClickHack() {
393-
// Support: <= React 0.13: https://github.com/facebook/react/issues/1169
394-
if (this.refs.backdrop) {
395-
React.findDOMNode(this.refs.backdrop).onclick = function () {};
396-
}
397-
},
398-
399390
//instead of a ref, which might conflict with one the parent applied.
400391
getDialogElement() {
401-
let node = React.findDOMNode(this.refs.modal);
392+
let node = this.refs.modal;
402393
return node && node.lastChild;
403394
},
404395

src/Portal.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import ReactDOM from 'react-dom';
23
import mountable from 'react-prop-types/lib/mountable';
34
import ownerDocument from './utils/ownerDocument';
45
import getContainer from './utils/getContainer';
@@ -62,7 +63,9 @@ let Portal = React.createClass({
6263
// Save reference for future access.
6364
if (overlay !== null) {
6465
this._mountOverlayTarget();
65-
this._overlayInstance = React.render(overlay, this._overlayTarget);
66+
this._overlayInstance = ReactDOM.unstable_renderSubtreeIntoContainer(
67+
this, overlay, this._overlayTarget
68+
);
6669
} else {
6770
// Unrender if the component is null for transitions to null
6871
this._unrenderOverlay();
@@ -72,7 +75,7 @@ let Portal = React.createClass({
7275

7376
_unrenderOverlay() {
7477
if (this._overlayTarget) {
75-
React.unmountComponentAtNode(this._overlayTarget);
78+
ReactDOM.unmountComponentAtNode(this._overlayTarget);
7679
this._overlayInstance = null;
7780
}
7881
},
@@ -94,7 +97,7 @@ let Portal = React.createClass({
9497
if (this._overlayInstance.getWrappedDOMNode) {
9598
return this._overlayInstance.getWrappedDOMNode();
9699
} else {
97-
return React.findDOMNode(this._overlayInstance);
100+
return ReactDOM.findDOMNode(this._overlayInstance);
98101
}
99102
}
100103

src/Position.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { cloneElement } from 'react';
2+
import ReactDOM from 'react-dom';
23
import classNames from 'classnames';
34
import ownerDocument from './utils/ownerDocument';
45
import getContainer from './utils/getContainer';
@@ -108,7 +109,7 @@ class Position extends React.Component {
108109
return;
109110
}
110111

111-
const overlay = React.findDOMNode(this);
112+
const overlay = ReactDOM.findDOMNode(this);
112113
const container = getContainer(this.props.container, ownerDocument(this).body);
113114

114115
this.setState(calcOverlayPosition(

src/RootCloseWrapper.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
24
import addEventListener from './utils/addEventListener';
35
import createChainedFunction from './utils/createChainedFunction';
46
import ownerDocument from './utils/ownerDocument';
@@ -31,7 +33,8 @@ export default class RootCloseWrapper extends React.Component {
3133
let { id, suppressRootClose } = getSuppressRootClose();
3234

3335
this._suppressRootId = id;
34-
this._suppressRootClosehHandler = suppressRootClose;
36+
37+
this._suppressRootCloseHandler = suppressRootClose;
3538
}
3639

3740
bindRootCloseHandlers() {
@@ -79,14 +82,14 @@ export default class RootCloseWrapper extends React.Component {
7982

8083
if (noWrap) {
8184
return React.cloneElement(child, {
82-
onClick: createChainedFunction(this._suppressRootClosehHandler, child.props.onClick)
85+
onClick: createChainedFunction(this._suppressRootCloseHandler, child.props.onClick)
8386
});
8487
}
8588

8689
// Wrap the child in a new element, so the child won't have to handle
8790
// potentially combining multiple onClick listeners.
8891
return (
89-
<div onClick={this._suppressRootClosehHandler}>
92+
<div onClick={this._suppressRootCloseHandler}>
9093
{child}
9194
</div>
9295
);
@@ -97,7 +100,7 @@ export default class RootCloseWrapper extends React.Component {
97100
// stealing the ref from the owner, but we know exactly the DOM structure
98101
// that will be rendered, so we can just do this to get the child's DOM
99102
// node for doing size calculations in OverlayMixin.
100-
const node = React.findDOMNode(this);
103+
const node = ReactDOM.findDOMNode(this);
101104
return this.props.noWrap ? node : node.firstChild;
102105
}
103106

src/Transition.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import ReactDOM from 'react-dom';
23
import transitionInfo from 'dom-helpers/transition/properties';
34
import addEventListener from 'dom-helpers/events/on';
45
import classnames from 'classnames';
@@ -84,7 +85,7 @@ class Transition extends React.Component {
8485

8586
performEnter(props) {
8687
this.cancelNextCallback();
87-
const node = React.findDOMNode(this);
88+
const node = ReactDOM.findDOMNode(this);
8889

8990
// Not this.props, because we might be about to receive new props.
9091
props.onEnter(node);
@@ -102,7 +103,7 @@ class Transition extends React.Component {
102103

103104
performExit(props) {
104105
this.cancelNextCallback();
105-
const node = React.findDOMNode(this);
106+
const node = ReactDOM.findDOMNode(this);
106107

107108
// Not this.props, because we might be about to receive new props.
108109
props.onExit(node);

src/utils/getContainer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
1+
import ReactDOM from 'react-dom';
22

33
export default function getContainer(container, defaultContainer){
44
container = typeof container === 'function' ? container() : container;
5-
return React.findDOMNode(container) || defaultContainer;
5+
return ReactDOM.findDOMNode(container) || defaultContainer;
66
}

src/utils/ownerDocument.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
1+
import ReactDOM from 'react-dom';
22
import ownerDocument from 'dom-helpers/ownerDocument';
33

44
export default function (componentOrElement) {
5-
return ownerDocument(React.findDOMNode(componentOrElement));
5+
return ownerDocument(ReactDOM.findDOMNode(componentOrElement));
66
}

src/utils/ownerWindow.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
1+
import ReactDOM from 'react-dom';
22
import ownerWindow from 'dom-helpers/ownerWindow';
33

44
export default function (componentOrElement) {
5-
return ownerWindow(React.findDOMNode(componentOrElement));
5+
return ownerWindow(ReactDOM.findDOMNode(componentOrElement));
66
}

test/ModalSpec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
2+
import ReactDOM from 'react-dom';
23
import ReactTestUtils from 'react/lib/ReactTestUtils';
34
import Modal from '../src/Modal';
45
import { render } from './helpers';
56
import jquery from 'jquery';
67
import simulant from 'simulant';
78
import Transition from '../src/Transition';
89

9-
let $ = componentOrNode => jquery(React.findDOMNode(componentOrNode));
10+
let $ = componentOrNode => jquery(ReactDOM.findDOMNode(componentOrNode));
1011

1112
describe('Modal', function () {
1213
let mountPoint;
@@ -17,7 +18,7 @@ describe('Modal', function () {
1718
});
1819

1920
afterEach(function () {
20-
React.unmountComponentAtNode(mountPoint);
21+
ReactDOM.unmountComponentAtNode(mountPoint);
2122
document.body.removeChild(mountPoint);
2223
});
2324

@@ -28,8 +29,7 @@ describe('Modal', function () {
2829
</Modal>
2930
, mountPoint);
3031

31-
assert.ok(
32-
ReactTestUtils.findRenderedDOMComponentWithTag(instance.refs.modal, 'strong'));
32+
assert.equal(instance.refs.modal.querySelectorAll('strong').length, 1);
3333
});
3434

3535
it('Should disable scrolling on the modal container while open', function() {
@@ -57,7 +57,7 @@ describe('Modal', function () {
5757

5858
let instance = render(<Container />, mountPoint);
5959
let modal = ReactTestUtils.findRenderedComponentWithType(instance, Modal);
60-
let backdrop = React.findDOMNode(modal.refs.backdrop);
60+
let backdrop = modal.refs.backdrop;
6161

6262
expect($(instance).css('overflow')).to.equal('hidden');
6363

@@ -92,7 +92,7 @@ describe('Modal', function () {
9292

9393
let instance = render(<Container />, mountPoint);
9494
let modal = ReactTestUtils.findRenderedComponentWithType(instance, Modal);
95-
let backdrop = React.findDOMNode(modal.refs.backdrop);
95+
let backdrop = modal.refs.backdrop;
9696

9797
expect($(instance).hasClass('test test2')).to.be.true;
9898

@@ -109,7 +109,7 @@ describe('Modal', function () {
109109
</Modal>
110110
, mountPoint);
111111

112-
let backdrop = React.findDOMNode(instance.refs.backdrop);
112+
let backdrop = instance.refs.backdrop;
113113

114114
ReactTestUtils.Simulate.click(backdrop);
115115

@@ -124,7 +124,7 @@ describe('Modal', function () {
124124
</Modal>
125125
, mountPoint);
126126

127-
let backdrop = React.findDOMNode(instance.refs.backdrop);
127+
let backdrop = instance.refs.backdrop;
128128

129129
ReactTestUtils.Simulate.click(backdrop);
130130
});
@@ -137,7 +137,7 @@ describe('Modal', function () {
137137
</Modal>
138138
, mountPoint);
139139

140-
let backdrop = React.findDOMNode(instance.refs.backdrop);
140+
let backdrop = instance.refs.backdrop;
141141

142142
ReactTestUtils.Simulate.click(backdrop);
143143

@@ -152,7 +152,7 @@ describe('Modal', function () {
152152
</Modal>
153153
, mountPoint);
154154

155-
let backdrop = React.findDOMNode(instance.refs.backdrop);
155+
let backdrop = instance.refs.backdrop;
156156

157157
simulant.fire(backdrop, 'keyup', { keyCode: 27 });
158158
});
@@ -166,7 +166,7 @@ describe('Modal', function () {
166166
</Modal>
167167
, mountPoint);
168168

169-
let backdrop = React.findDOMNode(instance.refs.backdrop);
169+
let backdrop = instance.refs.backdrop;
170170

171171
expect(
172172
backdrop.style.borderWidth).to.equal('3px');
@@ -273,7 +273,7 @@ describe('Modal', function () {
273273
});
274274

275275
afterEach(function () {
276-
React.unmountComponentAtNode(focusableContainer);
276+
ReactDOM.unmountComponentAtNode(focusableContainer);
277277
document.body.removeChild(focusableContainer);
278278
});
279279

test/PortalSpec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import ReactDOM from 'react-dom';
23
import ReactTestUtils from 'react/lib/ReactTestUtils';
34
import Portal from '../src/Portal';
45

@@ -20,7 +21,7 @@ describe('Portal', function () {
2021

2122
afterEach(function() {
2223
if (instance && ReactTestUtils.isCompositeComponent(instance) && instance.isMounted()) {
23-
React.unmountComponentAtNode(React.findDOMNode(instance));
24+
ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance));
2425
}
2526
});
2627

@@ -45,7 +46,7 @@ describe('Portal', function () {
4546
<Container />
4647
);
4748

48-
assert.equal(React.findDOMNode(instance).querySelectorAll('#test1').length, 1);
49+
assert.equal(ReactDOM.findDOMNode(instance).querySelectorAll('#test1').length, 1);
4950
});
5051

5152
it('Should not render a null overlay', function() {

test/PositionSpec.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pick from 'lodash/object/pick';
22
import React from 'react';
3+
import ReactDOM from 'react-dom';
34
import ReactTestUtils from 'react/lib/ReactTestUtils';
45

56
import Position from '../src/Position';
@@ -14,7 +15,7 @@ describe('Position', function () {
1415
<span>Text</span>
1516
</Position>
1617
);
17-
assert.equal(React.findDOMNode(instance).nodeName, 'SPAN');
18+
assert.equal(ReactDOM.findDOMNode(instance).nodeName, 'SPAN');
1819
});
1920

2021
it('Should warn about several children', function () {
@@ -57,7 +58,7 @@ describe('Position', function () {
5758
<div ref="bar" />
5859

5960
<Position
60-
target={() => React.findDOMNode(this.refs[this.state.target])}
61+
target={() => this.refs[this.state.target]}
6162
fakeProp={this.state.fakeProp}
6263
>
6364
<div />
@@ -102,7 +103,7 @@ describe('Position', function () {
102103
});
103104

104105
afterEach(function () {
105-
React.unmountComponentAtNode(mountPoint);
106+
ReactDOM.unmountComponentAtNode(mountPoint);
106107
document.body.removeChild(mountPoint);
107108
});
108109

@@ -135,7 +136,7 @@ describe('Position', function () {
135136
}}/>
136137

137138
<Position
138-
target={() => React.findDOMNode(this.refs.target)}
139+
target={() => this.refs.target}
139140
container={this}
140141
containerPadding={50}
141142
placement={placement}

0 commit comments

Comments
 (0)