react-native-open-map

3.0.2 • Public • Published

React Native Open Map

npm version npm downloads Publish Package
NPM

Choose the application that will open the map

Currently supported apps:

  • Apple Maps – apple-maps
  • Google Maps – google-maps
  • Citymapper – citymapper
  • Uber – uber
  • Lyft – lyft
  • Navigon – navigon
  • The Transit App – transit
  • Waze – waze
  • Moovit - moovit

Try it out

You can try out the Open Map Example app to get a tease of the functionalities of this lib.

Installation

npm install --save react-native-open-map
yarn add react-native-open-map

A note about iOS 9+

As of iOS 9, your app needs to provide the LSApplicationQueriesSchemes key inside 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.

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>comgooglemaps</string>
  <string>citymapper</string>
  <string>uber</string>
  <string>lyft</string>
  <string>navigon</string>
  <string>transit</string>
  <string>waze</string>
  <string>moovit</string>
</array>

Props

Prop Default Type Required
latitude none number/string yes
longitude none number/string yes
title "Location" string no
cancelText "Cancel" string no
actionSheetTitle none string no
actionSheetMessage none string no

Usage

import OpenMap from "react-native-open-map";
 
OpenMap.show({
  latitude: 40.778721,
  longitude: -73.968188,
});
OpenMap.show({
  latitude: 40.778721,
  longitude: -73.968188,
  title: 'Central Park',
  cancelText: 'Close',
  actionSheetTitle: 'Chose app',
  actionSheetMessage: 'Available applications '
});

Credits

This library is based on react-native-map-link.

Package Sidebar

Install

npm i react-native-open-map

Weekly Downloads

70

Version

3.0.2

License

MIT

Unpacked Size

477 kB

Total Files

22

Last publish

Collaborators

  • lucas.monteiro