react-native-maps 0.29.4 → 0.30.0

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 (43) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +8 -1
  3. package/docs/geojson.md +5 -3
  4. package/docs/installation.md +1 -1
  5. package/docs/marker.md +1 -0
  6. package/docs/tiles.md +35 -0
  7. package/index.d.ts +25 -10
  8. package/index.js +1 -3
  9. package/lib/android/build.gradle +3 -1
  10. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapTileProvider.java +515 -0
  11. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapTileWorker.java +122 -0
  12. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapUrlTile.java +124 -55
  13. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapUrlTileManager.java +34 -0
  14. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +6 -1
  15. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapWMSTile.java +31 -87
  16. package/lib/android/src/main/java/com/airbnb/android/react/maps/AirMapWMSTileManager.java +22 -2
  17. package/lib/components/AnimatedRegion.js +64 -101
  18. package/lib/components/Geojson.js +66 -39
  19. package/lib/components/MapCircle.js +1 -1
  20. package/lib/components/MapHeatmap.js +2 -2
  21. package/lib/components/MapMarker.js +4 -2
  22. package/lib/components/MapPolygon.js +1 -1
  23. package/lib/components/MapPolyline.js +1 -1
  24. package/lib/components/MapUrlTile.js +54 -2
  25. package/lib/components/MapView.js +4 -4
  26. package/lib/components/MapWMSTile.js +49 -2
  27. package/lib/components/decorateMapComponent.js +1 -1
  28. package/lib/ios/AirGoogleMaps/AIRGoogleMapMarker.h +1 -0
  29. package/lib/ios/AirGoogleMaps/AIRGoogleMapMarker.m +8 -0
  30. package/lib/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -0
  31. package/lib/ios/AirMaps/AIRMapManager.m +6 -1
  32. package/lib/ios/AirMaps/AIRMapMarkerManager.m +1 -0
  33. package/lib/ios/AirMaps/AIRMapUrlTile.h +22 -4
  34. package/lib/ios/AirMaps/AIRMapUrlTile.m +124 -34
  35. package/lib/ios/AirMaps/AIRMapUrlTileCachedOverlay.h +17 -0
  36. package/lib/ios/AirMaps/AIRMapUrlTileCachedOverlay.m +235 -0
  37. package/lib/ios/AirMaps/AIRMapUrlTileManager.m +6 -1
  38. package/lib/ios/AirMaps/AIRMapWMSTile.h +10 -16
  39. package/lib/ios/AirMaps/AIRMapWMSTile.m +68 -101
  40. package/lib/ios/AirMaps/AIRMapWMSTileManager.m +6 -1
  41. package/lib/ios/AirMaps.xcodeproj/project.pbxproj +7 -1
  42. package/package.json +4 -3
  43. package/react-native-google-maps.podspec +2 -2
@@ -8,37 +8,46 @@ if (__DEV__) {
8
8
  );
9
9
  }
10
10
  }
11
- // const __Animated = Object.getPrototypeOf(AnimatedWithChildren);
12
- // if (__Animated.name !== 'Animated') console.error('AnimatedRegion could not obtain Animated base class');
13
11
 
14
- var _uniqueId = 1;
12
+ const configTypes = [
13
+ 'latitude',
14
+ 'longitude',
15
+ 'latitudeDelta',
16
+ 'longitudeDelta',
17
+ ];
18
+
19
+ const defaultValues = {
20
+ // probably want to come up with better defaults
21
+ latitude: 0,
22
+ longitude: 0,
23
+ latitudeDelta: 0,
24
+ longitudeDelta: 0,
25
+ };
26
+
27
+ let _uniqueId = 1;
28
+
29
+ const getAnimatedValue = (valueIn, fallback) => {
30
+ return valueIn instanceof Animated.Value
31
+ ? valueIn
32
+ : new Animated.Value(fallback);
33
+ };
15
34
 
16
35
  export default class AnimatedMapRegion extends AnimatedWithChildren {
17
- constructor(valueIn) {
36
+ constructor(valueIn = {}) {
18
37
  super();
19
- var value = valueIn || {
20
- // probably want to come up with better defaults
21
- latitude: 0,
22
- longitude: 0,
23
- latitudeDelta: 0,
24
- longitudeDelta: 0,
25
- };
26
- this.latitude =
27
- value.latitude instanceof Animated.Value
28
- ? value.latitude
29
- : new Animated.Value(value.latitude);
30
- this.longitude =
31
- value.longitude instanceof Animated.Value
32
- ? value.longitude
33
- : new Animated.Value(value.longitude);
34
- this.latitudeDelta =
35
- value.latitudeDelta instanceof Animated.Value
36
- ? value.latitudeDelta
37
- : new Animated.Value(value.latitudeDelta);
38
- this.longitudeDelta =
39
- value.longitudeDelta instanceof Animated.Value
40
- ? value.longitudeDelta
41
- : new Animated.Value(value.longitudeDelta);
38
+ this.latitude = getAnimatedValue(valueIn.latitude, defaultValues.latitude);
39
+ this.longitude = getAnimatedValue(
40
+ valueIn.longitude,
41
+ defaultValues.longitude
42
+ );
43
+ this.latitudeDelta = getAnimatedValue(
44
+ valueIn.latitudeDelta,
45
+ defaultValues.latitudeDelta
46
+ );
47
+ this.longitudeDelta = getAnimatedValue(
48
+ valueIn.longitudeDelta,
49
+ defaultValues.longitudeDelta
50
+ );
42
51
  this._regionListeners = {};
43
52
  }
44
53
 
@@ -95,10 +104,8 @@ export default class AnimatedMapRegion extends AnimatedWithChildren {
95
104
  }
96
105
 
97
106
  addListener(callback) {
98
- var id = String(_uniqueId++);
99
- var jointCallback = (/*{value}*/) => {
100
- callback(this.__getValue());
101
- };
107
+ const id = String(_uniqueId++);
108
+ const jointCallback = () => /*{value}*/ callback(this.__getValue());
102
109
  this._regionListeners[id] = {
103
110
  latitude: this.latitude.addListener(jointCallback),
104
111
  longitude: this.longitude.addListener(jointCallback),
@@ -119,80 +126,36 @@ export default class AnimatedMapRegion extends AnimatedWithChildren {
119
126
  }
120
127
 
121
128
  spring(config) {
122
- var animations = [];
123
- config.hasOwnProperty('latitude') &&
124
- animations.push(
125
- Animated.spring(this.latitude, {
126
- ...config,
127
- toValue: config.latitude,
128
- })
129
- );
130
-
131
- config.hasOwnProperty('longitude') &&
132
- animations.push(
133
- Animated.spring(this.longitude, {
134
- ...config,
135
- toValue: config.longitude,
136
- })
137
- );
138
-
139
- config.hasOwnProperty('latitudeDelta') &&
140
- animations.push(
141
- Animated.spring(this.latitudeDelta, {
142
- ...config,
143
- toValue: config.latitudeDelta,
144
- })
145
- );
146
-
147
- config.hasOwnProperty('longitudeDelta') &&
148
- animations.push(
149
- Animated.spring(this.longitudeDelta, {
150
- ...config,
151
- toValue: config.longitudeDelta,
152
- })
153
- );
154
-
129
+ const animations = [];
130
+ for (const type of configTypes) {
131
+ if (config.hasOwnProperty(type)) {
132
+ animations.push(
133
+ Animated.spring(this[type], {
134
+ ...config,
135
+ toValue: config[type],
136
+ // may help to eliminate some dev warnings and perf issues
137
+ useNativeDriver: !!config?.useNativeDriver,
138
+ })
139
+ );
140
+ }
141
+ }
155
142
  return Animated.parallel(animations);
156
143
  }
157
144
 
158
145
  timing(config) {
159
- var animations = [];
160
- config.hasOwnProperty('latitude') &&
161
- animations.push(
162
- Animated.timing(this.latitude, {
163
- ...config,
164
- toValue: config.latitude,
165
- useNativeDriver: false,
166
- })
167
- );
168
-
169
- config.hasOwnProperty('longitude') &&
170
- animations.push(
171
- Animated.timing(this.longitude, {
172
- ...config,
173
- toValue: config.longitude,
174
- useNativeDriver: false,
175
- })
176
- );
177
-
178
- config.hasOwnProperty('latitudeDelta') &&
179
- animations.push(
180
- Animated.timing(this.latitudeDelta, {
181
- ...config,
182
- toValue: config.latitudeDelta,
183
- useNativeDriver: false,
184
- })
185
- );
186
-
187
- config.hasOwnProperty('longitudeDelta') &&
188
- animations.push(
189
- Animated.timing(this.longitudeDelta, {
190
- ...config,
191
- toValue: config.longitudeDelta,
192
- useNativeDriver: false,
193
- })
194
- );
195
-
146
+ const animations = [];
147
+ for (const type of configTypes) {
148
+ if (config.hasOwnProperty(type)) {
149
+ animations.push(
150
+ Animated.timing(this[type], {
151
+ ...config,
152
+ toValue: config[type],
153
+ // may help to eliminate some dev warnings and perf issues
154
+ useNativeDriver: !!config?.useNativeDriver,
155
+ })
156
+ );
157
+ }
158
+ }
196
159
  return Animated.parallel(animations);
197
160
  }
198
161
  }
@@ -39,6 +39,12 @@ const propTypes = {
39
39
  */
40
40
  lineDashPhase: PropTypes.number,
41
41
 
42
+ /**
43
+ * Make the `Polygon` or `Polyline` tappable
44
+ *
45
+ */
46
+ tappable: PropTypes.boolean,
47
+
42
48
  /**
43
49
  * An array of numbers specifying the dash pattern to use for the path.
44
50
  *
@@ -100,9 +106,29 @@ const propTypes = {
100
106
  *
101
107
  */
102
108
  markerComponent: PropTypes.node,
109
+
110
+ /**
111
+ * The title of the marker. This is only used if the <Marker /> component has no children that
112
+ * are a `<Callout />`, in which case the default callout behavior will be used, which
113
+ * will show both the `title` and the `description`, if provided.
114
+ */
115
+ title: PropTypes.string,
103
116
  };
104
117
 
105
- const Geojson = props => {
118
+ const Geojson = (props) => {
119
+ const {
120
+ title,
121
+ image,
122
+ zIndex,
123
+ onPress,
124
+ lineCap,
125
+ lineJoin,
126
+ tappable,
127
+ miterLimit,
128
+ lineDashPhase,
129
+ lineDashPattern,
130
+ markerComponent,
131
+ } = props;
106
132
  const overlays = makeOverlays(props.geojson.features);
107
133
  return (
108
134
  <React.Fragment>
@@ -116,12 +142,13 @@ const Geojson = props => {
116
142
  <Marker
117
143
  key={index}
118
144
  coordinate={overlay.coordinates}
119
- image={props.image}
145
+ image={image}
146
+ title={title}
120
147
  pinColor={markerColor}
121
- zIndex={props.zIndex}
122
- onPress={() => props.onPress && props.onPress(overlay)}
148
+ zIndex={zIndex}
149
+ onPress={() => onPress && onPress(overlay)}
123
150
  >
124
- {props.markerComponent}
151
+ {markerComponent}
125
152
  </Marker>
126
153
  );
127
154
  }
@@ -134,9 +161,9 @@ const Geojson = props => {
134
161
  strokeColor={strokeColor}
135
162
  fillColor={fillColor}
136
163
  strokeWidth={strokeWidth}
137
- tappable={props.tappable}
138
- onPress={() => props.onPress && props.onPress(overlay)}
139
- zIndex={props.zIndex}
164
+ tappable={tappable}
165
+ onPress={() => onPress && onPress(overlay)}
166
+ zIndex={zIndex}
140
167
  />
141
168
  );
142
169
  }
@@ -147,14 +174,14 @@ const Geojson = props => {
147
174
  coordinates={overlay.coordinates}
148
175
  strokeColor={strokeColor}
149
176
  strokeWidth={strokeWidth}
150
- lineDashPhase={props.lineDashPhase}
151
- lineDashPattern={props.lineDashPattern}
152
- lineCap={props.lineCap}
153
- lineJoin={props.lineJoin}
154
- miterLimit={props.miterLimit}
155
- zIndex={props.zIndex}
156
- tappable={props.tappable}
157
- onPress={() => props.onPress && props.onPress(overlay)}
177
+ lineDashPhase={lineDashPhase}
178
+ lineDashPattern={lineDashPattern}
179
+ lineCap={lineCap}
180
+ lineJoin={lineJoin}
181
+ miterLimit={miterLimit}
182
+ zIndex={zIndex}
183
+ tappable={tappable}
184
+ onPress={() => onPress && onPress(overlay)}
158
185
  />
159
186
  );
160
187
  }
@@ -167,51 +194,51 @@ Geojson.propTypes = propTypes;
167
194
 
168
195
  export default Geojson;
169
196
 
170
- export const makeOverlays = features => {
197
+ export const makeOverlays = (features) => {
171
198
  const points = features
172
199
  .filter(
173
- f =>
200
+ (f) =>
174
201
  f.geometry &&
175
202
  (f.geometry.type === 'Point' || f.geometry.type === 'MultiPoint')
176
203
  )
177
- .map(feature =>
178
- makeCoordinates(feature).map(coordinates =>
204
+ .map((feature) =>
205
+ makeCoordinates(feature).map((coordinates) =>
179
206
  makeOverlay(coordinates, feature)
180
207
  )
181
208
  )
182
209
  .reduce(flatten, [])
183
- .map(overlay => ({ ...overlay, type: 'point' }));
210
+ .map((overlay) => ({ ...overlay, type: 'point' }));
184
211
 
185
212
  const lines = features
186
213
  .filter(
187
- f =>
214
+ (f) =>
188
215
  f.geometry &&
189
216
  (f.geometry.type === 'LineString' ||
190
217
  f.geometry.type === 'MultiLineString')
191
218
  )
192
- .map(feature =>
193
- makeCoordinates(feature).map(coordinates =>
219
+ .map((feature) =>
220
+ makeCoordinates(feature).map((coordinates) =>
194
221
  makeOverlay(coordinates, feature)
195
222
  )
196
223
  )
197
224
  .reduce(flatten, [])
198
- .map(overlay => ({ ...overlay, type: 'polyline' }));
225
+ .map((overlay) => ({ ...overlay, type: 'polyline' }));
199
226
 
200
227
  const multipolygons = features
201
- .filter(f => f.geometry && f.geometry.type === 'MultiPolygon')
202
- .map(feature =>
203
- makeCoordinates(feature).map(coordinates =>
228
+ .filter((f) => f.geometry && f.geometry.type === 'MultiPolygon')
229
+ .map((feature) =>
230
+ makeCoordinates(feature).map((coordinates) =>
204
231
  makeOverlay(coordinates, feature)
205
232
  )
206
233
  )
207
234
  .reduce(flatten, []);
208
235
 
209
236
  const polygons = features
210
- .filter(f => f.geometry && f.geometry.type === 'Polygon')
211
- .map(feature => makeOverlay(makeCoordinates(feature), feature))
237
+ .filter((f) => f.geometry && f.geometry.type === 'Polygon')
238
+ .map((feature) => makeOverlay(makeCoordinates(feature), feature))
212
239
  .reduce(flatten, [])
213
240
  .concat(multipolygons)
214
- .map(overlay => ({ ...overlay, type: 'polygon' }));
241
+ .map((overlay) => ({ ...overlay, type: 'polygon' }));
215
242
 
216
243
  return points.concat(lines).concat(polygons);
217
244
  };
@@ -236,11 +263,11 @@ const makeOverlay = (coordinates, feature) => {
236
263
  return overlay;
237
264
  };
238
265
 
239
- const makePoint = c => ({ latitude: c[1], longitude: c[0] });
266
+ const makePoint = (c) => ({ latitude: c[1], longitude: c[0] });
240
267
 
241
- const makeLine = l => l.map(makePoint);
268
+ const makeLine = (l) => l.map(makePoint);
242
269
 
243
- const makeCoordinates = feature => {
270
+ const makeCoordinates = (feature) => {
244
271
  const g = feature.geometry;
245
272
  if (g.type === 'Point') {
246
273
  return [makePoint(g.coordinates)];
@@ -253,7 +280,7 @@ const makeCoordinates = feature => {
253
280
  } else if (g.type === 'Polygon') {
254
281
  return g.coordinates.map(makeLine);
255
282
  } else if (g.type === 'MultiPolygon') {
256
- return g.coordinates.map(p => p.map(makeLine));
283
+ return g.coordinates.map((p) => p.map(makeLine));
257
284
  } else {
258
285
  return [];
259
286
  }
@@ -271,7 +298,7 @@ const doesOverlayContainProperty = (overlay, property) => {
271
298
  };
272
299
 
273
300
  const getRgbaFromHex = (hex, alpha = 1) => {
274
- const [r, g, b] = hex.match(/\w\w/g).map(x => parseInt(x, 16));
301
+ const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
275
302
  return `rgba(${r},${g},${b},${alpha})`;
276
303
  };
277
304
 
@@ -293,15 +320,15 @@ const getColor = (props, overlay, colorType, overrideColorProp) => {
293
320
  }
294
321
  return color;
295
322
  }
296
- return null;
323
+ return;
297
324
  };
298
325
 
299
326
  const getStrokeWidth = (props, overlay) => {
300
327
  if (props.hasOwnProperty('strokeWidth')) {
301
- return props['strokeWidth'];
328
+ return props.strokeWidth;
302
329
  }
303
330
  if (doesOverlayContainProperty(overlay, 'stroke-width')) {
304
331
  return overlay.feature.properties['stroke-width'];
305
332
  }
306
- return 0;
333
+ return;
307
334
  };
@@ -128,7 +128,7 @@ class MapCircle extends React.Component {
128
128
  return (
129
129
  <AIRMapCircle
130
130
  {...this.props}
131
- ref={ref => {
131
+ ref={(ref) => {
132
132
  this.circle = ref;
133
133
  }}
134
134
  />
@@ -73,13 +73,13 @@ class MapHeatmap extends React.Component {
73
73
  let gradient;
74
74
  if (this.props.gradient) {
75
75
  gradient = Object.assign({}, this.props.gradient);
76
- gradient.colors = gradient.colors.map(c => processColor(c));
76
+ gradient.colors = gradient.colors.map((c) => processColor(c));
77
77
  }
78
78
  return (
79
79
  <AIRMapHeatmap
80
80
  {...this.props}
81
81
  gradient={gradient}
82
- ref={ref => {
82
+ ref={(ref) => {
83
83
  this.heatmap = ref;
84
84
  }}
85
85
  />
@@ -189,6 +189,8 @@ const propTypes = {
189
189
 
190
190
  draggable: PropTypes.bool,
191
191
 
192
+ tappable: PropTypes.bool,
193
+
192
194
  /**
193
195
  * Sets whether this marker should track view changes true.
194
196
  */
@@ -333,14 +335,14 @@ class MapMarker extends React.Component {
333
335
 
334
336
  return (
335
337
  <AIRMapMarker
336
- ref={ref => {
338
+ ref={(ref) => {
337
339
  this.marker = ref;
338
340
  }}
339
341
  {...this.props}
340
342
  image={image}
341
343
  icon={icon}
342
344
  style={[styles.marker, this.props.style]}
343
- onPress={event => {
345
+ onPress={(event) => {
344
346
  if (this.props.stopPropagation) {
345
347
  event.stopPropagation();
346
348
  }
@@ -175,7 +175,7 @@ class MapPolygon extends React.Component {
175
175
  return (
176
176
  <AIRMapPolygon
177
177
  {...this.props}
178
- ref={ref => {
178
+ ref={(ref) => {
179
179
  this.polygon = ref;
180
180
  }}
181
181
  onLayout={
@@ -147,7 +147,7 @@ class MapPolyline extends React.Component {
147
147
  return (
148
148
  <AIRMapPolyline
149
149
  {...this.props}
150
- ref={ref => {
150
+ ref={(ref) => {
151
151
  this.polyline = ref;
152
152
  }}
153
153
  />
@@ -28,12 +28,20 @@ const propTypes = {
28
28
  * @platform android
29
29
  */
30
30
  zIndex: PropTypes.number,
31
+
31
32
  /**
32
33
  * The maximum zoom level for this tile overlay.
33
34
  *
34
35
  */
35
36
  maximumZ: PropTypes.number,
36
37
 
38
+ /**
39
+ * (Optional) The maximum native zoom level for this tile overlay. Tiles are auto-scaled for higher
40
+ * zoom levels.
41
+ *
42
+ */
43
+ maximumNativeZ: PropTypes.number,
44
+
37
45
  /**
38
46
  * The minimum zoom level for this tile overlay.
39
47
  *
@@ -48,12 +56,20 @@ const propTypes = {
48
56
  shouldReplaceMapContent: PropTypes.bool,
49
57
 
50
58
  /**
51
- * (Optional) Tile size for iOS only, default size is 256 * 256.
59
+ * (Optional) Tile size only, default size is 256 (for tiles of 256 * 256 pixels)
52
60
  *
53
- * @platform ios
54
61
  */
55
62
  tileSize: PropTypes.number,
56
63
 
64
+ /**
65
+ * (Optional) Doubles tile size from 256 to 512 utilising higher zoom levels i.e.
66
+ * loading 4 higher zoom level tiles and combining them for one high-resolution
67
+ * tile. iOS does this automatically, even if it is not desirable always.
68
+ *
69
+ * @platform android
70
+ */
71
+ doubleTileSize: PropTypes.bool,
72
+
57
73
  /**
58
74
  *
59
75
  * Allow tiles using the TMS coordinate system (origin bottom left)
@@ -61,6 +77,42 @@ const propTypes = {
61
77
  *
62
78
  */
63
79
  flipY: PropTypes.bool,
80
+
81
+ /**
82
+ *
83
+ * (Optional) Enable caching of tiles in the specified directory. Directory
84
+ * can be specified either as a normal path or in URL format (file://). Tiles
85
+ * are stored in tileCachePath directory as follows "/{z}/{x}/{y}" i.e. in
86
+ * sub-directories 2-levels deep, filename tile y-coordinate without any
87
+ * filetype-extension.
88
+ * NB! All cache management needs to be implemented by client e.g. deleting tiles
89
+ * to manage use of storage space etc.
90
+ *
91
+ */
92
+ tileCachePath: PropTypes.string,
93
+
94
+ /**
95
+ * (Optional) Defines how maximum age in seconds for cached tile before they
96
+ * are refreshed. NB! Refresh logic is "serve-stale-while-refresh" i.e. to
97
+ * ensure map availability a stale (over max age) tile is served while a tile
98
+ * refresh process is started in the background.
99
+ */
100
+ tileCacheMaxAge: PropTypes.number,
101
+
102
+ /**
103
+ * (Optional) Sets offline-mode. In offline-mode tiles are not fetched from
104
+ * the tile servers, rather only tiles stored in the cache directory are used.
105
+ * Furthermore automated tile scaling is activated: if tile at a desired zoom
106
+ * level is not found from the cache directory, then lower zoom level tile is
107
+ * used (until minimumZ) and scaled.
108
+ */
109
+ offlineMode: PropTypes.bool,
110
+
111
+ /**
112
+ * (Optional) Map layer opacity. Value between 0 - 1, with 0 meaning fully
113
+ * transparent.
114
+ */
115
+ opacity: PropTypes.number,
64
116
  };
65
117
 
66
118
  class MapUrlTile extends React.Component {
@@ -1042,7 +1042,7 @@ class MapView extends React.Component {
1042
1042
  if (Platform.OS === 'android' && this.props.liteMode) {
1043
1043
  return (
1044
1044
  <AIRMapLite
1045
- ref={ref => {
1045
+ ref={(ref) => {
1046
1046
  this.map = ref;
1047
1047
  }}
1048
1048
  {...props}
@@ -1054,7 +1054,7 @@ class MapView extends React.Component {
1054
1054
 
1055
1055
  return (
1056
1056
  <AIRMap
1057
- ref={ref => {
1057
+ ref={(ref) => {
1058
1058
  this.map = ref;
1059
1059
  }}
1060
1060
  {...props}
@@ -1069,7 +1069,7 @@ MapView.childContextTypes = childContextTypes;
1069
1069
 
1070
1070
  MapView.MAP_TYPES = MAP_TYPES;
1071
1071
 
1072
- const nativeComponent = Component =>
1072
+ const nativeComponent = (Component) =>
1073
1073
  requireNativeComponent(Component, MapView, {
1074
1074
  nativeOnly: {
1075
1075
  onChange: true,
@@ -1090,7 +1090,7 @@ if (Platform.OS === 'android') {
1090
1090
  'react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.'
1091
1091
  );
1092
1092
  }
1093
- const getAirMapComponent = provider => airMaps[provider || 'default'];
1093
+ const getAirMapComponent = (provider) => airMaps[provider || 'default'];
1094
1094
 
1095
1095
  let AIRMapLite;
1096
1096
  if (!NativeModules.UIManager.getViewManagerConfig) {
@@ -29,12 +29,20 @@ const propTypes = {
29
29
  * @platform android
30
30
  */
31
31
  zIndex: PropTypes.number,
32
+
32
33
  /**
33
34
  * The maximum zoom level for this tile overlay.
34
35
  *
35
36
  */
36
37
  maximumZ: PropTypes.number,
37
38
 
39
+ /**
40
+ * (Optional) The maximum native zoom level for this tile overlay. Tiles are auto-scaled for higher
41
+ * zoom levels.
42
+ *
43
+ */
44
+ maximumNativeZ: PropTypes.number,
45
+
38
46
  /**
39
47
  * The minimum zoom level for this tile overlay.
40
48
  *
@@ -47,15 +55,54 @@ const propTypes = {
47
55
  * @platform ios
48
56
  */
49
57
  shouldReplaceMapContent: PropTypes.bool,
58
+
50
59
  /**
51
- * tileSize.
60
+ * (Optional) Tile size only, default size is 256 (for tiles of 256 * 256 pixels)
52
61
  *
53
62
  */
54
63
  tileSize: PropTypes.number,
55
64
 
56
65
  /**
57
- * opacity. between 0 - 1
58
66
  *
67
+ * Allow tiles using the TMS coordinate system (origin bottom left)
68
+ * to be used, and displayed at their correct coordinates
69
+ *
70
+ */
71
+ flipY: PropTypes.bool,
72
+
73
+ /**
74
+ *
75
+ * (Optional) Enable caching of tiles in the specified directory. Directory
76
+ * can be specified either as a normal path or in URL format (file://). Tiles
77
+ * are stored in tileCachePath directory as follows "/{z}/{x}/{y}" i.e. in
78
+ * sub-directories 2-levels deep, filename tile y-coordinate without any
79
+ * filetype-extension.
80
+ * NB! All cache management needs to be implemented by client e.g. deleting tiles
81
+ * to manage use of storage space etc.
82
+ *
83
+ */
84
+ tileCachePath: PropTypes.string,
85
+
86
+ /**
87
+ * (Optional) Defines how maximum age in seconds for cached tile before they
88
+ * are refreshed. NB! Refresh logic is "serve-stale-while-refresh" i.e. to
89
+ * ensure map availability a stale (over max age) tile is served while a tile
90
+ * refresh process is started in the background.
91
+ */
92
+ tileCacheMaxAge: PropTypes.number,
93
+
94
+ /**
95
+ * (Optional) Sets offline-mode. In offline-mode tiles are not fetched from
96
+ * the tile servers, rather only tiles stored in the cache directory are used.
97
+ * Furthermore automated tile scaling is activated: if tile at a desired zoom
98
+ * level is not found from the cache directory, then lower zoom level tile is
99
+ * used (until minimumZ) and scaled.
100
+ */
101
+ offlineMode: PropTypes.bool,
102
+
103
+ /**
104
+ * (Optional) Map layer opacity. Value between 0 - 1, with 0 meaning fully
105
+ * transparent.
59
106
  */
60
107
  opacity: PropTypes.number,
61
108
  };
@@ -24,7 +24,7 @@ export const contextTypes = {
24
24
  provider: PropTypes.string,
25
25
  };
26
26
 
27
- export const createNotSupportedComponent = message => () => {
27
+ export const createNotSupportedComponent = (message) => () => {
28
28
  console.error(message);
29
29
  return null;
30
30
  };