File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed 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