diff --git a/src/Modal.js b/src/Modal.js index c98041b5e8..7a24bd1b2d 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -226,6 +226,16 @@ const Modal = React.createClass({ }, _setDialogRef(ref){ + // issue #1074 + // due to: https://github.com/facebook/react/blob/v0.13.3/src/core/ReactCompositeComponent.js#L842 + // + // when backdrop is `false` react hasn't had a chance to reassign the refs to a usable object, b/c there are no other + // "classic" refs on the component (or they haven't been processed yet) + // TODO: Remove the need for this in next breaking release + if (Object.isFrozen(this.refs) && !Object.keys(this.refs).length) { + this.refs = {}; + } + this.refs.dialog = ref; //maintains backwards compat with older component breakdown diff --git a/test/ModalSpec.js b/test/ModalSpec.js index 4f88fb5e4e..019a4925a1 100644 --- a/test/ModalSpec.js +++ b/test/ModalSpec.js @@ -160,6 +160,17 @@ describe('Modal', function () { assert.match(dialog.props.className, /\btestCss\b/); }); + it('Should assign refs correctly when no backdrop', function () { + + let test = () => render( + + Message + + , mountPoint); + + expect(test).not.to.throw(); + }); + it('Should pass transition callbacks to Transition', function (done) { let count = 0; let increment = ()=> count++;