An easy way to open a location in a map app of the user's choice, based on the apps they have installed on their device.
Currently supported apps:
- Apple Maps –
apple-maps
- Google Maps –
google-maps
- Citymapper –
citymapper
- Uber –
uber
- Lyft –
lyft
- The Transit App –
transit
- Waze –
waze
- Yandex.Navi –
yandex
- Moovit –
moovit
- Yandex Maps –
yandex-maps
- Kakao Map –
kakaomap
Installation
1. Install the package
npm i -S react-native-map-link # or yarn add react-native-map-link
2. Update your Info.plist
To allow your app to detect if any of the directions apps are installed, an extra step is required on iOS. Your app needs to provide the LSApplicationQueriesSchemes
key inside ios/Info.plist
to specify the URL schemes with which the app can interact.
Just put this in your Info.plist
depending on which apps you'd like to support. Omitting these might mean that the library can't detect some of the maps apps installed by the user.
LSApplicationQueriesSchemes comgooglemaps citymapper uber lyft transit waze yandexnavi moovit yandexmaps kakaomap
Using Expo? Read the instructions to make it work on iOS.
Usage
Using the showLocation
function will shown an action sheet on iOS and an alert on Android, without any custom styling:
Notes:
- The
sourceLatitude/sourceLongitude
options only work if you specify both. Currently supports all apps except Waze.
More information
Credits
This library is developed by Lean Motherfuckers, a tech consulting company like no other.
Contributors:
- Thomas Schoffelen, @tschoffelen
- Johan le Roch, @JohnLrDev