File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,16 @@ const Modal = React.createClass({
226
226
} ,
227
227
228
228
_setDialogRef ( ref ) {
229
+ // issue #1074
230
+ // due to: https://github.com/facebook/react/blob/v0.13.3/src/core/ReactCompositeComponent.js#L842
231
+ //
232
+ // when backdrop is `false` react hasn't had a chance to reassign the refs to a usable object, b/c there are no other
233
+ // "classic" refs on the component (or they haven't been processed yet)
234
+ // TODO: Remove the need for this in next breaking release
235
+ if ( Object . isFrozen ( this . refs ) && ! Object . keys ( this . refs ) . length ) {
236
+ this . refs = { } ;
237
+ }
238
+
229
239
this . refs . dialog = ref ;
230
240
231
241
//maintains backwards compat with older component breakdown
Original file line number Diff line number Diff line change @@ -160,6 +160,17 @@ describe('Modal', function () {
160
160
assert . match ( dialog . props . className , / \b t e s t C s s \b / ) ;
161
161
} ) ;
162
162
163
+ it ( 'Should assign refs correctly when no backdrop' , function ( ) {
164
+
165
+ let test = ( ) => render (
166
+ < Modal show backdrop = { false } onHide = { function ( ) { } } >
167
+ < strong > Message</ strong >
168
+ </ Modal >
169
+ , mountPoint ) ;
170
+
171
+ expect ( test ) . not . to . throw ( ) ;
172
+ } ) ;
173
+
163
174
it ( 'Should pass transition callbacks to Transition' , function ( done ) {
164
175
let count = 0 ;
165
176
let increment = ( ) => count ++ ;
You can’t perform that action at this time.
0 commit comments