react-native-map-link 2.11.1 → 2.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,7 +48,7 @@ npm i -S react-native-map-link # or yarn add react-native-map-link
48
48
 
49
49
  Based on the platforms your app supports, you also need to:
50
50
 
51
- <details>
51
+ <details id="iOSPostInstall">
52
52
  <summary><strong>iOS – Update Info.plist</strong></summary>
53
53
 
54
54
  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.
@@ -84,7 +84,7 @@ Using Expo? [Read the instructions](docs/expo.md) to make it work on iOS.
84
84
 
85
85
  </details>
86
86
 
87
- <details>
87
+ <details id="androidPostInstall">
88
88
  <summary><strong>Android – Update AndroidManifest.xml</strong></summary>
89
89
 
90
90
  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](https://developer.android.com/training/package-visibility) security feature. We'll have to update our `AndroidManifest.xml` to explicitly allow querying for other apps.
@@ -205,7 +205,7 @@ More info [here](https://stackoverflow.com/a/67383641/1129689).
205
205
  <details>
206
206
  <summary><strong>Expo – Update app.json</strong></summary>
207
207
 
208
- [Read the instructions here](docs/expo.md) to make it work on iOS.
208
+ [Read the instructions here](docs/expo.md)
209
209
 
210
210
  </details>
211
211
 
@@ -240,6 +240,7 @@ Notes:
240
240
 
241
241
  - The `sourceLatitude/sourceLongitude` options only work if you specify both. Currently supports all apps except Waze.
242
242
  - `directionsMode` works on google-maps and apple-maps (on the latter, `bike` mode will not work). Without setting it, the app will decide based on his own settings.
243
+ - 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.
243
244
 
244
245
  ### Or
245
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-map-link",
3
- "version": "2.11.1",
3
+ "version": "2.11.3",
4
4
  "description": "Open the map app of the user's choice with a specific location",
5
5
  "main": "index.js",
6
6
  "repository": {
Binary file
Binary file
package/src/index.js CHANGED
@@ -43,7 +43,7 @@ export async function showLocation(options) {
43
43
  let sourceLng;
44
44
  let sourceLatLng;
45
45
 
46
- if ('sourceLatitude' in options && 'sourceLongitude' in options) {
46
+ if (options.sourceLatitude != null && options.sourceLongitude != null) {
47
47
  useSourceDestiny = true;
48
48
  sourceLat = parseFloat(options.sourceLatitude);
49
49
  sourceLng = parseFloat(options.sourceLongitude);
@@ -125,12 +125,16 @@ export async function showLocation(options) {
125
125
  case 'apple-maps':
126
126
  const appleDirectionMode = getDirectionsModeAppleMaps();
127
127
  url = prefixes['apple-maps'];
128
- if (useSourceDestiny) {
129
- url = `${url}?saddr=${sourceLatLng}&daddr=${latlng}`;
128
+ if (useSourceDestiny || options.directionsMode) {
129
+ url = `${url}?daddr=${latlng}`;
130
+ url += sourceLatLng ? `&saddr=${sourceLatLng}` : '';
130
131
  } else if (!options.appleIgnoreLatLon) {
131
132
  url = `${url}?ll=${latlng}`;
132
133
  }
133
- url += useSourceDestiny || !options.appleIgnoreLatLon ? '&' : '?';
134
+ url +=
135
+ useSourceDestiny || options.directionsMode || !options.appleIgnoreLatLon
136
+ ? '&'
137
+ : '?';
134
138
  url += `q=${title ? encodedTitle : 'Location'}`;
135
139
  url += appleDirectionMode ? `&dirflg=${appleDirectionMode}` : '';
136
140
  break;