I'm trying to figure out why this is the case but wanted to see if anyone more familiar with the code has a clue to where to look.
I have a basic GoogleMap element, using this.state.center. When I change the state, the center is not updated on the map.
Now, if I embed a SearchBox with the Places control, center WILL update through the state change.
Is it possible that basic GoogleMap element is not mapping in the center property on componentUpdate to call map.setCenter but when a SearchBox is added, it is?
Thanks in advance, in the meanwhile I'll keep digging around.
I'm having the same problem. I'm using an outside google places input which is updating the location for the map. The marker (which in my case is the same as defaultCenter) is updating but the defaultCenter is not updating.
Update:
The first example in the demo passes defaultCenter={this.state.position} to the Map component. If you look at the example with places search, you'll see it uses center={this.state.position}. Changing my Map prop from defaultCenter={this.state.position} to center={this.state.position} fixed it for me (i.e. map now updates when position changes).
Thanks @acomito fixed it for me!
Please refer to Getting Help section in the README (or #469).
Most helpful comment
Update:
The first example in the demo passes
defaultCenter={this.state.position}to the Map component. If you look at the example with places search, you'll see it usescenter={this.state.position}. Changing my Map prop fromdefaultCenter={this.state.position}tocenter={this.state.position}fixed it for me (i.e. map now updates when position changes).