react-native-maps 0.30.0 → 0.31.0-beta.2

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.
Files changed (49) hide show
  1. package/README.md +4 -4
  2. package/index.d.ts +10 -7
  3. package/index.js +2 -1
  4. package/lib/android/build.gradle +4 -4
  5. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapModule.java +20 -0
  6. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +14 -4
  7. package/lib/components/AnimatedRegion.js +6 -3
  8. package/lib/components/Geojson.js +2 -2
  9. package/lib/components/MapCallout.js +3 -5
  10. package/lib/components/MapCalloutSubview.js +3 -5
  11. package/lib/components/MapCircle.js +5 -5
  12. package/lib/components/MapHeatmap.js +3 -5
  13. package/lib/components/MapLocalTile.js +2 -6
  14. package/lib/components/MapMarker.js +5 -7
  15. package/lib/components/MapOverlay.js +3 -2
  16. package/lib/components/MapPolygon.js +5 -5
  17. package/lib/components/MapPolyline.js +5 -6
  18. package/lib/components/MapUrlTile.js +2 -6
  19. package/lib/components/MapView.js +19 -12
  20. package/lib/components/MapWMSTile.js +2 -6
  21. package/lib/ios/AirMaps/AIRMapManager.m +15 -2
  22. package/lib/ios/AirMaps/AIRMapPolyline.h +1 -0
  23. package/lib/ios/AirMaps/AIRMapPolyline.m +14 -1
  24. package/lib/ios/AirMaps/AIRMapPolylineManager.m +1 -0
  25. package/package.json +42 -5
  26. package/react-native-google-maps.podspec +3 -3
  27. package/react-native-maps.podspec +1 -1
  28. package/.eslintrc +0 -3
  29. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -111
  30. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -32
  31. package/.github/ISSUE_TEMPLATE.md +0 -5
  32. package/.github/PULL_REQUEST_TEMPLATE.md +0 -53
  33. package/.github/stale.yml +0 -17
  34. package/.github/workflows/base.yml +0 -21
  35. package/.prettierrc +0 -4
  36. package/CHANGELOG.md +0 -783
  37. package/docs/callout.md +0 -38
  38. package/docs/circle.md +0 -28
  39. package/docs/examples-setup.md +0 -17
  40. package/docs/geojson.md +0 -52
  41. package/docs/heatmap.md +0 -32
  42. package/docs/installation.md +0 -347
  43. package/docs/mapview.md +0 -252
  44. package/docs/marker.md +0 -85
  45. package/docs/overlay.md +0 -27
  46. package/docs/polygon.md +0 -34
  47. package/docs/polyline.md +0 -65
  48. package/docs/tiles.md +0 -35
  49. package/enable-google-maps +0 -15
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  React Native Map components for iOS + Android
4
4
 
5
5
 
6
- # :warning: Maintainers Wanted [![Maintainers Wanted](https://img.shields.io/badge/maintainers-wanted-red.svg)](https://github.com/react-native-maps/react-native-maps/issues/3564)
7
- We are in need of more people or companies willing to help. If you have enough time and knowledge, and want to become a maintainer, please let us know [here](https://github.com/react-native-maps/react-native-maps/issues/3564).
8
-
6
+ ## Contributing
7
+ This project is being maintained by a small group of people, and any help with issues and pull requests are always appreciated. If you are able and willing to contribute, please read the [guidelines](./CONTRIBUTING.md).
8
+
9
9
  ## Installation
10
10
 
11
11
  See [Installation Instructions](docs/installation.md).
@@ -245,7 +245,7 @@ render() {
245
245
  region={this.state.region}
246
246
  />
247
247
  <OverlayComponent
248
- style={{position: “absolute”, bottom: 50}}
248
+ style={{position: "absolute", bottom: 50}}
249
249
  />
250
250
  );
251
251
  }
package/index.d.ts CHANGED
@@ -80,7 +80,7 @@ declare module 'react-native-maps' {
80
80
  easing?: (value: number) => number;
81
81
  duration?: number;
82
82
  delay?: number;
83
- useNativeDriver?: boolean;
83
+ useNativeDriver: boolean;
84
84
  }
85
85
 
86
86
  interface AnimatedRegionSpringConfig
@@ -97,14 +97,14 @@ declare module 'react-native-maps' {
97
97
  stiffness?: number;
98
98
  mass?: number;
99
99
  damping?: number;
100
- useNativeDriver?: boolean;
100
+ useNativeDriver: boolean;
101
101
  }
102
102
 
103
- export class AnimatedRegion extends Animated.AnimatedWithChildren {
104
- latitude: Animated.Value;
105
- longitude: Animated.Value;
106
- latitudeDelta: Animated.Value;
107
- longitudeDelta: Animated.Value;
103
+ export class AnimatedRegion extends RNAnimated.AnimatedWithChildren {
104
+ latitude: RNAnimated.Value;
105
+ longitude: RNAnimated.Value;
106
+ latitudeDelta: RNAnimated.Value;
107
+ longitudeDelta: RNAnimated.Value;
108
108
 
109
109
  constructor(region?: Region);
110
110
 
@@ -302,6 +302,7 @@ declare module 'react-native-maps' {
302
302
  }
303
303
 
304
304
  export default class MapView extends React.Component<MapViewProps, any> {
305
+ private __lastRegion?: Region;
305
306
  getCamera(): Promise<Camera>;
306
307
  setCamera(camera: Partial<Camera>): void;
307
308
  animateCamera(camera: Partial<Camera>, opts?: { duration?: number }): void;
@@ -628,6 +629,8 @@ declare module 'react-native-maps' {
628
629
  MUTEDSTANDARD: MapTypes;
629
630
  };
630
631
 
632
+ export const enableLatestRenderer: () => Promise<'LATEST' | 'LEGACY'> | void;
633
+
631
634
  export const PROVIDER_DEFAULT: null;
632
635
  export const PROVIDER_GOOGLE: 'google';
633
636
  }
package/index.js CHANGED
@@ -2,6 +2,7 @@ import MapView, {
2
2
  Animated,
3
3
  MAP_TYPES,
4
4
  ProviderPropType,
5
+ enableLatestRenderer,
5
6
  } from './lib/components/MapView';
6
7
  import Marker from './lib/components/MapMarker.js';
7
8
  import Overlay from './lib/components/MapOverlay.js';
@@ -19,7 +20,7 @@ export { default as AnimatedRegion } from './lib/components/AnimatedRegion.js';
19
20
  export { default as Geojson } from './lib/components/Geojson.js';
20
21
 
21
22
  export { Marker, Overlay };
22
- export { Animated, MAP_TYPES, ProviderPropType };
23
+ export { Animated, MAP_TYPES, ProviderPropType, enableLatestRenderer };
23
24
 
24
25
  export const PROVIDER_GOOGLE = MapView.PROVIDER_GOOGLE;
25
26
  export const PROVIDER_DEFAULT = MapView.PROVIDER_DEFAULT;
@@ -17,7 +17,7 @@ android {
17
17
  }
18
18
 
19
19
  dependencies {
20
- def work_version = "2.5.0"
20
+ def work_version = safeExtGet('targetSdkVersion', 27) < 31 ? "2.5.0" : "2.7.1"
21
21
  def supportLibVersion = safeExtGet('supportLibVersion', '28.0.0')
22
22
  def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
23
23
  def appCompatLibName = (supportLibMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
@@ -25,9 +25,9 @@ dependencies {
25
25
  implementation('com.facebook.react:react-native:+') {
26
26
  exclude group: 'com.android.support'
27
27
  }
28
- implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion', '17.0.0')}"
29
- implementation "com.google.android.gms:play-services-maps:${safeExtGet('playServicesVersion', '17.0.0')}"
30
- implementation "com.google.android.gms:play-services-location:17.0.0"
28
+ implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion', '18.0.1')}"
29
+ implementation "com.google.android.gms:play-services-maps:${safeExtGet('playServicesVersion', '18.0.2')}"
30
+ implementation "com.google.android.gms:play-services-location:19.0.1"
31
31
  implementation 'com.google.maps.android:android-maps-utils:0.5'
32
32
  implementation "androidx.work:work-runtime:$work_version"
33
33
  }
@@ -8,6 +8,7 @@ import android.location.Geocoder;
8
8
  import android.net.Uri;
9
9
  import android.util.Base64;
10
10
  import android.util.DisplayMetrics;
11
+ import android.util.Log;
11
12
 
12
13
  import com.facebook.react.bridge.Promise;
13
14
  import com.facebook.react.bridge.ReactApplicationContext;
@@ -21,6 +22,7 @@ import com.facebook.react.uimanager.NativeViewHierarchyManager;
21
22
  import com.facebook.react.uimanager.UIBlock;
22
23
  import com.facebook.react.uimanager.UIManagerModule;
23
24
  import com.google.android.gms.maps.GoogleMap;
25
+ import com.google.android.gms.maps.MapsInitializer;
24
26
  import com.google.android.gms.maps.model.CameraPosition;
25
27
  import com.google.android.gms.maps.model.LatLng;
26
28
 
@@ -352,4 +354,22 @@ public class AirMapModule extends ReactContextBaseJavaModule {
352
354
  }
353
355
  });
354
356
  }
357
+
358
+ @ReactMethod
359
+ public void enableLatestRenderer(final Promise promise) {
360
+ final ReactApplicationContext context = getReactApplicationContext();
361
+
362
+ UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class);
363
+ uiManager.addUIBlock(new UIBlock()
364
+ {
365
+ @Override
366
+ public void execute(NativeViewHierarchyManager nvhm)
367
+ {
368
+ MapsInitializer.initialize(context, MapsInitializer.Renderer.LATEST, (MapsInitializer.Renderer renderer) -> {
369
+ Log.d("AirMapRenderer", renderer.toString());
370
+ promise.resolve(renderer.toString());
371
+ });
372
+ }
373
+ });
374
+ }
355
375
  }
@@ -91,6 +91,7 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
91
91
  private boolean handlePanDrag = false;
92
92
  private boolean moveOnMarkerPress = true;
93
93
  private boolean cacheEnabled = false;
94
+ private ReadableMap initialRegion;
94
95
  private boolean initialRegionSet = false;
95
96
  private boolean initialCameraSet = false;
96
97
  private LatLngBounds cameraLastIdleBounds;
@@ -218,6 +219,10 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
218
219
  this.map.setOnMarkerDragListener(this);
219
220
  this.map.setOnPoiClickListener(this);
220
221
  this.map.setOnIndoorStateChangeListener(this);
222
+ if(initialRegion != null) {
223
+ setRegion(initialRegion);
224
+ initialRegionSet = true;
225
+ }
221
226
 
222
227
  manager.pushEvent(context, this, "onMapReady", new WritableNativeMap());
223
228
 
@@ -395,7 +400,7 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
395
400
  lifecycleListener = new LifecycleEventListener() {
396
401
  @Override
397
402
  public void onHostResume() {
398
- if (hasPermissions()) {
403
+ if (hasPermissions() && map != null) {
399
404
  //noinspection MissingPermission
400
405
  map.setMyLocationEnabled(showUserLocation);
401
406
  map.setLocationSource(fusedLocationSource);
@@ -410,7 +415,7 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
410
415
 
411
416
  @Override
412
417
  public void onHostPause() {
413
- if (hasPermissions()) {
418
+ if (hasPermissions() && map != null) {
414
419
  //noinspection MissingPermission
415
420
  map.setMyLocationEnabled(false);
416
421
  }
@@ -458,7 +463,10 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
458
463
  }
459
464
 
460
465
  public void setInitialRegion(ReadableMap initialRegion) {
461
- if (!initialRegionSet && initialRegion != null) {
466
+ this.initialRegion = initialRegion;
467
+ // Theoretically onMapReady might be called before setInitialRegion
468
+ // In that case, trigger setRegion manually
469
+ if (!initialRegionSet && map != null) {
462
470
  setRegion(initialRegion);
463
471
  initialRegionSet = true;
464
472
  }
@@ -1011,7 +1019,9 @@ public class AirMapView extends MapView implements GoogleMap.InfoWindowAdapter,
1011
1019
 
1012
1020
  int X = (int)ev.getX();
1013
1021
  int Y = (int)ev.getY();
1014
- tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
1022
+ if(map != null) {
1023
+ tapLocation = map.getProjection().fromScreenLocation(new Point(X,Y));
1024
+ }
1015
1025
 
1016
1026
  int action = MotionEventCompat.getActionMasked(ev);
1017
1027
 
@@ -27,9 +27,12 @@ const defaultValues = {
27
27
  let _uniqueId = 1;
28
28
 
29
29
  const getAnimatedValue = (valueIn, fallback) => {
30
- return valueIn instanceof Animated.Value
31
- ? valueIn
32
- : new Animated.Value(fallback);
30
+ if (valueIn instanceof Animated.Value) {
31
+ return valueIn;
32
+ } else if (typeof valueIn === 'number') {
33
+ return new Animated.Value(valueIn);
34
+ }
35
+ return new Animated.Value(fallback);
33
36
  };
34
37
 
35
38
  export default class AnimatedMapRegion extends AnimatedWithChildren {
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import Marker from './MapMarker';
4
4
  import Polyline from './MapPolyline';
5
5
  import Polygon from './MapPolygon';
6
- import { ColorPropType } from 'react-native';
6
+ import { ColorPropType } from 'deprecated-react-native-prop-types';
7
7
 
8
8
  const propTypes = {
9
9
  /**
@@ -43,7 +43,7 @@ const propTypes = {
43
43
  * Make the `Polygon` or `Polyline` tappable
44
44
  *
45
45
  */
46
- tappable: PropTypes.boolean,
46
+ tappable: PropTypes.bool,
47
47
 
48
48
  /**
49
49
  * An array of numbers specifying the dash pattern to use for the path.
@@ -1,16 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { StyleSheet, ViewPropTypes, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native';
4
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
  import decorateMapComponent, {
5
6
  SUPPORTED,
6
7
  USES_DEFAULT_IMPLEMENTATION,
7
8
  } from './decorateMapComponent';
8
9
 
9
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10
- const viewPropTypes = ViewPropTypes || View.propTypes;
11
-
12
10
  const propTypes = {
13
- ...viewPropTypes,
11
+ ...ViewPropTypes,
14
12
  tooltip: PropTypes.bool,
15
13
  onPress: PropTypes.func,
16
14
  alphaHitTest: PropTypes.bool,
@@ -1,16 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { StyleSheet, ViewPropTypes, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native';
4
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
  import decorateMapComponent, {
5
6
  SUPPORTED,
6
7
  NOT_SUPPORTED,
7
8
  } from './decorateMapComponent';
8
9
 
9
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10
- const viewPropTypes = ViewPropTypes || View.propTypes;
11
-
12
10
  const propTypes = {
13
- ...viewPropTypes,
11
+ ...ViewPropTypes,
14
12
  onPress: PropTypes.func,
15
13
  };
16
14
 
@@ -1,16 +1,16 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { ColorPropType, ViewPropTypes, View } from 'react-native';
3
+ import {
4
+ ColorPropType,
5
+ ViewPropTypes,
6
+ } from 'deprecated-react-native-prop-types';
4
7
  import decorateMapComponent, {
5
8
  USES_DEFAULT_IMPLEMENTATION,
6
9
  SUPPORTED,
7
10
  } from './decorateMapComponent';
8
11
 
9
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10
- const viewPropTypes = ViewPropTypes || View.propTypes;
11
-
12
12
  const propTypes = {
13
- ...viewPropTypes,
13
+ ...ViewPropTypes,
14
14
 
15
15
  /**
16
16
  * The coordinate of the center of the circle
@@ -1,16 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { ViewPropTypes, View, processColor } from 'react-native';
3
+ import { processColor } from 'react-native';
4
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
  import decorateMapComponent, {
5
6
  SUPPORTED,
6
7
  USES_DEFAULT_IMPLEMENTATION,
7
8
  } from './decorateMapComponent';
8
9
 
9
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10
- const viewPropTypes = ViewPropTypes || View.propTypes;
11
-
12
10
  const propTypes = {
13
- ...viewPropTypes,
11
+ ...ViewPropTypes,
14
12
 
15
13
  /**
16
14
  * Array of heatmap entries to apply towards density.
@@ -1,18 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
-
4
- import { ViewPropTypes, View } from 'react-native';
3
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
5
4
 
6
5
  import decorateMapComponent, {
7
6
  USES_DEFAULT_IMPLEMENTATION,
8
7
  SUPPORTED,
9
8
  } from './decorateMapComponent';
10
9
 
11
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
12
- const viewPropTypes = ViewPropTypes || View.propTypes;
13
-
14
10
  const propTypes = {
15
- ...viewPropTypes,
11
+ ...ViewPropTypes,
16
12
 
17
13
  /**
18
14
  * The path template of the local tile source.
@@ -1,16 +1,17 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import {
4
- ColorPropType,
5
4
  StyleSheet,
6
5
  Platform,
7
6
  NativeModules,
8
7
  Animated,
9
8
  Image,
10
9
  findNodeHandle,
11
- ViewPropTypes,
12
- View,
13
10
  } from 'react-native';
11
+ import {
12
+ ColorPropType,
13
+ ViewPropTypes,
14
+ } from 'deprecated-react-native-prop-types';
14
15
 
15
16
  import decorateMapComponent, {
16
17
  SUPPORTED,
@@ -24,11 +25,8 @@ const viewConfig = {
24
25
  },
25
26
  };
26
27
 
27
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
28
- const viewPropTypes = ViewPropTypes || View.propTypes;
29
-
30
28
  const propTypes = {
31
- ...viewPropTypes,
29
+ ...ViewPropTypes,
32
30
 
33
31
  // TODO(lmr): get rid of these?
34
32
  identifier: PropTypes.string,
@@ -1,6 +1,7 @@
1
1
  import React, { Component } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { View, StyleSheet, Image, Animated } from 'react-native';
3
+ import { StyleSheet, Image, Animated } from 'react-native';
4
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
5
 
5
6
  import decorateMapComponent, {
6
7
  SUPPORTED,
@@ -15,7 +16,7 @@ const viewConfig = {
15
16
  };
16
17
 
17
18
  const propTypes = {
18
- ...View.propTypes,
19
+ ...ViewPropTypes,
19
20
  // A custom image to be used as overlay.
20
21
  image: PropTypes.any.isRequired,
21
22
  // Top left and bottom right coordinates for the overlay
@@ -1,17 +1,17 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { ColorPropType, ViewPropTypes, View } from 'react-native';
3
+ import {
4
+ ColorPropType,
5
+ ViewPropTypes,
6
+ } from 'deprecated-react-native-prop-types';
4
7
  import decorateMapComponent, {
5
8
  USES_DEFAULT_IMPLEMENTATION,
6
9
  SUPPORTED,
7
10
  } from './decorateMapComponent';
8
11
  import * as ProviderConstants from './ProviderConstants';
9
12
 
10
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
11
- const viewPropTypes = ViewPropTypes || View.propTypes;
12
-
13
13
  const propTypes = {
14
- ...viewPropTypes,
14
+ ...ViewPropTypes,
15
15
 
16
16
  /**
17
17
  * An array of coordinates to describe the polygon
@@ -1,16 +1,16 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { ColorPropType, ViewPropTypes, View } from 'react-native';
3
+ import {
4
+ ColorPropType,
5
+ ViewPropTypes,
6
+ } from 'deprecated-react-native-prop-types';
4
7
  import decorateMapComponent, {
5
8
  USES_DEFAULT_IMPLEMENTATION,
6
9
  SUPPORTED,
7
10
  } from './decorateMapComponent';
8
11
 
9
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10
- const viewPropTypes = ViewPropTypes || View.propTypes;
11
-
12
12
  const propTypes = {
13
- ...viewPropTypes,
13
+ ...ViewPropTypes,
14
14
 
15
15
  /**
16
16
  * An array of coordinates to describe the polygon
@@ -98,7 +98,6 @@ const propTypes = {
98
98
  * points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
99
99
  * a sphere.
100
100
  *
101
- * @platform android
102
101
  */
103
102
  geodesic: PropTypes.bool,
104
103
 
@@ -1,18 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
-
4
- import { ViewPropTypes, View } from 'react-native';
3
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
5
4
 
6
5
  import decorateMapComponent, {
7
6
  USES_DEFAULT_IMPLEMENTATION,
8
7
  SUPPORTED,
9
8
  } from './decorateMapComponent';
10
9
 
11
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
12
- const viewPropTypes = ViewPropTypes || View.propTypes;
13
-
14
10
  const propTypes = {
15
- ...viewPropTypes,
11
+ ...ViewPropTypes,
16
12
 
17
13
  /**
18
14
  * The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
@@ -1,17 +1,18 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import {
4
- EdgeInsetsPropType,
5
- PointPropType,
6
4
  Platform,
7
5
  Animated as RNAnimated,
8
6
  requireNativeComponent,
9
7
  NativeModules,
10
- ColorPropType,
11
8
  findNodeHandle,
12
- ViewPropTypes,
13
- View,
14
9
  } from 'react-native';
10
+ import {
11
+ EdgeInsetsPropType,
12
+ PointPropType,
13
+ ColorPropType,
14
+ ViewPropTypes,
15
+ } from 'deprecated-react-native-prop-types';
15
16
  import MapMarker from './MapMarker';
16
17
  import MapPolyline from './MapPolyline';
17
18
  import MapPolygon from './MapPolygon';
@@ -65,11 +66,8 @@ const CameraShape = PropTypes.shape({
65
66
  zoom: PropTypes.number.isRequired,
66
67
  });
67
68
 
68
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
69
- const viewPropTypes = ViewPropTypes || View.propTypes;
70
-
71
69
  const propTypes = {
72
- ...viewPropTypes,
70
+ ...ViewPropTypes,
73
71
  /**
74
72
  * When provider is "google", we will use GoogleMaps.
75
73
  * Any value other than "google" will default to using
@@ -81,7 +79,7 @@ const propTypes = {
81
79
  * Used to style and layout the `MapView`. See `StyleSheet.js` and
82
80
  * `ViewStylePropTypes.js` for more info.
83
81
  */
84
- style: viewPropTypes.style,
82
+ style: ViewPropTypes.style,
85
83
 
86
84
  /**
87
85
  * A json object that describes the style of the map. This is transformed to a string
@@ -1026,12 +1024,14 @@ class MapView extends React.Component {
1026
1024
  ) {
1027
1025
  props.mapType = MAP_TYPES.standard;
1028
1026
  }
1029
- props.handlePanDrag = !!props.onPanDrag;
1027
+ if (props.onPanDrag) {
1028
+ props.handlePanDrag = !!props.onPanDrag;
1029
+ }
1030
1030
  } else {
1031
1031
  props = {
1032
1032
  style: this.props.style,
1033
1033
  region: null,
1034
- initialRegion: null,
1034
+ initialRegion: this.props.initialRegion || null,
1035
1035
  onMarkerPress: this._onMarkerPress,
1036
1036
  onChange: this._onChange,
1037
1037
  onMapReady: this._onMapReady,
@@ -1119,6 +1119,13 @@ if (!NativeModules.UIManager.getViewManagerConfig) {
1119
1119
 
1120
1120
  export const Animated = RNAnimated.createAnimatedComponent(MapView);
1121
1121
 
1122
+ export const enableLatestRenderer = () => {
1123
+ if (Platform.OS !== 'android') {
1124
+ return;
1125
+ }
1126
+ return NativeModules.AirMapModule.enableLatestRenderer();
1127
+ };
1128
+
1122
1129
  export const ProviderPropType = PropTypes.oneOf(
1123
1130
  Object.values(ProviderConstants)
1124
1131
  );
@@ -1,18 +1,14 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
-
4
- import { ViewPropTypes, View } from 'react-native';
3
+ import { ViewPropTypes } from 'deprecated-react-native-prop-types';
5
4
 
6
5
  import decorateMapComponent, {
7
6
  USES_DEFAULT_IMPLEMENTATION,
8
7
  SUPPORTED,
9
8
  } from './decorateMapComponent';
10
9
 
11
- // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
12
- const viewPropTypes = ViewPropTypes || View.propTypes;
13
-
14
10
  const propTypes = {
15
- ...viewPropTypes,
11
+ ...ViewPropTypes,
16
12
 
17
13
  /**
18
14
  * The url template of the tile server. The patterns {minX} {maxX} {minY} {maxY} {width} {height}
@@ -778,8 +778,13 @@ RCT_EXPORT_METHOD(getAddressFromCoordinates:(nonnull NSNumber *)reactTag
778
778
  }
779
779
 
780
780
  if (nearestDistance <= maxMeters) {
781
+ AIRMapCoordinate *firstCoord = nearestPolyline.coordinates.firstObject;
781
782
  id event = @{
782
783
  @"action": @"polyline-press",
784
+ @"coordinate": @{
785
+ @"latitude": @(firstCoord.coordinate.latitude),
786
+ @"longitude": @(firstCoord.coordinate.longitude)
787
+ }
783
788
  };
784
789
  nearestPolyline.onPress(event);
785
790
  }
@@ -1045,7 +1050,11 @@ static int kDragCenterContext;
1045
1050
 
1046
1051
  - (void)mapView:(AIRMap *)mapView regionWillChangeAnimated:(__unused BOOL)animated
1047
1052
  {
1048
- [self _regionChanged:mapView];
1053
+ // Don't send region did change events until map has
1054
+ // started rendering, as these won't represent the final location
1055
+ if(mapView.hasStartedRendering){
1056
+ [self _regionChanged:mapView];
1057
+ }
1049
1058
 
1050
1059
  AIRWeakTimerReference *weakTarget = [[AIRWeakTimerReference alloc] initWithTarget:self andSelector:@selector(_onTick:)];
1051
1060
 
@@ -1064,7 +1073,11 @@ static int kDragCenterContext;
1064
1073
  [mapView.regionChangeObserveTimer invalidate];
1065
1074
  mapView.regionChangeObserveTimer = nil;
1066
1075
 
1067
- [self _regionChanged:mapView];
1076
+ // Don't send region did change events until map has
1077
+ // started rendering, as these won't represent the final location
1078
+ if(mapView.hasStartedRendering){
1079
+ [self _regionChanged:mapView];
1080
+ }
1068
1081
 
1069
1082
  if (zoomLevel < mapView.minZoomLevel) {
1070
1083
  [self setCenterCoordinate:[mapView centerCoordinate] zoomLevel:mapView.minZoomLevel animated:TRUE mapView:mapView];
@@ -32,6 +32,7 @@
32
32
  @property (nonatomic, assign) CGLineJoin lineJoin;
33
33
  @property (nonatomic, assign) CGFloat lineDashPhase;
34
34
  @property (nonatomic, strong) NSArray <NSNumber *> *lineDashPattern;
35
+ @property (nonatomic, assign) BOOL geodesic;
35
36
  @property (nonatomic, copy) RCTBubblingEventBlock onPress;
36
37
 
37
38
  #pragma mark MKOverlay protocol
@@ -60,6 +60,14 @@
60
60
  [self update];
61
61
  }
62
62
 
63
+ -(void)setGeodesic:(BOOL)geodesic
64
+ {
65
+ _geodesic = geodesic;
66
+ if(_coordinates){
67
+ [self setCoordinates:_coordinates];
68
+ }
69
+ }
70
+
63
71
  - (void)setCoordinates:(NSArray<AIRMapCoordinate *> *)coordinates {
64
72
  _coordinates = coordinates;
65
73
  CLLocationCoordinate2D coords[coordinates.count];
@@ -67,7 +75,12 @@
67
75
  {
68
76
  coords[i] = coordinates[i].coordinate;
69
77
  }
70
- self.polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count];
78
+ if(_geodesic){
79
+ self.polyline = [MKGeodesicPolyline polylineWithCoordinates:coords count:coordinates.count];
80
+ } else {
81
+ self.polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count];
82
+ }
83
+
71
84
  self.renderer = [self createRenderer];
72
85
  [self update];
73
86
  }
@@ -42,6 +42,7 @@ RCT_EXPORT_VIEW_PROPERTY(lineJoin, CGLineJoin)
42
42
  RCT_EXPORT_VIEW_PROPERTY(miterLimit, CGFloat)
43
43
  RCT_EXPORT_VIEW_PROPERTY(lineDashPhase, CGFloat)
44
44
  RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray)
45
+ RCT_EXPORT_VIEW_PROPERTY(geodesic, BOOL)
45
46
  RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
46
47
 
47
48
  @end