Skip to content

Commit

Permalink
Specify how to use Google Maps (react-native-maps#2550)
Browse files Browse the repository at this point in the history
* Specify how to use Google Maps

Installation docs do not mention that `{PROVIDER_GOOGLE}` needs to be added in order to make Google Maps work.

* Update instructions for Google Maps on iOS
  • Loading branch information
Ashwin Nayar authored and rborn committed Oct 22, 2018
1 parent b870c0b commit 1844d46
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,29 @@ manually](https://developers.google.com/maps/documentation/ios-sdk/start). Then,
from your project root to the directory in which you installed the
Google Maps frameworks:
```json
{
"name": "your-app",
"scripts": {
"postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
}
}
```

Re-run `npm install` or `yarn` to ensure the `postinstall` script is run.
```json
{
"name": "your-app",
"scripts": {
"postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
}
}
```
Re-run `npm install` or `yarn` to ensure the `postinstall` script is run.
3. Import and add `{PROVIDER_GOOGLE}` to your JavaScript:
```javascript
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps';
...
<MapView
provider={PROVIDER_GOOGLE}
style={styles.map}
...
>
```
## Build configuration on Android
Expand Down Expand Up @@ -283,7 +296,7 @@ example is below:


```jsx
import MapView from 'react-native-maps';
import MapView, { PROVIDER_GOOGLE } from 'react-native-maps'; // remove PROVIDER_GOOGLE import if not using Google Maps
...
const styles = StyleSheet.create({
container: {
Expand All @@ -301,6 +314,7 @@ const styles = StyleSheet.create({
export default () => (
<View style={styles.container}>
<MapView
provider={PROVIDER_GOOGLE} // remove if not using Google Maps
style={styles.map}
region={{
latitude: 37.78825,
Expand Down

0 comments on commit 1844d46

Please sign in to comment.