GithubHelp home page GithubHelp logo

tschoffelen / react-native-map-link Goto Github PK

View Code? Open in Web Editor NEW
640.0 7.0 137.0 3.11 MB

πŸ—Ί Open the map app of the user's choice.

License: MIT License

JavaScript 2.71% TypeScript 97.29%
react-native ios android maps directions

react-native-map-link's Introduction

React Native Map Link

GitHub release npm GitHub license


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. The app supports Apple Maps, Google Maps, Citymapper, Uber, and a dozen other apps.

Full list of supported apps
  • Apple Maps – apple-maps
  • Google Maps – google-maps
  • Citymapper – citymapper
  • Uber – uber
  • Lyft – lyft
  • The Transit App – transit
  • TruckMap – truckmap
  • Waze – waze
  • Yandex.Navi – yandex
  • Moovit – moovit
  • Yandex Taxi – yandex-taxi
  • Yandex Maps – yandex-maps
  • Kakao Map – kakaomap
  • TMAP - tmap
  • Mapy.cz – mapycz
  • Maps.me – maps-me
  • OsmAnd - osmand
  • Gett - gett
  • Naver Map - navermap
  • 2GIS - dgis
  • Liftago - liftago
  • Petal Maps - petalmaps (Android only)
  • Sygic - sygic


Example screenshot

Installation

1. Install the package

npm i -S react-native-map-link      # or yarn add react-native-map-link

2. Post-install steps

Based on the platforms your app supports, you also need to:

iOS – Update 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/{my-project}/Info.plist to specify the URL schemes with which the app can interact.

Just add 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>transit</string>
    <string>truckmap</string>
    <string>waze</string>
    <string>yandexnavi</string>
    <string>moovit</string>
    <string>yandextaxi</string>
    <string>yandexmaps</string>
    <string>kakaomap</string>
    <string>tmap</string>
    <string>szn-mapy</string>
    <string>mapsme</string>
    <string>osmandmaps</string>
    <string>gett</string>
    <string>nmap</string>
    <string>dgis</string>
    <string>lftgpas</string>
    <string>sygic</string>
</array>

Using Expo? Read the instructions to make it work on iOS.

Android – Update AndroidManifest.xml

When switching to Android 11/Android SDK 30 (i.e. using Expo SDK 41), this library doesn't work out of the box anymore. The reason is the new Package Visibilty security feature. We'll have to update our AndroidManifest.xml to explicitly allow querying for other apps.

You can do so by coping the <queries> statement below, and pasting it in the top level of your AndroidManifest (i.e. within the <manifest> ... </manifest>).

<queries>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="http"/>
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="https"/>
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="geo" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="google.navigation" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="applemaps" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="citymapper" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="uber" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="lyft" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="transit" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="truckmap" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="waze" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="yandexnavi" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="moovit" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="yandexmaps://maps.yandex." />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="yandextaxi" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="kakaomap" />
  </intent>
    <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="tmap" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="mapycz" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="mapsme" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="osmand.geo" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="gett" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="nmap" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="dgis" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="lftgpas" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="petalmaps" />
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="com.sygic.aura" />
  </intent>
</queries>

If you're running into a 'unexpected element <queries> found in <manifest>' error, make sure you have an updated version of Gradle in your android/build.gradle file:

classpath("com.android.tools.build:gradle:3.5.4")

More info here.

Expo – Update app.json

Read the instructions here

Simple example

import {showLocation} from 'react-native-map-link';

showLocation({
  latitude: 38.8976763,
  longitude: -77.0387185,
  title: 'Your destination',
});

Full usage

Using the showLocation function will shown an action sheet on iOS and an alert on Android, without any custom styling:

import {showLocation} from 'react-native-map-link';

showLocation({
  latitude: 38.8976763,
  longitude: -77.0387185,
  sourceLatitude: -8.0870631, // optionally specify starting location for directions
  sourceLongitude: -34.8941619, // required if sourceLatitude is specified
  title: 'The White House', // optional 
  googleForceLatLon: false, // optionally force GoogleMaps to use the latlon for the query instead of the title
  googlePlaceId: 'ChIJGVtI4by3t4kRr51d_Qm_x58', // optionally specify the google-place-id
  alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
  dialogTitle: 'This is the dialog Title', // optional (default: 'Open in Maps')
  dialogMessage: 'This is the amazing dialog Message', // optional (default: 'What app would you like to use?')
  cancelText: 'This is the cancel button text', // optional (default: 'Cancel')
  appsWhiteList: ['google-maps'], // optionally you can set which apps to show (default: will show all supported apps installed on device)
  naverCallerName: 'com.example.myapp', // to link into Naver Map You should provide your appname which is the bundle ID in iOS and applicationId in android.
  appTitles: {'google-maps': 'My custom Google Maps title'}, // optionally you can override default app titles
  app: 'uber', // optionally specify specific app to use
  directionsMode: 'walk', // optional, accepted values are 'car', 'walk', 'public-transport' or 'bike'
});

Alternatively you can specify the address field and leave the latitude and longitude properties as empty strings

import {showLocation} from 'react-native-map-link';

showLocation({
  address: '1600 Pennsylvania Avenue NW, Washington, DC 20500', // Required if replacing latitude and longitude
  app: 'comgooglemaps',  // optionally specify specific app to use
});

Notes:

  • The sourceLatitude / sourceLongitude options only work if you specify both. Currently supports all apps except Waze.
  • directionsMode works on google-maps, apple-maps and sygic (on apple-maps, bike mode will not work, while on sygic, only walk and car will work). Without setting it, the app will decide based on its own settings.
  • If you set directionsMode but do not set sourceLatitude and sourceLongitude, google-maps and apple-maps will still enter directions mode, and use the current location as starting point.
  • If you want to query an address instead of passing the latitude and longitude fields, you can do this by leaving those fields off and provide a full address to be queried with the address field. Just be aware that not all applications support this.

Or

Using the getApps function will return an array (GetAppResult[]) with the apps available on the smartphone:

type GetAppResult = {
  id: string;
  name: string;
  icon: NodeRequire;
  open: () => Promise<void>;
};
import {getApps, GetAppResult} from 'react-native-map-link';

const Demo = () => {
  const [availableApps, setAvailableApps] = useState<GetAppResult[]>([]);

  useEffect(() => {
    (async () => {
      const result = await getApps({
        latitude: 38.8976763,
        longitude: -77.0387185,
        address: '1600 Pennsylvania Avenue NW, Washington, DC 20500', // optional 
        title: 'The White House', // optional
        googleForceLatLon: false, // optionally force GoogleMaps to use the latlon for the query instead of the title
        alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
        appsWhiteList: ['google-maps'], // optionally you can set which apps to show (default: will show all supported apps installed on device)
      });
      setAvailableApps(result);
    })();
  }, []);

  return (
    <React.Fragment>
      {availableApps.map(({icon, name, id, open}) => (
        <Pressable key={id} onPress={open}>
          <Image source={icon} />
          <Text>{name}</Text>
        </Pressable>
      ))}
    </React.Fragment>
  );
};

More information




Get professional support for this package β†’
Custom consulting sessions available for implementation support or feature development.

react-native-map-link's People

Contributors

tschoffelen avatar dependabot[bot] avatar fabianurrutia avatar greenkeeper[bot] avatar johanleroch avatar meteorlxy avatar lorenc-tomasz avatar codingbyjerez avatar jorgerodrigues avatar vvscode avatar theneekz avatar trentcharlie avatar djalmaaraujo avatar cesar3030 avatar alexsegura avatar erickriva avatar hanlitheron avatar mgithubmessier avatar steveafrost avatar gbahamondezc avatar thomas-colbert avatar bcalik avatar nicolasaoki avatar brunocavallarigois avatar owenmelbz avatar fabianurrutiao avatar exiam avatar eatnug avatar grifotv avatar aryk avatar

Stargazers

Rinaldy avatar oldo.nicho avatar Lamina Rinami avatar Benjamin Stirrup avatar Irina Shefer avatar  avatar  avatar Ivan avatar Nicola Reggiani avatar Nicolas Cavallin avatar Ting Hao avatar Bergin avatar Mathieu Castets avatar Stanjhae avatar Alban Ameti avatar  avatar  avatar Bohdan D. avatar Hugo avatar Robin Mitra avatar Jerry Almeida avatar Adam Coulon avatar  avatar Jeroen van Warmerdam avatar Cayon_xiye avatar Jo avatar sece avatar Aleksandar avatar Taj English avatar  avatar lunarnaut avatar Δ°zni Burak Demirtaş avatar Muhammad Bilal avatar JoΓ£o Victor avatar Sean Ormiston avatar Moshe Jonathan Gordon Radian avatar  avatar Jakub Bilko avatar Ashutosh Khanduala avatar Eli Crypto avatar Gustavo Bonfim avatar urdadx avatar Alex Miles avatar Premdas Vm avatar Mykyta Rusyn avatar Sayyid Shalahuddin avatar Christophe Menager avatar Jhon Santos avatar Daniel Durante avatar  avatar CΓΆmert Γ‡imen avatar Jan Ziemba avatar TimoDevs avatar Nwachukwu Daniel (DONSN) avatar  avatar Dave Paiva avatar Ashraf Ali avatar Viljar KΓ€rgenberg avatar Fanchen Bao avatar  avatar  avatar Kartikey Vaish avatar VΓ­t RozsΓ­val avatar Δ°smail Harmanda avatar Leonardo Nogueira avatar  avatar Alexandre Lebailly avatar  avatar Nicolas STOPHE avatar done000 avatar Serhiy avatar Bogdan Georgian Alexa avatar Sinan avatar  avatar Aron Marriott-Smith avatar Thanapol Pilawal avatar  avatar Doddy Rizal Novianto avatar Anthony bassey avatar Dawid avatar Muhamad Zulfiqor avatar Kazuma Ohashi avatar Alex Trofimov avatar  avatar Andrea avatar Josh Price avatar Thomas Roux avatar  avatar Olexandr Horbunov avatar Saad avatar Clarence Joseph Dimafelix avatar xiaobc avatar Mertcan Karaman avatar Siham Ben Daia avatar Marcos VinΓ­cius Mafei Machado avatar Yannis Ragkavas avatar Martin H avatar TΓΉng TrαΊ§n avatar Rhenald Karrel avatar YoungChief avatar

Watchers

 avatar James Cloos avatar Thank avatar Arda Zafer Δ°bin avatar  avatar Onur Ozdemir avatar Harish M avatar

react-native-map-link's Issues

ActionSheet Not Opening in IOS

Hi,

ActionSheet not opening in ios.
When I debug the code I found that Linking.canOpenUrl() method returns false but the apps are installed in mobile(ios) and defined the schemas in LSApplicationQueriesSchmes. Please can you give me the suggestion how to do?

Thanks in Advance

Popup not working on Android.

Hi... I am newbie in React Native.
I follow this example https://github.com/leanmotherfuckers/react-native-map-link/blob/master/docs/popup.md

Everything is working well on iOS, but not working on Android.
What is wrong here ? (Please look my attachment file)

The logic is
I have a component named "OpenMapLocation". This component have 2 props, named 'address' and 'title'. Then with Geocoder (react-native-geocoding), I can get LatLong of the address.

OpenMapLocation.js.txt

Here the sample result on iOS
Xnip2019-05-09_17-07-31

When I click the address, the popup will be displayed. It is working on iOS.
BUT NOT on Android.
Could you help me please? :)

Issue with fork and PR

I created a fork and am testing the fix on my repo but the directory format is different than yours when I add it to my project. I noticed you have a src file in the repo but when I add it to my project the src becomes the root. But in my fork when I try to add it to my project its still react-native-map-link/src.

Any help on what I am doing wrong? I didnt see any scripts in package.json..

Android - Latitude and longitude is getting ignored

Doesn't seems to pickup the latitude and longitude on Android

It opens the google map with Location as a search keyword.

If we specify a title then Google map is opening searching for this title, however still no pin corresponding to the latitude and longitude.

It's working fine on iOS

Part of `Options` is not optional anymore

According to the Basic usage section from REDME, dialogTitle, dialogMessage and cancelText are optional. But after update to "^2.1.2" they don't seem anymore:

index.d.ts

interface Options {
    latitude: number | string
    longitude: number | string
    sourceLatitude?: number
    sourceLongitude?: number
    googleForceLatLon?: boolean
    googlePlaceId?: number
    title?: string
    app?: string
    dialogTitle: string
    dialogMessage: string
    cancelText: string
    appsWhiteList?: string[]
}

v2.4.1: getAvailableApps () always returns empty Array

Hi,
the showLocation() function stopped working for me, even when testing it on a real iOS device and not the simulator. So I went through the code of the latest version (2.4.1 at the time of writing this), and noticed this in src/utils.js:

export const getAvailableApps = async (prefixes) => {
  let availableApps = []
  for (let app in prefixes) { // prefixes is always undefined -> no apps will be returned
    if (!prefixes.hasOwnProperty(app)) {
      continue
    }
    let avail = await isAppInstalled(app, prefixes)
    if (avail) {
      availableApps.push(app)
    }
  }

  return availableApps
}

// ...

export function askAppChoice({ dialogTitle, dialogMessage, cancelText, appsWhiteList }) {
  return new Promise(async (resolve) => {
    let availableApps = await getAvailableApps() // shouldn't this be called with a parameter?
    // ...
  })
}

Why is the prefixes parameter not handed to the getAvailableApps () function? Or, differently asked, can v2.4.1 work for anybody at all?

Thanks for some infos.

Google Maps

Love the code this is great and works fantastic for all the supplies i use apart from Google maps. When it tries to use google maps on an Iphone it just opens google maps but doesn't go to the supplied lat and long it seems to be looking more for what is passed in the title prop rather than using the supplied coordinates. My code is the same as example code except i'm passing different coorordinates which work on Apple Maps, Waze etc. Any ideas any one else with this problem?
"react-native": "^0.49.3", "react": "^16.0.0-beta.5", "react-native-map-link": "^1.0.5",

Add support for Careem

Are the only apps that will open the ones listed on the readme page?
For example, I don't see "careem" listed - could I find the right id for careem and add it?

An in-range update of babel-eslint is breaking the build 🚨

The devDependency babel-eslint was updated from 10.0.2 to 10.0.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

babel-eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • ❌ Tidelift: Failed dependency checks (Details).

Commits

The new version differs by 2 commits.

  • 183d13e 10.0.3
  • 354953d fix: require eslint dependencies from eslint base (#794)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Applications filtering

Hi,

First, thanks a lot for this awesome work!

I was taking a look to the docs and code and i can't find a way to show only the apps that i want in the Popup Component.

IE: Maybe i have google maps installed but i don't want to show Google Maps as an option.

Is that possible?

Regards

An in-range update of eslint-plugin-node is breaking the build 🚨

The devDependency eslint-plugin-node was updated from 9.1.0 to 9.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… Tidelift: Dependencies checked (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 9 commits.

  • 9fbdaec πŸ”– 9.2.0
  • c1d5dbf ✨ add no-callback-literal rule (#179)
  • 72de3a3 πŸ› vulnerability fix: update eslint-utils to ^1.4.2 & eslint-plugin-es to ^1.4.1 (fixes #180) (#183)
  • cfc6352 🎨 fix typos in function names (#177)
  • b757c3e βš’ improve azure-pipelines.yml (#173)
  • a85d541 βš’ trivial fix
  • 88829af βš’ Update azure-pipelines.yml for codecov (#170)
  • 5b3f815 πŸ› fix for ESLint 6 (#169)
  • fe73872 βš’ Switch to Azure Pipelines (#168)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Remember last app selection

Hi, what do you think about to have an option to remember last app selection?

I mean when the user selects a navigation app, give them another option to remember the last selected app for future interactions.

Makes sense or maybe is something which not correspond to the scope of this library?

Open default map with specific navigation method

Hi, is it possible to add another param to the showLocation function to customize the navigation method when we open the app? For example, when I enter a source and destination I also want the option to specify the navigation method as walking initially or driving/cycling for google maps.

Thanks!

No apps open when tapped

We installed the package and the UI for the popup looks fantastic when opened, however when we click on any of the mapping options (apple/google/uber/lyft/waze) nothing happens, the modal just disappears and the following warning is generated in the console:

Possible Unhandled Promise Rejection (id: 1):
TypeError: Cannot read property 'indexOf' of undefined
TypeError: Cannot read property 'indexOf' of undefined
    at checkOptions (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:110095:59)
    at showLocation$ (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:106794:37)
    at tryCatch (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18420:19)
    at Generator.invoke [as _invoke] (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18593:24)
    at Generator.prototype.(anonymous function) [as next] (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18463:23)
    at tryCatch (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18420:19)
    at invoke (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18496:22)
    at blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:18524:13
    at tryCallTwo (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:5193:7)
    at doResolve (blob:file:///722dfb5c-3809-4aaa-bd85-0cea3ed24ad4:5357:15)

Are there any additional setup steps not included in the README such as linking or anything? I put the required fields in on the Info.plist but there seems to be no other installation steps. Thanks, looks like a great package!

Our implementation is as follows:

        <Popup
          isVisible={this.state.navigationDirectionsPopupVisible}
          onCancelPressed={() => this.setState({ navigationDirectionsPopupVisible: false })}
          onAppPressed={() => this.setState({ navigationDirectionsPopupVisible: false })}
          onBackButtonPressed={() => this.setState({ navigationDirectionsPopupVisible: false })}
          modalProps={{
            // you can put all react-native-modal props inside.
            animationIn: 'slideInUp'
          }}
          options={{
            latitude: 38.8976763,
            longitude: -77.0387185,
            title: 'The White House', // optional
            dialogTitle: 'Get Directions', // optional (default: 'Open in Maps')
            dialogMessage: 'Choose your prefered application', // optional (default: 'What app would you like to use?')
            cancelText: 'Nevermind' // optional (default: 'Cancel')
          }}
          style={
            {
              /* Optional: you can override default style by passing your values. */
            }
          }
        />

Additionally the showLocation method does nothing. When we call it no actionsheet pops up like the documentation states it will.

OS: iOS 11
Device: iPhone X
React: v0.55

UPDATE:
I dug through your code and noticed that upon tapping the following is called:

  _onAppPressed = ({app}) => {
    showLocation({...this.props.options, app})
    this.props.onAppPressed()

This makes sense that nothing is happening since the showLocation does not work for me directly either. The problem lies within showLocation

UPDATE 2:
Diving into your code it looks like it's an error in your utils.js file on line 121 apps.indexOf(options.app) < 0 - I have confirmed that for whatever reason apps is undefined so it silently fails and nothing happens. Please advise where we should go from here. If I wrap this in a try/catch the mapping applications open fine but curious why this is happening.

UPDATE 3:
Ok, it's importing { apps } from constants/index.js however there is no apps exported from constants/index.js.... so looks just like coder error and a lack of tests. I have forked to my own repo for fix.

ios app proposal

Hello,

I just used the library and it works fine on Android.
On IOS also it works but when the modal is open i only see apple maps in the app proposal even if i update info.plist file by adding the apps i want, i still dont get the proposal working.
N.B: tested on IOS 11 and 12 / RN 0.58.3
Capture d’écran 2019-04-01 aΜ€ 17 39 24

'comgooglemaps' not being detected on ios with Expo

First of all I want to say thank you for open-sourcing this library. It is well-done and super useful.

I want to revisit issue #39 since I am encountering the same issue. It successfully detects Waze, but not Google Maps.

I too am using Expo and my app.json file includes:

"ios": {
    "infoPlist": {
      "LSApplicationQueriesSchemes": [
          "comgooglemaps",
          "apple-maps",
          "citymapper",
          "waze"
        ]
      }
  }

Just like in that other issue, I editing contacts.js in the following way:

export const prefixes = {
...
- 'google-maps': isIOS ? 'comgooglemaps://' : 'https://maps.google.com/',
+ 'google-maps': 'https://maps.google.com/',
...
}

When I do this, the Google Maps app is detected and it opens as I would expect. But without this, it never appears on the list. In #39, it says that 'comgooglemaps' is more reliable, but this does not seem to be the case.

Thanks.

Logo design proposal: React Native Map Link

Hey! I can contribute on your project with making logo design. If you interested I can show my portfolio. I am waiting your feedback, have a nice day!

Best Regards
Baran Pirinçal
Graphic Designer

An in-range update of eslint-config-standard is breaking the build 🚨

The devDependency eslint-config-standard was updated from 14.0.1 to 14.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-config-standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… Tidelift: Dependencies checked (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 3 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

npm needs update

npm latests version is 1.0.5.

In that version this error stills happens:

Unhandled promise rejection: TypeError: Array.prototype.find callback must be a function

fixed issue in v1.0.6

open default map app with address as a string [country, street, house number]

Hi,
I am looking for a package that open the default map application of the user.
I saw this package and it seem nice, but I noticed it receive a location by latitude and longitude.
Is there a way to send the default map application the location as a string - for example:
St foo 100, Bar (bar is the country).

and this location/address string will be placed in the search box of the application?

Override application titles

Currently, the application titles in the app selection menu are displayed are based on constants. It would be nice if we could override those. For example, using internationalization we could have the apps name translated.

I am suggesting something along the lines of:

const app = await showLocation({
  appTitles: [
    'apple-maps': 'Plans',
    'google-maps': 'Cartes Google',
  ]
});

Then this config could be merged with the title constant to generate the menu.

If this is something we want as a new feature, I am willing to implement it and open a PR.

Let me know.

IOS 11 Issue - App Selection suddenly disappears

Hi,

I used react-native-map-link where I just pass the origin and destination longitude and latitude. Everthing is ok in Android but I encountered an issue in IOS where it shows the modal of the available Map applications but it suddenly disappears in 1-2 second then the app hangs.

Here's my implementation:
screen shot 2018-07-13 at 1 33 47 pm

Hoping for your assistance on this.

An in-range update of eslint-plugin-react is breaking the build 🚨

The devDependency eslint-plugin-react was updated from 7.14.0 to 7.14.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v7.14.1

Fixed

  • Fix prop-types crash on multiple destructuring (#2319 @golopot)
Commits

The new version differs by 3 commits.

  • 62255af Update CHANGELOG and bump version
  • 655eb01 Merge pull request #2320 from golopot/issue-2319
  • 9639d82 [Fix] prop-types: fix crash on multiple destructuring

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Google maps never show the location, just loading

Sorry for my english in advance.

I'm testing with the example code and works perfectly in all platforms (i test just in my android device) excepts in G-Maps. The map never shows the location pointer and just put the loading icon in the search bar.

image

I'm using a Moto G5 plus - Android 8.1.0. [email protected]

Changelog

Hi there - it would be very helpful if there were a changelog for this package. In particular, knowing if there are breaking changes between v1.X.x and v2.0.x would be great!

Uber isn't workin here

Google Maps an Waze working Fine, but when Uber is the choice just open the app.

Expected Behavior:
Open Uber and fill the input with the adress, just leaving to the user the final step.

Android build fail

android/app/build/intermediates/res/merged/release/drawable-xhdpi/node_modules_reactnativemaplink_as
sets_images_yandex.png: error: uncompiled PNG file passed as argument. Must be compiled first into .flat file..
error: failed parsing overlays.

Get current location automatically

I think it would be better if sourceLatitude & sourceLongitude is not defined, capture the current location automatically. It would be a good feature for this package. Thanks in advance πŸ™πŸ»

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Testing using expo app

Hi
Thanks for this plug-in - working nice
I'm building the app using expo and react native.
When I use the function showLocation, although I have put three apps in the whitelist options (google maps, apple maps and uber), it opens directly in apple maps. I've tried both in simulator and expo app on a device

No apps shown

Hi guys. I ejected an expo project to react-native and the popup doesn't work anymore. I upgraded to @2.4.3 but it didn't fix it for me. I must say that on expo, in order to make it work, i needed to add permission READ_PHONE_STATE. I added this to Manifest but it still doesn't work :
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Any ideas? Thanks in advance

Add typescript definitions

I'm using typescript so adding the definitions might be useful for those who use it as well.

I created them for my project, feel free to add them to the repo:

declare module "react-native-map-link" {
    import * as React from 'react';
    import { ViewStyle, StyleProp, ImageStyle, TextStyle } from 'react-native';

    interface Options {
        latitude: number | string
        longitude: number | string
        sourceLatitude?: number
        sourceLongitude?: number
        googleForceLatLon?: boolean 
        googlePlaceId?: number
        title?: string
        app?: string
        dialogTitle: string 
        dialogMessage: string 
        cancelText: string
        appsWhiteList?: string[]
    }

    interface PopupStyleProp {
        container?: StyleProp<ViewStyle>,
        itemContainer?: StyleProp<ViewStyle>,
        image?: StyleProp<ImageStyle>,
        itemText?: StyleProp<TextStyle>,
        headerContainer?: StyleProp<ViewStyle>,
        titleText?: StyleProp<TextStyle>,
        subtitleText?: StyleProp<TextStyle>,
        cancelButtonContainer?: StyleProp<ViewStyle>,
        cancelButtonText?: StyleProp<TextStyle>,
        separatorStyle?: StyleProp<ViewStyle>,
        activityIndicatorContainer?: StyleProp<ViewStyle>
    }

    interface PopupProps {
        isVisible: boolean,
        showHeader?: boolean,
        onCancelPressed: () => void,
        onBackButtonPressed: () => void,
        onAppPressed: () => void,
        style?: PopupStyleProp,
        modalProps?: object,
        options: Options,
        appsWhiteList: string[]
    }

    export function showLocation (options: Options): Promise<void>;
    export class Popup extends React.Component<PopupProps>{}
}

Revisited: opening with google maps on Android opening system's popup to choose with which app to open

This issue is an extension/proposal for #37

After a deeper investigation I found out that system's popup shows only when the map url is https://maps.google.com/... . If we use https://www.google.com/maps/dir/ it's still recognized with google maps yet not recognized by third-party apps which eliminates that annoying popup.

Can you make deeper config options/googlemap-specific option to solve this issue? (or I can submit a PR with it) @tschoffelen

Expo: isAppInstalled does not detect Google Maps app on iOS

When I added yet another prefix for the Google Maps (just an example) Linking.canOpenURL returns true. Otherwise, it is false. Is there any option to provide the list prefixes as a parameter to Popup? Or how otherwise should I solve it?
I work on an Expo based React Native app.
export const prefixes = {
...
'google-maps': isIOS ? 'comgooglemaps://' : 'https://maps.google.com/',
'google-maps': 'https://maps.google.com/',
...
}

Btw. great job on that library!

Explanation about procotols://

Hey @tschoffelen I am trying to understand why this is the opposite:

 'apple-maps': isIOS ? 'http://maps.apple.com/' : 'applemaps://',
  'google-maps': isIOS ? 'comgooglemaps://' : 'https://maps.google.com/',

Why in IOS we dont use applemaps:// ?

Reference: 2daad68

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.