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 356356 } ) ;
357357 } ) ;
358358 }
359+ } , {
360+ key : 'ref' ,
361+ value : { }
359362 } , {
360363 key : 'render' ,
361364 value : function render ( ) {
370373 { style : containerStyles , className : this . props . className } ,
371374 _react2 . default . createElement (
372375 'div' ,
373- { style : style , ref : ' map' } ,
376+ { style : style , ref : ( element ) => ( this . ref . map = element ) } ,
374377 'Loading map...'
375378 ) ,
376379 this . renderChildren ( )
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ export const wrapper = input => WrappedComponent => {
5151 google : null ,
5252 options : options
5353 } ;
54+
55+ this . mapRef = React . createRef ( ) ;
5456 }
5557
5658 componentWillReceiveProps ( props ) {
@@ -120,7 +122,7 @@ export const wrapper = input => WrappedComponent => {
120122 return (
121123 < div >
122124 < WrappedComponent { ...props } />
123- < div ref = "map" />
125+ < div ref = { this . mapRef } />
124126 </ div >
125127 ) ;
126128 }
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ export class Map extends React.Component {
6565 lng : this . props . initialCenter . lng
6666 }
6767 } ;
68+
69+ this . mapRef = React . createRef ( ) ;
6870 }
6971
7072 componentDidMount ( ) {
@@ -130,7 +132,7 @@ export class Map extends React.Component {
130132 const { google} = this . props ;
131133 const maps = google . maps ;
132134
133- const mapRef = this . refs . map ;
135+ const mapRef = this . mapRef . current ;
134136 const node = ReactDOM . findDOMNode ( mapRef ) ;
135137 const curr = this . state . currentLocation ;
136138 const center = new maps . LatLng ( curr . lat , curr . lng ) ;
@@ -257,7 +259,7 @@ export class Map extends React.Component {
257259
258260 return (
259261 < div style = { containerStyles } className = { this . props . className } >
260- < div style = { style } ref = "map" >
262+ < div style = { style } ref = { this . mapRef } >
261263 Loading map...
262264 </ div >
263265 { this . renderChildren ( ) }
You can’t perform that action at this time.
0 commit comments