You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Import the `GoogleMapProvider` and wrap it around your components.
41
-
Make sure all components that should have access to the Google Maps map instance
42
-
are nested inside of the `GoogleMapProvider`.
41
+
Make sure all components that should have access to the Google Maps map instance are nested inside the `GoogleMapProvider`.
42
+
43
+
If you still can't see a map on your page, make sure that your `<MapCanvas>` component has a `height` CSS property. By default it will have a `height: 0`.
@@ -100,10 +97,6 @@ Component to wrap around the code where the map should be available.
100
97
googleMapsAPIKey="my Google Maps API key"
101
98
mapContainer={mapContainer}
102
99
options={mapOptions}
103
-
libraries={['places']}
104
-
mapIds={['<your-mapstyle-id>']}
105
-
language={'de'}
106
-
region={'DE'}
107
100
onLoad={(map) =>map.setZoom(4)}
108
101
>
109
102
{children}
@@ -115,13 +108,29 @@ Component to wrap around the code where the map should be available.
115
108
```TypeScript
116
109
interfaceGoogleMapProviderProps {
117
110
children:React.ReactElement;
111
+
112
+
// The Google Maps API Key
118
113
googleMapsAPIKey:string;
114
+
115
+
// A reference to the component that displays the map
119
116
mapContainer?:HTMLElement|null;
117
+
118
+
// The Google Maps MapOptions, see: https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions
120
119
options:google.maps.MapOptions;
120
+
121
+
// Additional Google Maps libraries to load ('drawing', 'geometry', 'places' or 'visualization'), see: https://developers.google.com/maps/documentation/javascript/libraries
121
122
libraries?:string[];
123
+
124
+
// By default Google Maps will use the preferred language from the browser setting. This is the property to set it manually, see: https://developers.google.com/maps/documentation/javascript/localization
122
125
language?:string;
126
+
127
+
// By default Google Maps will use the preferred region from the browser setting. This is the property to set it manually, see: https://developers.google.com/maps/documentation/javascript/localization
123
128
region?:string;
129
+
130
+
// Use this parameter for cloud-based map styling (in beta), see: https://developers.google.com/maps/documentation/javascript/cloud-based-map-styling
124
131
mapIds?:string[];
132
+
133
+
// A callback function that is called, when the map is loaded.
125
134
onLoad?: (map:google.maps.Map) =>void;
126
135
}
127
136
```
@@ -315,7 +324,7 @@ Returns the [`PlacesService`](google.maps.places.PlacesService) class to use dir
315
324
google.maps.places.PlacesService
316
325
```
317
326
318
-
## Publish
327
+
## Publish (only for maintainers)
319
328
320
329
To publish new versions to the Github package registry, follow [this guide here](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages).
0 commit comments