@rnmapbox/maps 10.0.0-beta.75 → 10.0.0-beta.76

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 (134) hide show
  1. package/README.md +3 -3
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +5 -5
  3. package/ios/RCTMGL-v10/RCMTGLImage.swift +2 -1
  4. package/ios/RCTMGL-v10/RCTMGLImages.swift +57 -17
  5. package/ios/RCTMGL-v10/RCTMGLMapView.swift +11 -1
  6. package/ios/RCTMGL-v10/RCTMGLUtils.swift +14 -5
  7. package/javascript/MGLModule.ts +54 -0
  8. package/javascript/Mapbox.ts +97 -0
  9. package/javascript/classes/index.d.ts +20 -1
  10. package/javascript/components/Annotation.tsx +141 -0
  11. package/javascript/components/Callout.d.ts +35 -0
  12. package/javascript/components/ImageSource.tsx +1 -1
  13. package/javascript/components/Images.tsx +58 -6
  14. package/javascript/components/MapView.tsx +1 -1
  15. package/javascript/components/MarkerView.tsx +3 -2
  16. package/javascript/components/PointAnnotation.tsx +4 -3
  17. package/javascript/components/ShapeSource.tsx +1 -1
  18. package/javascript/components/{Style.js → Style.tsx} +117 -35
  19. package/javascript/components/Terrain.tsx +8 -7
  20. package/javascript/components/{UserLocation.js → UserLocation.tsx} +105 -94
  21. package/javascript/components/VectorSource.tsx +1 -1
  22. package/javascript/index.ts +4 -0
  23. package/javascript/modules/offline/offlineManager.ts +5 -1
  24. package/javascript/modules/snapshot/snapshotManager.ts +1 -0
  25. package/javascript/types/Position.ts +1 -0
  26. package/javascript/utils/Logger.ts +1 -1
  27. package/javascript/utils/geoUtils.ts +0 -35
  28. package/lib/commonjs/MGLModule.js +37 -0
  29. package/lib/commonjs/MGLModule.js.map +1 -0
  30. package/lib/commonjs/Mapbox.js +372 -0
  31. package/lib/commonjs/Mapbox.js.map +1 -0
  32. package/lib/commonjs/classes/index.d.js +2 -0
  33. package/lib/commonjs/classes/index.d.js.map +1 -1
  34. package/lib/commonjs/components/{annotations/Annotation.js → Annotation.js} +26 -27
  35. package/lib/commonjs/components/Annotation.js.map +1 -0
  36. package/lib/commonjs/components/Callout.d.js +9 -0
  37. package/lib/commonjs/components/Callout.d.js.map +1 -0
  38. package/lib/commonjs/components/Images.js +17 -1
  39. package/lib/commonjs/components/Images.js.map +1 -1
  40. package/lib/commonjs/components/MapView.js.map +1 -1
  41. package/lib/commonjs/components/MarkerView.js.map +1 -1
  42. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  43. package/lib/commonjs/components/Style.js +11 -15
  44. package/lib/commonjs/components/Style.js.map +1 -1
  45. package/lib/commonjs/components/Terrain.js.map +1 -1
  46. package/lib/commonjs/components/UserLocation.js +26 -77
  47. package/lib/commonjs/components/UserLocation.js.map +1 -1
  48. package/lib/commonjs/index.js +16 -339
  49. package/lib/commonjs/index.js.map +1 -1
  50. package/lib/commonjs/modules/offline/offlineManager.js +6 -0
  51. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  52. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  53. package/lib/commonjs/types/Position.js +2 -0
  54. package/lib/commonjs/types/Position.js.map +1 -0
  55. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  56. package/lib/commonjs/utils/geoUtils.js +1 -19
  57. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  58. package/lib/module/MGLModule.js +19 -0
  59. package/lib/module/MGLModule.js.map +1 -0
  60. package/lib/module/Mapbox.js +59 -0
  61. package/lib/module/Mapbox.js.map +1 -0
  62. package/lib/module/classes/index.d.js +2 -0
  63. package/lib/module/classes/index.d.js.map +1 -1
  64. package/lib/module/components/{annotations/Annotation.js → Annotation.js} +26 -27
  65. package/lib/module/components/Annotation.js.map +1 -0
  66. package/lib/module/components/Callout.d.js +2 -0
  67. package/lib/module/components/Callout.d.js.map +1 -0
  68. package/lib/module/components/Images.js +17 -1
  69. package/lib/module/components/Images.js.map +1 -1
  70. package/lib/module/components/MapView.js.map +1 -1
  71. package/lib/module/components/MarkerView.js.map +1 -1
  72. package/lib/module/components/PointAnnotation.js.map +1 -1
  73. package/lib/module/components/Style.js +11 -15
  74. package/lib/module/components/Style.js.map +1 -1
  75. package/lib/module/components/Terrain.js.map +1 -1
  76. package/lib/module/components/UserLocation.js +25 -76
  77. package/lib/module/components/UserLocation.js.map +1 -1
  78. package/lib/module/index.js +3 -108
  79. package/lib/module/index.js.map +1 -1
  80. package/lib/module/modules/offline/offlineManager.js +1 -0
  81. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  82. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  83. package/lib/module/types/Position.js +2 -0
  84. package/lib/module/types/Position.js.map +1 -0
  85. package/lib/module/utils/animated/Animated.js.map +1 -1
  86. package/lib/module/utils/geoUtils.js +0 -16
  87. package/lib/module/utils/geoUtils.js.map +1 -1
  88. package/lib/typescript/MGLModule.d.ts +22 -0
  89. package/lib/typescript/MGLModule.d.ts.map +1 -0
  90. package/lib/typescript/Mapbox.d.ts +54 -0
  91. package/lib/typescript/Mapbox.d.ts.map +1 -0
  92. package/lib/typescript/components/Annotation.d.ts +34 -0
  93. package/lib/typescript/components/Annotation.d.ts.map +1 -0
  94. package/lib/typescript/components/ImageSource.d.ts +1 -1
  95. package/lib/typescript/components/ImageSource.d.ts.map +1 -1
  96. package/lib/typescript/components/Images.d.ts +24 -2
  97. package/lib/typescript/components/Images.d.ts.map +1 -1
  98. package/lib/typescript/components/MapView.d.ts +2 -5
  99. package/lib/typescript/components/MapView.d.ts.map +1 -1
  100. package/lib/typescript/components/MarkerView.d.ts +3 -2
  101. package/lib/typescript/components/MarkerView.d.ts.map +1 -1
  102. package/lib/typescript/components/PointAnnotation.d.ts +9 -3
  103. package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
  104. package/lib/typescript/components/ShapeSource.d.ts +1 -1
  105. package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
  106. package/lib/typescript/components/Style.d.ts +74 -0
  107. package/lib/typescript/components/Style.d.ts.map +1 -0
  108. package/lib/typescript/components/Terrain.d.ts +2 -2
  109. package/lib/typescript/components/Terrain.d.ts.map +1 -1
  110. package/lib/typescript/components/UserLocation.d.ts +102 -0
  111. package/lib/typescript/components/UserLocation.d.ts.map +1 -0
  112. package/lib/typescript/components/VectorSource.d.ts +1 -1
  113. package/lib/typescript/components/VectorSource.d.ts.map +1 -1
  114. package/lib/typescript/index.d.ts +4 -0
  115. package/lib/typescript/index.d.ts.map +1 -0
  116. package/lib/typescript/modules/offline/offlineManager.d.ts +2 -1
  117. package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -1
  118. package/lib/typescript/modules/snapshot/snapshotManager.d.ts +1 -0
  119. package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -1
  120. package/lib/typescript/types/Position.d.ts +2 -0
  121. package/lib/typescript/types/Position.d.ts.map +1 -0
  122. package/lib/typescript/utils/Logger.d.ts +1 -1
  123. package/lib/typescript/utils/Logger.d.ts.map +1 -1
  124. package/lib/typescript/utils/animated/Animated.d.ts +23 -0
  125. package/lib/typescript/utils/animated/Animated.d.ts.map +1 -0
  126. package/lib/typescript/utils/geoUtils.d.ts +0 -8
  127. package/lib/typescript/utils/geoUtils.d.ts.map +1 -1
  128. package/package.json +3 -5
  129. package/index.d.ts +0 -516
  130. package/javascript/components/annotations/Annotation.js +0 -122
  131. package/javascript/index.js +0 -162
  132. package/lib/commonjs/components/annotations/Annotation.js.map +0 -1
  133. package/lib/module/components/annotations/Annotation.js.map +0 -1
  134. /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
package/index.d.ts DELETED
@@ -1,516 +0,0 @@
1
- declare module 'react-native-mapbox-gl__maps';
2
-
3
- import { Component, FC, ReactNode } from 'react';
4
- import { ViewProps, ViewStyle, StyleProp, TextStyle } from 'react-native';
5
- import ReactNative from 'react-native';
6
- import {
7
- Geometry,
8
- Properties,
9
- Position,
10
- Feature,
11
- LineString,
12
- Coord,
13
- Units,
14
- BBox,
15
- Id,
16
- FeatureCollection,
17
- } from '@turf/helpers';
18
-
19
- import type {
20
- SymbolLayerStyleProps,
21
- CircleLayerStyleProps,
22
- FillExtrusionLayerStyleProps,
23
- RasterLayerStyleProps,
24
- HeatmapLayerStyleProps,
25
- FillLayerStyleProps,
26
- LineLayerStyleProps,
27
- BackgroundLayerStyleProps,
28
- } from './javascript/utils/MapboxStyles';
29
- import { getAnnotationsLayerID as _getAnnotationsLayerID } from './javascript/utils/getAnnotationsLayerID';
30
- import {
31
- Camera as _Camera,
32
- CameraStop as _CameraStop,
33
- CameraFollowConfig as _CameraFollowConfig,
34
- CameraMinMaxConfig as _CameraMinMaxConfig,
35
- CameraBounds as _CameraBounds,
36
- CameraPadding as _CameraPadding,
37
- CameraBoundsWithPadding as _CameraBoundsWithPadding,
38
- CameraStops as _CameraStops,
39
- CameraAnimationMode as _CameraAnimationMode,
40
- type UserTrackingMode as _UserTrackingMode,
41
- type UserTrackingModeChangeCallback as _UserTrackingModeChangeCallback,
42
- } from './javascript/components/Camera';
43
- import _Images from './javascript/components/Images';
44
- import _Image from './javascript/components/Image';
45
- import _MapView, { _MapState } from './javascript/components/MapView';
46
- import { MarkerView as _MarkerView } from './javascript/components/MarkerView';
47
- import { PointAnnotation as _PointAnnotation } from './javascript/components/PointAnnotation';
48
- import { Atmosphere as _Atmosphere } from './javascript/components/Atmosphere';
49
- import {
50
- SymbolLayer as _SymbolLayer,
51
- Props as _SymbolLayerProps,
52
- } from './javascript/components/SymbolLayer';
53
- import _LineLayer, {
54
- Props as _LineLayerProps,
55
- } from './javascript/components/LineLayer';
56
- import _SkyLater from './javascript/components/SkyLayer';
57
- import { Props as _BackgroundLayerProps } from './javascript/components/BackgroundLayer';
58
- import { Props as _CircleLayerProps } from './javascript/components/CircleLayer';
59
- import { Props as _FillLayerProps } from './javascript/components/FillLayer';
60
- import { Props as _FillExtrusionLayerProps } from './javascript/components/FillExtrusionLayer';
61
- import { Props as _RasterLayerProps } from './javascript/components/RasterLayer';
62
- import { Props as _HeatmapLayerProps } from './javascript/components/HeatmapLayer';
63
- import _SkyLayer, {
64
- Props as _SkyLayerProps,
65
- } from './javascript/components/SkyLayer';
66
- import {
67
- ShapeSource as _ShapeSource,
68
- Props as _ShapeSourceProps,
69
- } from './javascript/components/ShapeSource';
70
- import _RasterSource from './javascript/components/RasterSource';
71
- import _RasterDemSource from './javascript/components/RasterDemSource';
72
- import _VectorSource from './javascript/components/VectorSource';
73
- import _Light from './javascript/components/Light';
74
- import type {
75
- MapboxGLEvent as _MapboxGLEvent,
76
- AnimatedPoint as _AnimatedPoint,
77
- AnimatedShape as _AnimatedShape,
78
- } from './javascript/types/index';
79
- import type { requestAndroidLocationPermissions as _requestAndroidLocationPermissions } from './javascript/requestAndroidLocationPermissions';
80
- import type {
81
- Location as _Location,
82
- LocationManager,
83
- } from './javascript/modules/location/locationManager';
84
- import type { OnPressEvent as _OnPressEvent } from './javascript/types/OnPressEvent';
85
- import {
86
- type LogLevel,
87
- type LogObject,
88
- type LogCallback,
89
- Logger as _Logger,
90
- } from './javascript/utils/Logger';
91
-
92
- export type OnPressEvent = _OnPressEvent;
93
-
94
- declare namespace MapboxGL {
95
- function removeCustomHeader(headerName: string): void;
96
- function addCustomHeader(headerName: string, headerValue: string): void;
97
- function setAccessToken(accessToken: string | null): Promise<string | null>;
98
- function setWellKnownTileServer(tileServer: string): void;
99
- function getAccessToken(): Promise<string>;
100
- function setTelemetryEnabled(telemetryEnabled: boolean): void;
101
- function setConnected(connected: boolean): void;
102
-
103
- const requestAndroidLocationPermissions = _requestAndroidLocationPermissions;
104
-
105
- const getAnnotationsLayerID = _getAnnotationsLayerID;
106
- type getAnnotationsLayerID = _getAnnotationsLayerID;
107
-
108
- const Logger = _Logger;
109
- type Logger = _Logger;
110
- const Camera = _Camera;
111
- type Camera = _Camera;
112
- type CameraStop = _CameraStop;
113
- type CameraFollowConfig = _CameraFollowConfig;
114
- type CameraMinMaxConfig = _CameraMinMaxConfig;
115
- type CameraBounds = _CameraBounds;
116
- type CameraPadding = _CameraPadding;
117
- type CameraBoundsWithPadding = _CameraBoundsWithPadding;
118
- type CameraStops = _CameraStops;
119
- type CameraAnimationMode = _CameraAnimationMode;
120
-
121
- const Atmosphere = _Atmosphere;
122
- const MarkerView = _MarkerView;
123
- const PointAnnotation = _PointAnnotation;
124
- const SymbolLayer = _SymbolLayer;
125
- const LineLayer = _LineLayer;
126
- type LineLayer = _LineLayer;
127
- const ShapeSource = _ShapeSource;
128
- type ShapeSource = _ShapeSource;
129
- const SkyLayer = _SkyLayer;
130
- type SkyLayer = _SkyLayer;
131
-
132
- const MapView = _MapView;
133
- type MapView = _MapView;
134
-
135
- type MapboxGLEvent = _MapboxGLEvent;
136
- type UserTrackingMode = _UserTrackingMode;
137
- type UserTrackingModeChangeCallback = _UserTrackingModeChangeCallback;
138
- type Location = _Location;
139
-
140
- /** @deprecated This will be removed in a future release. Use `Location['coords']` instead. */
141
- type Coordinates = Location['coords'];
142
-
143
- const offlineManager: OfflineManager;
144
- const snapshotManager: SnapshotManager;
145
- const locationManager: LocationManager;
146
-
147
- /**
148
- * Classes
149
- */
150
- class AnimatedPoint {
151
- constructor(point?: _AnimatedPoint);
152
- longitude: ReactNative.Animated.Value;
153
- latitude: ReactNative.Animated.Value;
154
- setValue: (point: GeoJSON.Point) => void;
155
- setOffset: (point: GeoJSON.Point) => void;
156
- flattenOffset: () => void;
157
- stopAnimation: (cb?: () => GeoJSON.Point) => void;
158
- addListener: (cb?: () => GeoJSON.Point) => void;
159
- removeListener: (id: string) => void;
160
- spring: (
161
- config: Record<string, any>,
162
- ) => ReactNative.Animated.CompositeAnimation;
163
- timing: (
164
- config: Record<string, any>,
165
- ) => ReactNative.Animated.CompositeAnimation;
166
- }
167
- class AnimatedShape {
168
- constructor(shape: _AnimatedShape);
169
- }
170
-
171
- class _TileServers {
172
- Mapbox: string;
173
- MapLibre?: string;
174
- MapTiler?: string;
175
- }
176
- const TileServers: _TileServers;
177
-
178
- class _OfflinePackDownloadState {
179
- Inactive: string | number;
180
- Active: string | number;
181
- Complete: string | number;
182
- Unknown?: string | number;
183
- }
184
- const OfflinePackDownloadState: _OfflinePackDownloadState;
185
-
186
- /**
187
- * GeoUtils
188
- */
189
- interface UnitsOptions {
190
- units?: Units;
191
- }
192
-
193
- interface PositionsOptions {
194
- bbox?: BBox;
195
- id?: Id;
196
- }
197
-
198
- namespace geoUtils {
199
- function makePoint<P = Properties>(
200
- coordinates: Position,
201
- properties?: P,
202
- options?: PositionsOptions,
203
- ): Feature<GeoJSON.Point, P>;
204
- function makeLineString<P = Properties>(
205
- coordinates: Position[],
206
- properties?: P,
207
- options?: PositionsOptions,
208
- ): Feature<LineString, P>;
209
- function makeLatLngBounds<G = Geometry, P = Properties>(
210
- northEastCoordinates: Position[],
211
- southWestCoordinates: Position[],
212
- ): FeatureCollection<G, P>;
213
- function makeFeature<G = Geometry, P = Properties>(
214
- geometry: G,
215
- properties?: P,
216
- ): Feature<G, P>;
217
- function makeFeatureCollection<G = Geometry, P = Properties>(
218
- features: Array<Feature<G, P>>,
219
- options?: PositionsOptions,
220
- ): FeatureCollection<G, P>;
221
- function addToFeatureCollection<G = Geometry, P = Properties>(
222
- newFeatureCollection: Array<FeatureCollection<G, P>>,
223
- newFeature: Feature<G, P>,
224
- ): FeatureCollection<G, P>;
225
- function calculateDistance(
226
- origin: Coord,
227
- dest: Coord,
228
- options?: UnitsOptions,
229
- ): number;
230
- function pointAlongLine(
231
- newLineString: Feature<LineString> | LineString,
232
- distAlong: number,
233
- options?: UnitsOptions,
234
- ): Feature<GeoJSON.Point>;
235
- function getOrCalculateVisibleRegion(
236
- coord: { lon: number; lat: number },
237
- zoomLevel: number,
238
- width: number,
239
- height: number,
240
- nativeRegion: {
241
- properties: { visibleBounds: number[] };
242
- visibleBounds: number[];
243
- },
244
- ): void;
245
- }
246
-
247
- namespace Animated {
248
- // sources
249
- class ShapeSource extends Component<_ShapeSourceProps> {}
250
- class ImageSource extends Component<ImageSourceProps> {}
251
-
252
- // layers
253
- class FillLayer extends Component<_FillLayerProps> {}
254
- class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
255
- class CircleLayer extends Component<_CircleLayerProps> {}
256
- class SymbolLayer extends Component<_SymbolLayerProps> {}
257
- class RasterLayer extends Component<_RasterLayerProps> {}
258
- class BackgroundLayer extends Component<_BackgroundLayerProps> {}
259
- }
260
-
261
- type Padding = number | [number, number] | [number, number, number, number];
262
-
263
- class UserLocation extends Component<UserLocationProps> {}
264
-
265
- const Light = _Light;
266
-
267
- class Callout extends Component<CalloutProps> {}
268
-
269
- /**
270
- * Sources
271
- */
272
- type VectorSource = _VectorSource;
273
- const VectorSource = _VectorSource;
274
- type RasterSource = _RasterSource;
275
- const RasterSource = _RasterSource;
276
- type RasterDemSource = RasterDemSource;
277
- const RasterDemSource = _RasterDemSource;
278
-
279
- /**
280
- * Layers
281
- */
282
- class BackgroundLayer extends Component<_BackgroundLayerProps> {}
283
- class CircleLayer extends Component<_CircleLayerProps> {}
284
- class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
285
- class FillLayer extends Component<_FillLayerProps> {}
286
- class RasterLayer extends Component<_RasterLayerProps> {}
287
- class HeatmapLayer extends Component<_HeatmapLayerProps> {}
288
- class ImageSource extends Component<ImageSourceProps> {}
289
- type SkyLayer = _SkyLayer;
290
- const SkyLayer = _SkyLayer;
291
-
292
- type Images = _Images;
293
- const Images = _Images;
294
- type Image = _Image;
295
- const Image = _Image;
296
-
297
- /**
298
- * Offline
299
- */
300
- class OfflineManager extends Component {
301
- clearAmbientCache(): Promise<void>;
302
- createPack(
303
- options: OfflineCreatePackOptions,
304
- progressListener?: (
305
- pack: OfflinePack,
306
- status: OfflineProgressStatus,
307
- ) => void,
308
- errorListener?: (pack: OfflinePack, err: OfflineProgressError) => void,
309
- ): Promise<void>;
310
- deletePack(name: string): Promise<void>;
311
- getPack(name: string): Promise<OfflinePack | undefined>;
312
- getPacks(): Promise<Array<OfflinePack>>;
313
- invalidateAmbientCache(): Promise<void>;
314
- invalidatePack(name: string): Promise<void>;
315
- migrateOfflineCache(): Promise<void>;
316
- resetDatabase(): Promise<void>;
317
- setMaximumAmbientCacheSize(size: number): Promise<void>;
318
- setProgressEventThrottle(throttleValue: number): void;
319
- setTileCountLimit(limit: number): void;
320
- subscribe(
321
- packName: string,
322
- progressListener: (pack: OfflinePack, status: object) => void,
323
- errorListener?: (pack: OfflinePack, err: object) => void,
324
- ): void;
325
- unsubscribe(packName: string): void;
326
- }
327
-
328
- class SnapshotManager {
329
- static takeSnap(options: SnapshotOptions): Promise<string>;
330
- }
331
-
332
- interface OfflineProgressStatus {
333
- name: string;
334
- state: number;
335
- percentage: number;
336
- completedResourceSize: number;
337
- completedTileCount: number;
338
- completedResourceCount: number;
339
- requiredResourceCount: number;
340
- completedTileSize: number;
341
- }
342
-
343
- interface OfflineProgressError {
344
- message: string;
345
- name: string;
346
- }
347
-
348
- interface OfflinePack {
349
- name: string;
350
- bounds: [GeoJSON.Position, GeoJSON.Position];
351
- metadata: any;
352
- status: () => Promise<OfflinePackStatus>;
353
- resume: () => Promise<void>;
354
- pause: () => Promise<void>;
355
- }
356
-
357
- interface OfflinePackStatus {
358
- name: string;
359
- state: number;
360
- percentage: number;
361
- completedResourceCount: number;
362
- completedResourceSize: number;
363
- completedTileSize: number;
364
- completedTileCount: number;
365
- requiredResourceCount: number;
366
- }
367
-
368
- /**
369
- * Constants
370
- */
371
-
372
- enum InterpolationMode {
373
- Exponential = 0,
374
- Categorical = 1,
375
- Interval = 2,
376
- Identity = 3,
377
- }
378
-
379
- enum StyleURL {
380
- Street = 'mapbox://styles/mapbox/streets-v11',
381
- Dark = 'mapbox://styles/mapbox/dark-v10',
382
- Light = 'mapbox://styles/mapbox/light-v10',
383
- Outdoors = 'mapbox://styles/mapbox/outdoors-v11',
384
- Satellite = 'mapbox://styles/mapbox/satellite-v9',
385
- SatelliteStreet = 'mapbox://styles/mapbox/satellite-streets-v11',
386
- TrafficDay = 'mapbox://styles/mapbox/navigation-preview-day-v4',
387
- TrafficNight = 'mapbox://styles/mapbox/navigation-preview-night-v4',
388
- }
389
- }
390
-
391
- export interface UserLocationProps {
392
- androidRenderMode?: 'normal' | 'compass' | 'gps';
393
- animated?: boolean;
394
- children?: ReactNode;
395
- minDisplacement?: number;
396
- requestsAlwaysUse?: boolean;
397
- onPress?: () => void;
398
- onUpdate?: (location: Location) => void;
399
- renderMode?: 'normal' | 'native';
400
- showsUserHeadingIndicator?: boolean;
401
- visible?: boolean;
402
- }
403
-
404
- export interface Transition {
405
- duration: number;
406
- delay: number;
407
- }
408
-
409
- export type BackgroundLayerStyle = BackgroundLayerStyleProps;
410
-
411
- export type CircleLayerStyle = CircleLayerStyleProps;
412
-
413
- export type FillExtrusionLayerStyle = FillExtrusionLayerStyleProps;
414
-
415
- export type FillLayerStyle = FillLayerStyleProps;
416
-
417
- export type SkyLayerStyle = SkyLayerStyleProps;
418
-
419
- export type LineLayerStyle = LineLayerStyleProps;
420
-
421
- export type RasterLayerStyle = RasterLayerStyleProps;
422
-
423
- export type SymbolLayerStyle = SymbolLayerStyleProps;
424
- export type LineLayerStyle = LineLayerStyleProps;
425
-
426
- export type HeatmapLayerStyle = HeatmapLayerStyleProps;
427
-
428
- export interface Point {
429
- x: number;
430
- y: number;
431
- }
432
-
433
- export interface CalloutProps extends Omit<ViewProps, 'style'> {
434
- title?: string;
435
- style?: StyleProp<ViewStyle>;
436
- containerStyle?: StyleProp<ViewStyle>;
437
- contentStyle?: StyleProp<ViewStyle>;
438
- tipStyle?: StyleProp<ViewStyle>;
439
- textStyle?: StyleProp<TextStyle>;
440
- }
441
-
442
- export interface OfflineCreatePackOptions {
443
- name?: string;
444
- styleURL?: string;
445
- bounds?: [GeoJSON.Position, GeoJSON.Position];
446
- minZoom?: number;
447
- maxZoom?: number;
448
- metadata?: any;
449
- }
450
-
451
- export interface SnapshotOptions {
452
- centerCoordinate?: GeoJSON.Position;
453
- width?: number;
454
- height?: number;
455
- zoomLevel?: number;
456
- pitch?: number;
457
- heading?: number;
458
- styleURL?: string;
459
- writeToDisk?: boolean;
460
- }
461
-
462
- export import Logger = MapboxGL.Logger;
463
-
464
- export import MapView = MapboxGL.MapView;
465
-
466
- export import Camera = MapboxGL.Camera;
467
- export import CameraStop = MapboxGL.CameraStop;
468
- export import CameraFollowConfig = MapboxGL.CameraFollowConfig;
469
- export import CameraMinMaxConfig = MapboxGL.CameraMinMaxConfig;
470
- export import CameraBounds = MapboxGL.CameraBounds;
471
- export import CameraPadding = MapboxGL.CameraPadding;
472
- export import CameraBoundsWithPadding = MapboxGL.CameraBoundsWithPadding;
473
- export import CameraStops = MapboxGL.CameraStops;
474
- export import CameraAnimationMode = MapboxGL.CameraAnimationMode;
475
-
476
- export import Atmosphere = MapboxGL.Atmosphere;
477
- export import Terrain = MapboxGL.Terrain;
478
- export import RasterDemSource = MapboxGL.RasterDemSource;
479
- export import ShapeSource = MapboxGL.ShapeSource;
480
- export import FillLayer = MapboxGL.FillLayer;
481
- export import FillExtrusionLayer = MapboxGL.FillExtrusionLayer;
482
- export import HeatmapLayer = MapboxGL.HeatmapLayer;
483
- export import LineLayer = MapboxGL.LineLayer;
484
- export import CircleLayer = MapboxGL.CircleLayer;
485
- export import SkyLayer = MapboxGL.SkyLayer;
486
- export import SymbolLayer = MapboxGL.SymbolLayer;
487
- export import RasterLayer = MapboxGL.RasterLayer;
488
- export import BackgroundLayer = MapboxGL.BackgroundLayer;
489
- export import MarkerView = MapboxGL.MarkerView;
490
- export import PointAnnotation = MapboxGL.PointAnnotation;
491
- export import Callout = MapboxGL.Callout;
492
-
493
- export import Location = MapboxGL.Location;
494
- /** @deprecated This will be removed in a future release. Use `Location['coords']` instead. */
495
- export import Coordinates = MapboxGL.Coordinates;
496
-
497
- export import MapboxGLEvent = MapboxGL.MapboxGLEvent;
498
- export import UserTrackingMode = MapboxGL.UserTrackingMode;
499
- export import UserTrackingModeChangeCallback = MapboxGL.UserTrackingModeChangeCallback;
500
- export import AnimatedPoint = MapboxGL.AnimatedPoint;
501
- /** @deprecated This will be removed in a future release. Use `AnimatedPoint` instead. */
502
- export import AnimatedMapPoint = MapboxGL.AnimatedPoint;
503
- export import AnimatedShape = MapboxGL.AnimatedShape;
504
- export import Images = MapboxGL.Images;
505
- export import Image = MapboxGL.Image;
506
- export import Light = MapboxGL.Light;
507
- export import VectorSource = MapboxGL.VectorSource;
508
- export import MapView = MapboxGL.MapView;
509
- export import SkyLayer = MapboxGL.SkyLayer;
510
- export import MapState = _MapState;
511
-
512
- export const { offlineManager } = MapboxGL;
513
-
514
- export const { getAnnotationsLayerID } = MapboxGL;
515
-
516
- export default MapboxGL;
@@ -1,122 +0,0 @@
1
- import React from 'react';
2
- import { Easing } from 'react-native';
3
- import PropTypes from 'prop-types';
4
-
5
- import { SymbolLayer } from '../SymbolLayer';
6
- import Animated from '../../utils/animated/Animated';
7
- import { AnimatedPoint } from '../../classes';
8
-
9
- class Annotation extends React.Component {
10
- static propTypes = {
11
- id: PropTypes.string.isRequired,
12
- animated: PropTypes.bool,
13
- animationDuration: PropTypes.number,
14
- animationEasingFunction: PropTypes.func,
15
- coordinates: PropTypes.arrayOf(PropTypes.number),
16
- onPress: PropTypes.func,
17
- children: PropTypes.any,
18
- style: PropTypes.any,
19
- icon: PropTypes.oneOfType([
20
- PropTypes.string,
21
- PropTypes.number,
22
- PropTypes.object,
23
- ]),
24
- };
25
-
26
- static defaultProps = {
27
- animated: false,
28
- animationDuration: 1000,
29
- animationEasingFunction: Easing.linear,
30
- };
31
-
32
- constructor(props) {
33
- super(props);
34
-
35
- const shape = this._getShapeFromProps(props);
36
-
37
- this.state = {
38
- shape: props.animated ? new AnimatedPoint(shape) : shape,
39
- };
40
-
41
- this.onPress = this.onPress.bind(this);
42
- }
43
-
44
- componentDidUpdate(prevProps) {
45
- if (!Array.isArray(this.props.coordinates)) {
46
- this.setState({ shape: null });
47
- return;
48
- }
49
-
50
- const hasCoordChanged =
51
- prevProps.coordinates[0] !== this.props.coordinates[0] ||
52
- prevProps.coordinates[1] !== this.props.coordinates[1];
53
-
54
- if (
55
- prevProps.animated !== this.props.animated ||
56
- (hasCoordChanged && (!this.state.shape || !this.props.animated))
57
- ) {
58
- const shape = this._getShapeFromProps(this.props);
59
-
60
- this.setState({
61
- shape: this.props.animated ? new AnimatedPoint(shape) : shape,
62
- });
63
- } else if (hasCoordChanged && this.props.animated && this.state.shape) {
64
- // flush current animations
65
- this.state.shape.stopAnimation();
66
-
67
- this.state.shape
68
- .timing({
69
- coordinates: this.props.coordinates,
70
- easing: this.props.animationEasingFunction,
71
- duration: this.props.animationDuration,
72
- })
73
- .start();
74
- }
75
- }
76
-
77
- onPress() {
78
- if (this.props.onPress) {
79
- this.props.onPress();
80
- }
81
- }
82
-
83
- _getShapeFromProps(props = {}) {
84
- const lng = props.coordinates[0] || 0;
85
- const lat = props.coordinates[1] || 0;
86
- return { type: 'Point', coordinates: [lng, lat] };
87
- }
88
-
89
- get symbolStyle() {
90
- if (!this.props.icon) {
91
- return undefined;
92
- }
93
- return Object.assign({}, this.props.style, {
94
- iconImage: this.props.icon,
95
- });
96
- }
97
-
98
- render() {
99
- if (!this.props.coordinates) {
100
- return null;
101
- }
102
-
103
- return (
104
- <Animated.ShapeSource
105
- id={this.props.id}
106
- ref="source"
107
- onPress={this.onPress}
108
- shape={this.state.shape}
109
- >
110
- {this.symbolStyle && (
111
- <SymbolLayer
112
- id={`${this.props.id}-symbol`}
113
- style={this.symbolStyle}
114
- />
115
- )}
116
- {this.props.children}
117
- </Animated.ShapeSource>
118
- );
119
- }
120
- }
121
-
122
- export default Annotation;