@@ -70,6 +70,8 @@ export default class GoogleMap extends Component {
70
70
71
71
static propTypes = {
72
72
apiKey : PropTypes . string ,
73
+ bootstrapURLKeys : PropTypes . any ,
74
+
73
75
defaultCenter : React . PropTypes . oneOfType ( [
74
76
PropTypes . array ,
75
77
PropTypes . shape ( {
@@ -152,6 +154,12 @@ export default class GoogleMap extends Component {
152
154
this . childMouseUpTime_ = 0 ;
153
155
154
156
if ( process . env . NODE_ENV !== 'production' ) {
157
+ if ( this . props . apiKey ) {
158
+ console . warn ( 'GoogleMap: ' + // eslint-disable-line no-console
159
+ 'apiKey is deprecated, use ' +
160
+ 'bootstrapURLKeys={{key: YOUR_API_KEY}} instead.' ) ;
161
+ }
162
+
155
163
if ( this . props . onBoundsChange ) {
156
164
console . warn ( 'GoogleMap: ' + // eslint-disable-line no-console
157
165
'onBoundsChange is deprecated, use ' +
@@ -193,7 +201,12 @@ export default class GoogleMap extends Component {
193
201
194
202
window . addEventListener ( 'mouseup' , this . _onChildMouseUp , false ) ;
195
203
196
- this . props . googleMapLoader ( this . props . apiKey ) ; // we can start load immediatly
204
+ const bootstrapURLKeys = {
205
+ ...( this . props . apiKey && { key : this . props . apiKey } ) ,
206
+ ...this . props . bootstrapURLKeys ,
207
+ } ;
208
+
209
+ this . props . googleMapLoader ( bootstrapURLKeys ) ; // we can start load immediatly
197
210
198
211
setTimeout ( ( ) => { // to detect size
199
212
this . _setViewSize ( ) ;
@@ -307,7 +320,12 @@ export default class GoogleMap extends Component {
307
320
308
321
this . _onBoundsChanged ( ) ; // now we can calculate map bounds center etc...
309
322
310
- this . props . googleMapLoader ( this . props . apiKey )
323
+ const bootstrapURLKeys = {
324
+ ...( this . props . apiKey && { key : this . props . apiKey } ) ,
325
+ ...this . props . bootstrapURLKeys ,
326
+ } ;
327
+
328
+ this . props . googleMapLoader ( bootstrapURLKeys )
311
329
. then ( maps => {
312
330
if ( ! this . mounted_ ) {
313
331
return ;
0 commit comments