react-native-maps 0.31.1 → 1.0.0-beta.1

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 (68) hide show
  1. package/README.md +1 -5
  2. package/android/src/main/AndroidManifest.xml +0 -3
  3. package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTile.java +11 -4
  4. package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTileManager.java +5 -1
  5. package/android/src/main/java/com/airbnb/android/react/maps/AirMapManager.java +2 -41
  6. package/android/src/main/java/com/airbnb/android/react/maps/AirMapTileProvider.java +5 -5
  7. package/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +0 -32
  8. package/ios/AirGoogleMaps/AIRGoogleMap.m +37 -31
  9. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -95
  10. package/ios/AirMaps/AIRMap.m +0 -7
  11. package/ios/AirMaps/AIRMapManager.m +0 -105
  12. package/lib/AnimatedRegion.d.ts +19 -0
  13. package/lib/AnimatedRegion.js +134 -0
  14. package/lib/Geojson.d.ts +166 -0
  15. package/lib/Geojson.js +165 -0
  16. package/lib/MapCallout.d.ts +40 -0
  17. package/lib/MapCallout.js +51 -0
  18. package/lib/MapCalloutSubview.d.ts +34 -0
  19. package/lib/MapCalloutSubview.js +48 -0
  20. package/lib/MapCircle.d.ts +117 -0
  21. package/lib/MapCircle.js +53 -0
  22. package/lib/MapHeatmap.d.ts +77 -0
  23. package/lib/MapHeatmap.js +59 -0
  24. package/lib/MapLocalTile.d.ts +35 -0
  25. package/lib/MapLocalTile.js +44 -0
  26. package/lib/MapMarker.d.ts +289 -0
  27. package/lib/MapMarker.js +113 -0
  28. package/lib/MapOverlay.d.ts +86 -0
  29. package/lib/MapOverlay.js +63 -0
  30. package/lib/MapPolygon.d.ts +156 -0
  31. package/lib/MapPolygon.js +74 -0
  32. package/lib/MapPolyline.d.ts +156 -0
  33. package/lib/MapPolyline.js +53 -0
  34. package/lib/MapUrlTile.d.ts +134 -0
  35. package/lib/MapUrlTile.js +44 -0
  36. package/lib/MapView.d.ts +825 -0
  37. package/lib/MapView.js +418 -0
  38. package/{src/MapView.web.js → lib/MapView.web.d.ts} +0 -0
  39. package/lib/MapView.web.js +9 -0
  40. package/lib/MapWMSTile.d.ts +116 -0
  41. package/lib/MapWMSTile.js +44 -0
  42. package/lib/ProviderConstants.d.ts +2 -0
  43. package/lib/ProviderConstants.js +5 -0
  44. package/lib/decorateMapComponent.d.ts +35 -0
  45. package/lib/decorateMapComponent.js +80 -0
  46. package/{src/index.js → lib/index.d.ts} +5 -16
  47. package/lib/index.js +66 -0
  48. package/lib/sharedTypes.d.ts +82 -0
  49. package/lib/sharedTypes.js +2 -0
  50. package/package.json +18 -27
  51. package/react-native-google-maps.podspec +1 -1
  52. package/index.d.ts +0 -637
  53. package/src/AnimatedRegion.js +0 -164
  54. package/src/Geojson.js +0 -334
  55. package/src/MapCallout.js +0 -51
  56. package/src/MapCalloutSubview.js +0 -44
  57. package/src/MapCircle.js +0 -150
  58. package/src/MapHeatmap.js +0 -99
  59. package/src/MapLocalTile.js +0 -52
  60. package/src/MapMarker.js +0 -377
  61. package/src/MapOverlay.js +0 -86
  62. package/src/MapPolygon.js +0 -202
  63. package/src/MapPolyline.js +0 -168
  64. package/src/MapUrlTile.js +0 -131
  65. package/src/MapView.js +0 -1160
  66. package/src/MapWMSTile.js +0 -122
  67. package/src/ProviderConstants.js +0 -2
  68. package/src/decorateMapComponent.js +0 -112
package/src/MapWMSTile.js DELETED
@@ -1,122 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { ViewPropTypes } from 'deprecated-react-native-prop-types';
4
-
5
- import decorateMapComponent, {
6
- USES_DEFAULT_IMPLEMENTATION,
7
- SUPPORTED,
8
- } from './decorateMapComponent';
9
-
10
- const propTypes = {
11
- ...ViewPropTypes,
12
-
13
- /**
14
- * The url template of the tile server. The patterns {minX} {maxX} {minY} {maxY} {width} {height}
15
- * will be replaced at runtime according to EPSG:900913 specification bounding box.
16
- * For example, https://demo.geo-solutions.it/geoserver/tiger/wms?service=WMS&version=1.1.0&request=GetMap&layers=tiger:poi&styles=&bbox={minX},{minY},{maxX},{maxY}&width={width}&height={height}&srs=EPSG:900913&format=image/png&transparent=true&format_options=dpi:213
17
- */
18
- urlTemplate: PropTypes.string.isRequired,
19
-
20
- /**
21
- * The order in which this tile overlay is drawn with respect to other overlays. An overlay
22
- * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
23
- * with the same z-index is arbitrary. The default zIndex is -1.
24
- *
25
- * @platform android
26
- */
27
- zIndex: PropTypes.number,
28
-
29
- /**
30
- * The maximum zoom level for this tile overlay.
31
- *
32
- */
33
- maximumZ: PropTypes.number,
34
-
35
- /**
36
- * (Optional) The maximum native zoom level for this tile overlay. Tiles are auto-scaled for higher
37
- * zoom levels.
38
- *
39
- */
40
- maximumNativeZ: PropTypes.number,
41
-
42
- /**
43
- * The minimum zoom level for this tile overlay.
44
- *
45
- */
46
- minimumZ: PropTypes.number,
47
-
48
- /**
49
- * Corresponds to MKTileOverlay canReplaceMapContent.
50
- *
51
- * @platform ios
52
- */
53
- shouldReplaceMapContent: PropTypes.bool,
54
-
55
- /**
56
- * (Optional) Tile size only, default size is 256 (for tiles of 256 * 256 pixels)
57
- *
58
- */
59
- tileSize: PropTypes.number,
60
-
61
- /**
62
- *
63
- * Allow tiles using the TMS coordinate system (origin bottom left)
64
- * to be used, and displayed at their correct coordinates
65
- *
66
- */
67
- flipY: PropTypes.bool,
68
-
69
- /**
70
- *
71
- * (Optional) Enable caching of tiles in the specified directory. Directory
72
- * can be specified either as a normal path or in URL format (file://). Tiles
73
- * are stored in tileCachePath directory as follows "/{z}/{x}/{y}" i.e. in
74
- * sub-directories 2-levels deep, filename tile y-coordinate without any
75
- * filetype-extension.
76
- * NB! All cache management needs to be implemented by client e.g. deleting tiles
77
- * to manage use of storage space etc.
78
- *
79
- */
80
- tileCachePath: PropTypes.string,
81
-
82
- /**
83
- * (Optional) Defines how maximum age in seconds for cached tile before they
84
- * are refreshed. NB! Refresh logic is "serve-stale-while-refresh" i.e. to
85
- * ensure map availability a stale (over max age) tile is served while a tile
86
- * refresh process is started in the background.
87
- */
88
- tileCacheMaxAge: PropTypes.number,
89
-
90
- /**
91
- * (Optional) Sets offline-mode. In offline-mode tiles are not fetched from
92
- * the tile servers, rather only tiles stored in the cache directory are used.
93
- * Furthermore automated tile scaling is activated: if tile at a desired zoom
94
- * level is not found from the cache directory, then lower zoom level tile is
95
- * used (until minimumZ) and scaled.
96
- */
97
- offlineMode: PropTypes.bool,
98
-
99
- /**
100
- * (Optional) Map layer opacity. Value between 0 - 1, with 0 meaning fully
101
- * transparent.
102
- */
103
- opacity: PropTypes.number,
104
- };
105
-
106
- class MapWMSTile extends React.Component {
107
- render() {
108
- const AIRMapWMSTile = this.getAirComponent();
109
- return <AIRMapWMSTile {...this.props} />;
110
- }
111
- }
112
-
113
- MapWMSTile.propTypes = propTypes;
114
- export default decorateMapComponent(MapWMSTile, {
115
- componentType: 'WMSTile',
116
- providers: {
117
- google: {
118
- ios: SUPPORTED,
119
- android: USES_DEFAULT_IMPLEMENTATION,
120
- },
121
- },
122
- });
@@ -1,2 +0,0 @@
1
- export const PROVIDER_DEFAULT = null;
2
- export const PROVIDER_GOOGLE = 'google';
@@ -1,112 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { requireNativeComponent, NativeModules, Platform } from 'react-native';
3
- import { PROVIDER_DEFAULT, PROVIDER_GOOGLE } from './ProviderConstants';
4
-
5
- export const SUPPORTED = 'SUPPORTED';
6
- export const USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
7
- export const NOT_SUPPORTED = 'NOT_SUPPORTED';
8
-
9
- export function getAirMapName(provider) {
10
- if (Platform.OS === 'android') {
11
- return 'AIRMap';
12
- }
13
- if (provider === PROVIDER_GOOGLE) {
14
- return 'AIRGoogleMap';
15
- }
16
- return 'AIRMap';
17
- }
18
-
19
- function getAirComponentName(provider, component) {
20
- return `${getAirMapName(provider)}${component}`;
21
- }
22
-
23
- export const contextTypes = {
24
- provider: PropTypes.string,
25
- };
26
-
27
- export const createNotSupportedComponent = (message) => () => {
28
- console.error(message);
29
- return null;
30
- };
31
-
32
- function getViewManagerConfig(viewManagerName) {
33
- const UIManager = NativeModules.UIManager;
34
- if (!UIManager.getViewManagerConfig) {
35
- // RN < 0.58
36
- return UIManager[viewManagerName];
37
- }
38
- // RN >= 0.58
39
- return UIManager.getViewManagerConfig(viewManagerName);
40
- }
41
-
42
- export const googleMapIsInstalled = !!getViewManagerConfig(
43
- getAirMapName(PROVIDER_GOOGLE)
44
- );
45
-
46
- export default function decorateMapComponent(
47
- Component,
48
- { componentType, providers }
49
- ) {
50
- const components = {};
51
-
52
- const getDefaultComponent = () =>
53
- requireNativeComponent(getAirComponentName(null, componentType), Component);
54
-
55
- Component.contextTypes = contextTypes;
56
-
57
- Component.prototype.getAirComponent = function getAirComponent() {
58
- const provider = this.context.provider || PROVIDER_DEFAULT;
59
- if (components[provider]) {
60
- return components[provider];
61
- }
62
-
63
- if (provider === PROVIDER_DEFAULT) {
64
- components[PROVIDER_DEFAULT] = getDefaultComponent();
65
- return components[PROVIDER_DEFAULT];
66
- }
67
-
68
- const providerInfo = providers[provider];
69
- const platformSupport = providerInfo[Platform.OS];
70
- const componentName = getAirComponentName(provider, componentType);
71
- if (platformSupport === NOT_SUPPORTED) {
72
- components[provider] = createNotSupportedComponent(
73
- `react-native-maps: ${componentName} is not supported on ${Platform.OS}`
74
- );
75
- } else if (platformSupport === SUPPORTED) {
76
- if (
77
- provider !== PROVIDER_GOOGLE ||
78
- (Platform.OS === 'ios' && googleMapIsInstalled)
79
- ) {
80
- components[provider] = requireNativeComponent(componentName, Component);
81
- }
82
- } else {
83
- // (platformSupport === USES_DEFAULT_IMPLEMENTATION)
84
- if (!components[PROVIDER_DEFAULT]) {
85
- components[PROVIDER_DEFAULT] = getDefaultComponent();
86
- }
87
- components[provider] = components[PROVIDER_DEFAULT];
88
- }
89
-
90
- return components[provider];
91
- };
92
-
93
- Component.prototype.getUIManagerCommand = function getUIManagerCommand(name) {
94
- const componentName = getAirComponentName(
95
- this.context.provider,
96
- componentType
97
- );
98
- return getViewManagerConfig(componentName).Commands[name];
99
- };
100
-
101
- Component.prototype.getMapManagerCommand = function getMapManagerCommand(
102
- name
103
- ) {
104
- const airComponentName = `${getAirComponentName(
105
- this.context.provider,
106
- componentType
107
- )}Manager`;
108
- return NativeModules[airComponentName][name];
109
- };
110
-
111
- return Component;
112
- }