File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 356
356
} ) ;
357
357
} ) ;
358
358
}
359
+ } , {
360
+ key : 'ref' ,
361
+ value : { }
359
362
} , {
360
363
key : 'render' ,
361
364
value : function render ( ) {
370
373
{ style : containerStyles , className : this . props . className } ,
371
374
_react2 . default . createElement (
372
375
'div' ,
373
- { style : style , ref : ' map' } ,
376
+ { style : style , ref : ( element ) => ( this . ref . map = element ) } ,
374
377
'Loading map...'
375
378
) ,
376
379
this . renderChildren ( )
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ export const wrapper = input => WrappedComponent => {
51
51
google : null ,
52
52
options : options
53
53
} ;
54
+
55
+ this . mapRef = React . createRef ( ) ;
54
56
}
55
57
56
58
componentWillReceiveProps ( props ) {
@@ -120,7 +122,7 @@ export const wrapper = input => WrappedComponent => {
120
122
return (
121
123
< div >
122
124
< WrappedComponent { ...props } />
123
- < div ref = "map" />
125
+ < div ref = { this . mapRef } />
124
126
</ div >
125
127
) ;
126
128
}
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ export class Map extends React.Component {
65
65
lng : this . props . initialCenter . lng
66
66
}
67
67
} ;
68
+
69
+ this . mapRef = React . createRef ( ) ;
68
70
}
69
71
70
72
componentDidMount ( ) {
@@ -130,7 +132,7 @@ export class Map extends React.Component {
130
132
const { google} = this . props ;
131
133
const maps = google . maps ;
132
134
133
- const mapRef = this . refs . map ;
135
+ const mapRef = this . mapRef . current ;
134
136
const node = ReactDOM . findDOMNode ( mapRef ) ;
135
137
const curr = this . state . currentLocation ;
136
138
const center = new maps . LatLng ( curr . lat , curr . lng ) ;
@@ -257,7 +259,7 @@ export class Map extends React.Component {
257
259
258
260
return (
259
261
< div style = { containerStyles } className = { this . props . className } >
260
- < div style = { style } ref = "map" >
262
+ < div style = { style } ref = { this . mapRef } >
261
263
Loading map...
262
264
</ div >
263
265
{ this . renderChildren ( ) }
You can’t perform that action at this time.
0 commit comments