Skip to content

Commit 366f57f

Browse files
pReyamrMetalWood
andauthored
Chore/update docs and deps (#20)
Co-authored-by: Malte Modrow <[email protected]>
1 parent 327b00f commit 366f57f

File tree

3 files changed

+378
-112
lines changed

3 files changed

+378
-112
lines changed

README.md

+20-11
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ npm install @ubilabs/google-maps-react-hooks -D
3838
## Usage
3939

4040
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`.
4344

4445
```jsx
4546
import React, { useState, useCallback, forwardRef } from 'react';
@@ -60,10 +61,6 @@ function App() {
6061
googleMapsAPIKey="my Google Maps API key"
6162
mapContainer={mapContainer}
6263
options={mapOptions}
63-
libraries={['places']}
64-
mapIds={['<your-mapstyle-id>']}
65-
language={'de'}
66-
region={'DE'}
6764
onLoad={(map) => map.setZoom(4)}
6865
>
6966
<React.StrictMode>
@@ -100,10 +97,6 @@ Component to wrap around the code where the map should be available.
10097
googleMapsAPIKey="my Google Maps API key"
10198
mapContainer={mapContainer}
10299
options={mapOptions}
103-
libraries={['places']}
104-
mapIds={['<your-mapstyle-id>']}
105-
language={'de'}
106-
region={'DE'}
107100
onLoad={(map) => map.setZoom(4)}
108101
>
109102
{children}
@@ -115,13 +108,29 @@ Component to wrap around the code where the map should be available.
115108
```TypeScript
116109
interface GoogleMapProviderProps {
117110
children: React.ReactElement;
111+
112+
// The Google Maps API Key
118113
googleMapsAPIKey: string;
114+
115+
// A reference to the component that displays the map
119116
mapContainer?: HTMLElement | null;
117+
118+
// The Google Maps MapOptions, see: https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions
120119
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
121122
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
122125
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
123128
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
124131
mapIds?: string[];
132+
133+
// A callback function that is called, when the map is loaded.
125134
onLoad?: (map: google.maps.Map) => void;
126135
}
127136
```
@@ -315,7 +324,7 @@ Returns the [`PlacesService`](google.maps.places.PlacesService) class to use dir
315324
google.maps.places.PlacesService
316325
```
317326

318-
## Publish
327+
## Publish (only for maintainers)
319328

320329
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).
321330

0 commit comments

Comments
 (0)