File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 47
47
"karma-webpack" : " ^2.0.4" ,
48
48
"mocha" : " 3.5.3" ,
49
49
"npm-run-all" : " ^4.1.1" ,
50
- "react" : " ^16" ,
51
- "react-dom" : " ^16" ,
50
+ "react" : " ^16.0.0 " ,
51
+ "react-dom" : " ^16.0.0 " ,
52
52
"react-router" : " ^4.2.0" ,
53
53
"react-router-dom" : " ^4.2.2" ,
54
54
"should" : " ^13.1.0" ,
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ export default class Modal extends Component {
105
105
106
106
componentDidMount ( ) {
107
107
if ( ! canUseDOM ) return ;
108
+
109
+ if ( ! isReact16 ) {
110
+ this . node = document . createElement ( 'div' ) ;
111
+ }
108
112
this . node . className = this . props . portalClassName ;
109
113
110
114
const parent = getParentElement ( this . props . parentSelector ) ;
@@ -164,7 +168,7 @@ export default class Modal extends Component {
164
168
}
165
169
166
170
portalRef = ref => { this . portal = ref ; }
167
-
171
+
168
172
renderPortal = props => {
169
173
const portal = createPortal ( this , (
170
174
< ModalPortal defaultStyles = { Modal . defaultStyles } { ...props } />
@@ -177,10 +181,10 @@ export default class Modal extends Component {
177
181
return null ;
178
182
}
179
183
180
- if ( ! this . node ) {
184
+ if ( ! this . node && isReact16 ) {
181
185
this . node = document . createElement ( 'div' ) ;
182
186
}
183
-
187
+
184
188
return createPortal (
185
189
< ModalPortal ref = { this . portalRef }
186
190
defaultStyles = { Modal . defaultStyles }
You can’t perform that action at this time.
0 commit comments