@rnmapbox/maps 10.0.0-beta.74 → 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 (196) hide show
  1. package/README.md +3 -3
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +61 -46
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +5 -5
  4. package/ios/RCTMGL-v10/RCMTGLImage.swift +2 -1
  5. package/ios/RCTMGL-v10/RCTMGLImages.swift +57 -17
  6. package/ios/RCTMGL-v10/RCTMGLMapView.swift +11 -1
  7. package/ios/RCTMGL-v10/RCTMGLUtils.swift +14 -5
  8. package/javascript/MGLModule.ts +54 -0
  9. package/javascript/Mapbox.ts +97 -0
  10. package/javascript/classes/index.d.ts +20 -1
  11. package/javascript/components/Annotation.tsx +141 -0
  12. package/javascript/components/Callout.d.ts +35 -0
  13. package/javascript/components/ImageSource.tsx +81 -0
  14. package/javascript/components/Images.tsx +58 -6
  15. package/javascript/components/{MapView.js → MapView.tsx} +456 -383
  16. package/javascript/components/MarkerView.tsx +3 -2
  17. package/javascript/components/NativeBridgeComponent.tsx +1 -1
  18. package/javascript/components/PointAnnotation.tsx +4 -3
  19. package/javascript/components/RasterDemSource.tsx +105 -0
  20. package/javascript/components/RasterSource.tsx +124 -0
  21. package/javascript/components/ShapeSource.tsx +1 -1
  22. package/javascript/components/{Style.js → Style.tsx} +117 -35
  23. package/javascript/components/Terrain.tsx +8 -7
  24. package/javascript/components/{UserLocation.js → UserLocation.tsx} +105 -94
  25. package/javascript/components/VectorSource.tsx +1 -1
  26. package/javascript/index.ts +4 -0
  27. package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +21 -6
  28. package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +19 -4
  29. package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +81 -21
  30. package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +27 -3
  31. package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +2 -1
  32. package/javascript/types/Position.ts +1 -0
  33. package/javascript/utils/Logger.ts +1 -1
  34. package/javascript/utils/geoUtils.ts +56 -0
  35. package/javascript/utils/{index.js → index.ts} +41 -19
  36. package/lib/commonjs/MGLModule.js +37 -0
  37. package/lib/commonjs/MGLModule.js.map +1 -0
  38. package/lib/commonjs/Mapbox.js +372 -0
  39. package/lib/commonjs/Mapbox.js.map +1 -0
  40. package/lib/commonjs/classes/index.d.js +2 -0
  41. package/lib/commonjs/classes/index.d.js.map +1 -1
  42. package/lib/commonjs/components/{annotations/Annotation.js → Annotation.js} +26 -27
  43. package/lib/commonjs/components/Annotation.js.map +1 -0
  44. package/lib/commonjs/components/Callout.d.js +9 -0
  45. package/lib/commonjs/components/Callout.d.js.map +1 -0
  46. package/lib/commonjs/components/ImageSource.js +8 -25
  47. package/lib/commonjs/components/ImageSource.js.map +1 -1
  48. package/lib/commonjs/components/Images.js +17 -1
  49. package/lib/commonjs/components/Images.js.map +1 -1
  50. package/lib/commonjs/components/MapView.js +30 -289
  51. package/lib/commonjs/components/MapView.js.map +1 -1
  52. package/lib/commonjs/components/MarkerView.js.map +1 -1
  53. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
  54. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  55. package/lib/commonjs/components/RasterDemSource.js +3 -37
  56. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  57. package/lib/commonjs/components/RasterSource.js +2 -46
  58. package/lib/commonjs/components/RasterSource.js.map +1 -1
  59. package/lib/commonjs/components/Style.js +11 -15
  60. package/lib/commonjs/components/Style.js.map +1 -1
  61. package/lib/commonjs/components/Terrain.js.map +1 -1
  62. package/lib/commonjs/components/UserLocation.js +26 -77
  63. package/lib/commonjs/components/UserLocation.js.map +1 -1
  64. package/lib/commonjs/index.js +16 -339
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -4
  67. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  68. package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
  69. package/lib/commonjs/modules/offline/offlineManager.js +7 -2
  70. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  71. package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
  72. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  73. package/lib/commonjs/types/Position.js +2 -0
  74. package/lib/commonjs/{utils/index.d.js.map → types/Position.js.map} +1 -1
  75. package/lib/commonjs/utils/animated/Animated.js.map +1 -1
  76. package/lib/commonjs/utils/geoUtils.js +12 -38
  77. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  78. package/lib/commonjs/utils/index.js +3 -6
  79. package/lib/commonjs/utils/index.js.map +1 -1
  80. package/lib/module/MGLModule.js +19 -0
  81. package/lib/module/MGLModule.js.map +1 -0
  82. package/lib/module/Mapbox.js +59 -0
  83. package/lib/module/Mapbox.js.map +1 -0
  84. package/lib/module/classes/index.d.js +2 -0
  85. package/lib/module/classes/index.d.js.map +1 -1
  86. package/lib/module/components/{annotations/Annotation.js → Annotation.js} +26 -27
  87. package/lib/module/components/Annotation.js.map +1 -0
  88. package/lib/module/components/Callout.d.js +2 -0
  89. package/lib/module/components/Callout.d.js.map +1 -0
  90. package/lib/module/components/ImageSource.js +8 -25
  91. package/lib/module/components/ImageSource.js.map +1 -1
  92. package/lib/module/components/Images.js +17 -1
  93. package/lib/module/components/Images.js.map +1 -1
  94. package/lib/module/components/MapView.js +31 -290
  95. package/lib/module/components/MapView.js.map +1 -1
  96. package/lib/module/components/MarkerView.js.map +1 -1
  97. package/lib/module/components/NativeBridgeComponent.js.map +1 -1
  98. package/lib/module/components/PointAnnotation.js.map +1 -1
  99. package/lib/module/components/RasterDemSource.js +4 -38
  100. package/lib/module/components/RasterDemSource.js.map +1 -1
  101. package/lib/module/components/RasterSource.js +3 -47
  102. package/lib/module/components/RasterSource.js.map +1 -1
  103. package/lib/module/components/Style.js +11 -15
  104. package/lib/module/components/Style.js.map +1 -1
  105. package/lib/module/components/Terrain.js.map +1 -1
  106. package/lib/module/components/UserLocation.js +25 -76
  107. package/lib/module/components/UserLocation.js.map +1 -1
  108. package/lib/module/index.js +3 -108
  109. package/lib/module/index.js.map +1 -1
  110. package/lib/module/modules/offline/OfflineCreatePackOptions.js +2 -4
  111. package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  112. package/lib/module/modules/offline/OfflinePack.js.map +1 -1
  113. package/lib/module/modules/offline/offlineManager.js +1 -1
  114. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  115. package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
  116. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  117. package/lib/module/types/Position.js +2 -0
  118. package/lib/module/{utils/index.d.js.map → types/Position.js.map} +1 -1
  119. package/lib/module/utils/animated/Animated.js.map +1 -1
  120. package/lib/module/utils/geoUtils.js +5 -32
  121. package/lib/module/utils/geoUtils.js.map +1 -1
  122. package/lib/module/utils/index.js +3 -5
  123. package/lib/module/utils/index.js.map +1 -1
  124. package/lib/typescript/MGLModule.d.ts +22 -0
  125. package/lib/typescript/MGLModule.d.ts.map +1 -0
  126. package/lib/typescript/Mapbox.d.ts +54 -0
  127. package/lib/typescript/Mapbox.d.ts.map +1 -0
  128. package/lib/typescript/components/Annotation.d.ts +34 -0
  129. package/lib/typescript/components/Annotation.d.ts.map +1 -0
  130. package/lib/typescript/components/ImageSource.d.ts +32 -0
  131. package/lib/typescript/components/ImageSource.d.ts.map +1 -0
  132. package/lib/typescript/components/Images.d.ts +24 -2
  133. package/lib/typescript/components/Images.d.ts.map +1 -1
  134. package/lib/typescript/components/MapView.d.ts +469 -0
  135. package/lib/typescript/components/MapView.d.ts.map +1 -0
  136. package/lib/typescript/components/MarkerView.d.ts +3 -2
  137. package/lib/typescript/components/MarkerView.d.ts.map +1 -1
  138. package/lib/typescript/components/NativeBridgeComponent.d.ts +1 -1
  139. package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -1
  140. package/lib/typescript/components/PointAnnotation.d.ts +10 -4
  141. package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
  142. package/lib/typescript/components/RasterDemSource.d.ts +46 -0
  143. package/lib/typescript/components/RasterDemSource.d.ts.map +1 -0
  144. package/lib/typescript/components/RasterSource.d.ts +59 -0
  145. package/lib/typescript/components/RasterSource.d.ts.map +1 -0
  146. package/lib/typescript/components/ShapeSource.d.ts +2 -2
  147. package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
  148. package/lib/typescript/components/Style.d.ts +74 -0
  149. package/lib/typescript/components/Style.d.ts.map +1 -0
  150. package/lib/typescript/components/Terrain.d.ts +2 -2
  151. package/lib/typescript/components/Terrain.d.ts.map +1 -1
  152. package/lib/typescript/components/UserLocation.d.ts +102 -0
  153. package/lib/typescript/components/UserLocation.d.ts.map +1 -0
  154. package/lib/typescript/components/VectorSource.d.ts +2 -2
  155. package/lib/typescript/components/VectorSource.d.ts.map +1 -1
  156. package/lib/typescript/index.d.ts +4 -0
  157. package/lib/typescript/index.d.ts.map +1 -0
  158. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts +22 -0
  159. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -0
  160. package/lib/typescript/modules/offline/OfflinePack.d.ts +24 -0
  161. package/lib/typescript/modules/offline/OfflinePack.d.ts.map +1 -0
  162. package/lib/typescript/modules/offline/offlineManager.d.ts +220 -0
  163. package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -0
  164. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts +41 -0
  165. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts.map +1 -0
  166. package/lib/typescript/modules/snapshot/snapshotManager.d.ts +52 -0
  167. package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -0
  168. package/lib/typescript/types/Position.d.ts +2 -0
  169. package/lib/typescript/types/Position.d.ts.map +1 -0
  170. package/lib/typescript/utils/Logger.d.ts +1 -1
  171. package/lib/typescript/utils/Logger.d.ts.map +1 -1
  172. package/lib/typescript/utils/animated/Animated.d.ts +23 -0
  173. package/lib/typescript/utils/animated/Animated.d.ts.map +1 -0
  174. package/lib/typescript/utils/geoUtils.d.ts +15 -0
  175. package/lib/typescript/utils/geoUtils.d.ts.map +1 -0
  176. package/lib/typescript/utils/index.d.ts +48 -0
  177. package/lib/typescript/utils/index.d.ts.map +1 -0
  178. package/package.json +4 -4
  179. package/index.d.ts +0 -745
  180. package/javascript/components/ImageSource.js +0 -82
  181. package/javascript/components/RasterDemSource.js +0 -106
  182. package/javascript/components/RasterSource.js +0 -124
  183. package/javascript/components/annotations/Annotation.js +0 -122
  184. package/javascript/index.js +0 -162
  185. package/javascript/utils/geoUtils.d.ts +0 -10
  186. package/javascript/utils/geoUtils.js +0 -73
  187. package/javascript/utils/index.d.ts +0 -27
  188. package/lib/commonjs/components/annotations/Annotation.js.map +0 -1
  189. package/lib/commonjs/utils/geoUtils.d.js +0 -2
  190. package/lib/commonjs/utils/geoUtils.d.js.map +0 -1
  191. package/lib/commonjs/utils/index.d.js +0 -2
  192. package/lib/module/components/annotations/Annotation.js.map +0 -1
  193. package/lib/module/utils/geoUtils.d.js +0 -2
  194. package/lib/module/utils/geoUtils.d.js.map +0 -1
  195. package/lib/module/utils/index.d.js +0 -2
  196. /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
package/index.d.ts DELETED
@@ -1,745 +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
- SkyLayerStyleProps,
24
- RasterLayerStyleProps,
25
- HeatmapLayerStyleProps,
26
- FillLayerStyleProps,
27
- LineLayerStyleProps,
28
- BackgroundLayerStyleProps,
29
- } from './javascript/utils/MapboxStyles';
30
- import { getAnnotationsLayerID as _getAnnotationsLayerID } from './javascript/utils/getAnnotationsLayerID';
31
- import {
32
- Camera as _Camera,
33
- CameraStop as _CameraStop,
34
- CameraFollowConfig as _CameraFollowConfig,
35
- CameraMinMaxConfig as _CameraMinMaxConfig,
36
- CameraBounds as _CameraBounds,
37
- CameraPadding as _CameraPadding,
38
- CameraBoundsWithPadding as _CameraBoundsWithPadding,
39
- CameraStops as _CameraStops,
40
- CameraAnimationMode as _CameraAnimationMode,
41
- type UserTrackingMode as _UserTrackingMode,
42
- type UserTrackingModeChangeCallback as _UserTrackingModeChangeCallback,
43
- } from './javascript/components/Camera';
44
- import _Images from './javascript/components/Images';
45
- import _Image from './javascript/components/Image';
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 { Props as _BackgroundLayerProps } from './javascript/components/BackgroundLayer';
57
- import { Props as _CircleLayerProps } from './javascript/components/CircleLayer';
58
- import { Props as _FillLayerProps } from './javascript/components/FillLayer';
59
- import { Props as _FillExtrusionLayerProps } from './javascript/components/FillExtrusionLayer';
60
- import { Props as _RasterLayerProps } from './javascript/components/RasterLayer';
61
- import { Props as _HeatmapLayerProps } from './javascript/components/HeatmapLayer';
62
- import { Props as _SkyLayerProps } from './javascript/components/SkyLayer';
63
- import {
64
- ShapeSource as _ShapeSource,
65
- Props as _ShapeSourceProps,
66
- } from './javascript/components/ShapeSource';
67
- import _VectorSource from './javascript/components/VectorSource';
68
- import _Light from './javascript/components/Light';
69
- import type {
70
- MapboxGLEvent as _MapboxGLEvent,
71
- AnimatedPoint as _AnimatedPoint,
72
- AnimatedShape as _AnimatedShape,
73
- } from './javascript/types/index';
74
- import type { requestAndroidLocationPermissions as _requestAndroidLocationPermissions } from './javascript/requestAndroidLocationPermissions';
75
- import type {
76
- Location as _Location,
77
- LocationManager,
78
- } from './javascript/modules/location/locationManager';
79
- import type { OnPressEvent as _OnPressEvent } from './javascript/types/OnPressEvent';
80
- import {
81
- type LogLevel,
82
- type LogObject,
83
- type LogCallback,
84
- Logger as _Logger,
85
- } from './javascript/utils/Logger';
86
-
87
- // prettier-ignore
88
- type ExpressionName =
89
- // Types
90
- | 'array' | 'boolean' | 'collator' | 'format' | 'image' | 'literal' | 'number' | 'number-format' | 'object' | 'string'
91
- | 'to-boolean' | 'to-color' | 'to-number' | 'to-string' | 'typeof'
92
- // Feature data
93
- | 'accumulated' | 'feature-state' | 'geometry-type' | 'id' | 'line-progress' | 'properties'
94
- // Lookup
95
- | 'at' | 'get' | 'has' | 'in' | 'index-of' | 'length' | 'slice'
96
- // Decision
97
- | '!' | '!=' | '<' | '<=' | '==' | '>' | '>=' | 'all' | 'any' | 'case' | 'match' | 'coalesce' | 'within'
98
- // Ramps, scales, curves
99
- | 'interpolate' | 'interpolate-hcl' | 'interpolate-lab' | 'step'
100
- // Variable binding
101
- | 'let' | 'var'
102
- // String
103
- | 'concat' | 'downcase' | 'is-supported-script' | 'resolved-locale' | 'upcase'
104
- // Color
105
- | 'rgb' | 'rgba' | 'to-rgba'
106
- // Math
107
- | '-' | '*' | '/' | '%' | '^' | '+' | 'abs' | 'acos' | 'asin' | 'atan' | 'ceil' | 'cos' | 'distance' | 'e'
108
- | 'floor' | 'ln' | 'ln2' | 'log10' | 'log2' | 'max' | 'min' | 'pi' | 'round' | 'sin' | 'sqrt' | 'tan'
109
- // Zoom, Heatmap
110
- | 'zoom' | 'heatmap-density';
111
-
112
- type ExpressionField =
113
- | string
114
- | number
115
- | boolean
116
- | Expression
117
- | ExpressionField[]
118
- | { [key: string]: ExpressionField };
119
-
120
- export type Expression = [ExpressionName, ...ExpressionField[]];
121
-
122
- type Anchor =
123
- | 'center'
124
- | 'left'
125
- | 'right'
126
- | 'top'
127
- | 'bottom'
128
- | 'top-left'
129
- | 'top-right'
130
- | 'bottom-left'
131
- | 'bottom-right';
132
- type Visibility = 'visible' | 'none';
133
- type Alignment = 'map' | 'viewport';
134
- type AutoAlignment = Alignment | 'auto';
135
-
136
- export type OnPressEvent = _OnPressEvent;
137
-
138
- declare namespace MapboxGL {
139
- function removeCustomHeader(headerName: string): void;
140
- function addCustomHeader(headerName: string, headerValue: string): void;
141
- function setAccessToken(accessToken: string | null): Promise<string | null>;
142
- function setWellKnownTileServer(tileServer: string): void;
143
- function getAccessToken(): Promise<string>;
144
- function setTelemetryEnabled(telemetryEnabled: boolean): void;
145
- function setConnected(connected: boolean): void;
146
-
147
- const requestAndroidLocationPermissions = _requestAndroidLocationPermissions;
148
-
149
- const getAnnotationsLayerID = _getAnnotationsLayerID;
150
- type getAnnotationsLayerID = _getAnnotationsLayerID;
151
-
152
- const Logger = _Logger;
153
- type Logger = _Logger;
154
- const Camera = _Camera;
155
- type Camera = _Camera;
156
- type CameraStop = _CameraStop;
157
- type CameraFollowConfig = _CameraFollowConfig;
158
- type CameraMinMaxConfig = _CameraMinMaxConfig;
159
- type CameraBounds = _CameraBounds;
160
- type CameraPadding = _CameraPadding;
161
- type CameraBoundsWithPadding = _CameraBoundsWithPadding;
162
- type CameraStops = _CameraStops;
163
- type CameraAnimationMode = _CameraAnimationMode;
164
-
165
- const Atmosphere = _Atmosphere;
166
- const MarkerView = _MarkerView;
167
- const PointAnnotation = _PointAnnotation;
168
- const SymbolLayer = _SymbolLayer;
169
- const LineLayer = _LineLayer;
170
- const ShapeSource = _ShapeSource;
171
- type ShapeSource = _ShapeSource;
172
-
173
- type MapboxGLEvent = _MapboxGLEvent;
174
- type UserTrackingMode = _UserTrackingMode;
175
- type UserTrackingModeChangeCallback = _UserTrackingModeChangeCallback;
176
- type Location = _Location;
177
-
178
- /** @deprecated This will be removed in a future release. Use `Location['coords']` instead. */
179
- type Coordinates = Location['coords'];
180
-
181
- const offlineManager: OfflineManager;
182
- const snapshotManager: SnapshotManager;
183
- const locationManager: LocationManager;
184
-
185
- /**
186
- * Classes
187
- */
188
- class AnimatedPoint {
189
- constructor(point?: _AnimatedPoint);
190
- longitude: ReactNative.Animated.Value;
191
- latitude: ReactNative.Animated.Value;
192
- setValue: (point: GeoJSON.Point) => void;
193
- setOffset: (point: GeoJSON.Point) => void;
194
- flattenOffset: () => void;
195
- stopAnimation: (cb?: () => GeoJSON.Point) => void;
196
- addListener: (cb?: () => GeoJSON.Point) => void;
197
- removeListener: (id: string) => void;
198
- spring: (
199
- config: Record<string, any>,
200
- ) => ReactNative.Animated.CompositeAnimation;
201
- timing: (
202
- config: Record<string, any>,
203
- ) => ReactNative.Animated.CompositeAnimation;
204
- }
205
- class AnimatedShape {
206
- constructor(shape: _AnimatedShape);
207
- }
208
-
209
- class _TileServers {
210
- Mapbox: string;
211
- MapLibre?: string;
212
- MapTiler?: string;
213
- }
214
- const TileServers: _TileServers;
215
-
216
- class _OfflinePackDownloadState {
217
- Inactive: string | number;
218
- Active: string | number;
219
- Complete: string | number;
220
- Unknown?: string | number;
221
- }
222
- const OfflinePackDownloadState: _OfflinePackDownloadState;
223
-
224
- /**
225
- * GeoUtils
226
- */
227
- interface UnitsOptions {
228
- units?: Units;
229
- }
230
-
231
- interface PositionsOptions {
232
- bbox?: BBox;
233
- id?: Id;
234
- }
235
-
236
- namespace geoUtils {
237
- function makePoint<P = Properties>(
238
- coordinates: Position,
239
- properties?: P,
240
- options?: PositionsOptions,
241
- ): Feature<GeoJSON.Point, P>;
242
- function makeLineString<P = Properties>(
243
- coordinates: Position[],
244
- properties?: P,
245
- options?: PositionsOptions,
246
- ): Feature<LineString, P>;
247
- function makeLatLngBounds<G = Geometry, P = Properties>(
248
- northEastCoordinates: Position[],
249
- southWestCoordinates: Position[],
250
- ): FeatureCollection<G, P>;
251
- function makeFeature<G = Geometry, P = Properties>(
252
- geometry: G,
253
- properties?: P,
254
- ): Feature<G, P>;
255
- function makeFeatureCollection<G = Geometry, P = Properties>(
256
- features: Array<Feature<G, P>>,
257
- options?: PositionsOptions,
258
- ): FeatureCollection<G, P>;
259
- function addToFeatureCollection<G = Geometry, P = Properties>(
260
- newFeatureCollection: Array<FeatureCollection<G, P>>,
261
- newFeature: Feature<G, P>,
262
- ): FeatureCollection<G, P>;
263
- function calculateDistance(
264
- origin: Coord,
265
- dest: Coord,
266
- options?: UnitsOptions,
267
- ): number;
268
- function pointAlongLine(
269
- newLineString: Feature<LineString> | LineString,
270
- distAlong: number,
271
- options?: UnitsOptions,
272
- ): Feature<GeoJSON.Point>;
273
- function getOrCalculateVisibleRegion(
274
- coord: { lon: number; lat: number },
275
- zoomLevel: number,
276
- width: number,
277
- height: number,
278
- nativeRegion: {
279
- properties: { visibleBounds: number[] };
280
- visibleBounds: number[];
281
- },
282
- ): void;
283
- }
284
-
285
- namespace Animated {
286
- // sources
287
- class ShapeSource extends Component<_ShapeSourceProps> {}
288
- class ImageSource extends Component<ImageSourceProps> {}
289
-
290
- // layers
291
- class FillLayer extends Component<_FillLayerProps> {}
292
- class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
293
- class LineLayer extends Component<_LineLayerProps> {}
294
- class CircleLayer extends Component<_CircleLayerProps> {}
295
- class SymbolLayer extends Component<_SymbolLayerProps> {}
296
- class RasterLayer extends Component<_RasterLayerProps> {}
297
- class BackgroundLayer extends Component<_BackgroundLayerProps> {}
298
- }
299
-
300
- /**
301
- * Components
302
- */
303
- export class MapView extends Component<MapViewProps> {
304
- getPointInView(coordinate: GeoJSON.Position): Promise<GeoJSON.Position>;
305
- getCoordinateFromView(point: GeoJSON.Position): Promise<GeoJSON.Position>;
306
- getVisibleBounds(): Promise<GeoJSON.Position[]>;
307
- queryRenderedFeaturesAtPoint(
308
- coordinate: GeoJSON.Position,
309
- filter?: Expression,
310
- layerIds?: Array<string>,
311
- ): Promise<GeoJSON.FeatureCollection | undefined>;
312
- queryRenderedFeaturesInRect(
313
- coordinate: GeoJSON.Position,
314
- filter?: Expression,
315
- layerIds?: Array<string>,
316
- ): Promise<GeoJSON.FeatureCollection | undefined>;
317
- takeSnap(writeToDisk?: boolean): Promise<string>;
318
- getZoom(): Promise<number>;
319
- getCenter(): Promise<GeoJSON.Position>;
320
- showAttribution(): void;
321
- setSourceVisibility(
322
- visible: boolean,
323
- sourceId: string,
324
- sourceLayerId?: string,
325
- ): void;
326
- }
327
-
328
- type Padding = number | [number, number] | [number, number, number, number];
329
-
330
- class UserLocation extends Component<UserLocationProps> {}
331
-
332
- const Light = _Light;
333
-
334
- class Callout extends Component<CalloutProps> {}
335
- type Style = FC<StyleProps>;
336
-
337
- /**
338
- * Sources
339
- */
340
- type VectorSource = typeof _VectorSource;
341
- const VectorSource = _VectorSource;
342
- class RasterSource extends Component<RasterSourceProps> {}
343
- class RasterDemSource extends Component<RasterSourceProps> {}
344
-
345
- /**
346
- * Layers
347
- */
348
- class BackgroundLayer extends Component<_BackgroundLayerProps> {}
349
- class CircleLayer extends Component<_CircleLayerProps> {}
350
- class FillExtrusionLayer extends Component<_FillExtrusionLayerProps> {}
351
- class FillLayer extends Component<_FillLayerProps> {}
352
- class LineLayer extends Component<_LineLayerProps> {}
353
- class RasterLayer extends Component<_RasterLayerProps> {}
354
- class HeatmapLayer extends Component<_HeatmapLayerProps> {}
355
- class ImageSource extends Component<ImageSourceProps> {}
356
- class SkyLayer extends Component<_SkyLayerProps> {}
357
-
358
- type Images = _Images;
359
- const Images = _Images;
360
- type Image = _Image;
361
- const Image = _Image;
362
-
363
- /**
364
- * Offline
365
- */
366
- class OfflineManager extends Component {
367
- clearAmbientCache(): Promise<void>;
368
- createPack(
369
- options: OfflineCreatePackOptions,
370
- progressListener?: (
371
- pack: OfflinePack,
372
- status: OfflineProgressStatus,
373
- ) => void,
374
- errorListener?: (pack: OfflinePack, err: OfflineProgressError) => void,
375
- ): Promise<void>;
376
- deletePack(name: string): Promise<void>;
377
- getPack(name: string): Promise<OfflinePack | undefined>;
378
- getPacks(): Promise<Array<OfflinePack>>;
379
- invalidateAmbientCache(): Promise<void>;
380
- invalidatePack(name: string): Promise<void>;
381
- migrateOfflineCache(): Promise<void>;
382
- resetDatabase(): Promise<void>;
383
- setMaximumAmbientCacheSize(size: number): Promise<void>;
384
- setProgressEventThrottle(throttleValue: number): void;
385
- setTileCountLimit(limit: number): void;
386
- subscribe(
387
- packName: string,
388
- progressListener: (pack: OfflinePack, status: object) => void,
389
- errorListener?: (pack: OfflinePack, err: object) => void,
390
- ): void;
391
- unsubscribe(packName: string): void;
392
- }
393
-
394
- class SnapshotManager {
395
- static takeSnap(options: SnapshotOptions): Promise<string>;
396
- }
397
-
398
- interface OfflineProgressStatus {
399
- name: string;
400
- state: number;
401
- percentage: number;
402
- completedResourceSize: number;
403
- completedTileCount: number;
404
- completedResourceCount: number;
405
- requiredResourceCount: number;
406
- completedTileSize: number;
407
- }
408
-
409
- interface OfflineProgressError {
410
- message: string;
411
- name: string;
412
- }
413
-
414
- interface OfflinePack {
415
- name: string;
416
- bounds: [GeoJSON.Position, GeoJSON.Position];
417
- metadata: any;
418
- status: () => Promise<OfflinePackStatus>;
419
- resume: () => Promise<void>;
420
- pause: () => Promise<void>;
421
- }
422
-
423
- interface OfflinePackStatus {
424
- name: string;
425
- state: number;
426
- percentage: number;
427
- completedResourceCount: number;
428
- completedResourceSize: number;
429
- completedTileSize: number;
430
- completedTileCount: number;
431
- requiredResourceCount: number;
432
- }
433
-
434
- /**
435
- * Constants
436
- */
437
-
438
- enum InterpolationMode {
439
- Exponential = 0,
440
- Categorical = 1,
441
- Interval = 2,
442
- Identity = 3,
443
- }
444
-
445
- enum StyleURL {
446
- Street = 'mapbox://styles/mapbox/streets-v11',
447
- Dark = 'mapbox://styles/mapbox/dark-v10',
448
- Light = 'mapbox://styles/mapbox/light-v10',
449
- Outdoors = 'mapbox://styles/mapbox/outdoors-v11',
450
- Satellite = 'mapbox://styles/mapbox/satellite-v9',
451
- SatelliteStreet = 'mapbox://styles/mapbox/satellite-streets-v11',
452
- TrafficDay = 'mapbox://styles/mapbox/navigation-preview-day-v4',
453
- TrafficNight = 'mapbox://styles/mapbox/navigation-preview-night-v4',
454
- }
455
- }
456
-
457
- export type OrnamentPosition =
458
- | { top: number; left: number }
459
- | { top: number; right: number }
460
- | { bottom: number; left: number }
461
- | { bottom: number; right: number };
462
-
463
- export interface RegionPayload {
464
- zoomLevel: number;
465
- heading: number;
466
- animated: boolean;
467
- isUserInteraction: boolean;
468
- visibleBounds: GeoJSON.Position[];
469
- pitch: number;
470
- }
471
-
472
- /**
473
- * v10 only - experimental
474
- */
475
- export interface MapState {
476
- properties: {
477
- center: GeoJSON.Position;
478
- bounds: {
479
- ne: GeoJSON.Position;
480
- sw: GeoJSON.Position;
481
- };
482
- zoom: number;
483
- heading: number;
484
- pitch: number;
485
- };
486
- gestures: {
487
- isGestureActive: boolean;
488
- isAnimatingFromGesture: boolean;
489
- };
490
- }
491
-
492
- export interface MapViewProps extends ViewProps {
493
- animated?: boolean;
494
- userTrackingMode?: MapboxGL.UserTrackingModes;
495
- contentInset?: Array<number>;
496
- projection?: 'mercator' | 'globe';
497
- style?: StyleProp<ViewStyle>;
498
- styleURL?: string;
499
- styleJSON?: string;
500
- preferredFramesPerSecond?: number;
501
- localizeLabels?: boolean;
502
- zoomEnabled?: boolean;
503
- scrollEnabled?: boolean;
504
- pitchEnabled?: boolean;
505
- rotateEnabled?: boolean;
506
- attributionEnabled?: boolean;
507
- attributionPosition?: OrnamentPosition;
508
- logoEnabled?: boolean;
509
- logoPosition?: OrnamentPosition;
510
- compassEnabled?: boolean;
511
- compassFadeWhenNorth?: boolean;
512
- compassPosition?: OrnamentPosition;
513
- compassViewPosition?: number;
514
- compassViewMargins?: Point;
515
- compassImage?: string;
516
- scaleBarEnabled?: boolean;
517
- scaleBarPosition?: OrnamentPosition;
518
- surfaceView?: boolean;
519
- regionWillChangeDebounceTime?: number;
520
- regionDidChangeDebounceTime?: number;
521
- tintColor?: string;
522
-
523
- onPress?: (feature: GeoJSON.Feature) => void;
524
- onLongPress?: (feature: GeoJSON.Feature) => void;
525
- onRegionWillChange?: (
526
- feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
527
- ) => void;
528
- onRegionIsChanging?: (
529
- feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
530
- ) => void;
531
- onRegionDidChange?: (
532
- feature: GeoJSON.Feature<GeoJSON.Point, RegionPayload>,
533
- ) => void;
534
- onCameraChanged?: (state: MapState) => void;
535
- onMapIdle?: (state: MapState) => void;
536
- onUserLocationUpdate?: (feature: Location) => void;
537
- onWillStartLoadingMap?: () => void;
538
- onDidFinishLoadingMap?: () => void;
539
- onDidFailLoadingMap?: () => void;
540
- onWillStartRenderingFrame?: () => void;
541
- onDidFinishRenderingFrame?: () => void;
542
- onDidFinishRenderingFrameFully?: () => void;
543
- onWillStartRenderingMap?: () => void;
544
- onDidFinishRenderingMap?: () => void;
545
- onDidFinishRenderingMapFully?: () => void;
546
- onDidFinishLoadingStyle?: () => void;
547
- onUserTrackingModeChange?: () => void;
548
- }
549
-
550
- export interface UserLocationProps {
551
- androidRenderMode?: 'normal' | 'compass' | 'gps';
552
- animated?: boolean;
553
- children?: ReactNode;
554
- minDisplacement?: number;
555
- requestsAlwaysUse?: boolean;
556
- onPress?: () => void;
557
- onUpdate?: (location: Location) => void;
558
- renderMode?: 'normal' | 'native';
559
- showsUserHeadingIndicator?: boolean;
560
- visible?: boolean;
561
- }
562
-
563
- export type WithExpression<T> = {
564
- [P in keyof T]: T[P] | Expression;
565
- };
566
-
567
- export interface LightStyle {
568
- anchor?: Alignment | Expression;
569
- position?: GeoJSON.Position | Expression;
570
- positionTransition?: Transition | Expression;
571
- color?: string | Expression;
572
- colorTransition?: Transition | Expression;
573
- intensity?: number | Expression;
574
- intensityTransition?: Transition | Expression;
575
- }
576
-
577
- export interface Transition {
578
- duration: number;
579
- delay: number;
580
- }
581
-
582
- export type BackgroundLayerStyle = BackgroundLayerStyleProps;
583
-
584
- export type CircleLayerStyle = CircleLayerStyleProps;
585
-
586
- export type FillExtrusionLayerStyle = FillExtrusionLayerStyleProps;
587
-
588
- export type FillLayerStyle = FillLayerStyleProps;
589
-
590
- export type SkyLayerStyle = SkyLayerStyleProps;
591
-
592
- export type LineLayerStyle = LineLayerStyleProps;
593
-
594
- export type RasterLayerStyle = RasterLayerStyleProps;
595
-
596
- export type TextVariableAnchorValues =
597
- | 'center'
598
- | 'left'
599
- | 'right'
600
- | 'top'
601
- | 'bottom'
602
- | 'top-left'
603
- | 'top-right'
604
- | 'bottom-left'
605
- | 'bottom-right';
606
-
607
- export type SymbolLayerStyle = SymbolLayerStyleProps;
608
- export type LineLayerStyle = LineLayerStyleProps;
609
-
610
- export type HeatmapLayerStyle = HeatmapLayerStyleProps;
611
-
612
- export interface Point {
613
- x: number;
614
- y: number;
615
- }
616
-
617
- export interface LightProps extends Omit<ViewProps, 'style'> {
618
- style?: LightStyle;
619
- }
620
-
621
- export interface StyleProps {
622
- json: any;
623
- }
624
-
625
- export interface CalloutProps extends Omit<ViewProps, 'style'> {
626
- title?: string;
627
- style?: StyleProp<WithExpression<ViewStyle>>;
628
- containerStyle?: StyleProp<WithExpression<ViewStyle>>;
629
- contentStyle?: StyleProp<WithExpression<ViewStyle>>;
630
- tipStyle?: StyleProp<WithExpression<ViewStyle>>;
631
- textStyle?: StyleProp<WithExpression<TextStyle>>;
632
- }
633
-
634
- export interface TileSourceProps extends ViewProps {
635
- id: string;
636
- url?: string;
637
- tileUrlTemplates?: Array<string>;
638
- minZoomLevel?: number;
639
- maxZoomLevel?: number;
640
- }
641
-
642
- export interface RasterSourceProps extends TileSourceProps {
643
- tileSize?: number;
644
- }
645
-
646
- export interface LayerBaseProps<T = object> extends Omit<ViewProps, 'style'> {
647
- id: string;
648
- sourceID?: string;
649
- sourceLayerID?: string;
650
- aboveLayerID?: string;
651
- belowLayerID?: string;
652
- layerIndex?: number;
653
- filter?: Expression;
654
- minZoomLevel?: number;
655
- maxZoomLevel?: number;
656
- }
657
-
658
- export interface ImageSourceProps extends ViewProps {
659
- id: string;
660
- url?: number | string;
661
- coordinates: [
662
- GeoJSON.Position,
663
- GeoJSON.Position,
664
- GeoJSON.Position,
665
- GeoJSON.Position,
666
- ];
667
- }
668
-
669
- export interface OfflineCreatePackOptions {
670
- name?: string;
671
- styleURL?: string;
672
- bounds?: [GeoJSON.Position, GeoJSON.Position];
673
- minZoom?: number;
674
- maxZoom?: number;
675
- metadata?: any;
676
- }
677
-
678
- export interface SnapshotOptions {
679
- centerCoordinate?: GeoJSON.Position;
680
- width?: number;
681
- height?: number;
682
- zoomLevel?: number;
683
- pitch?: number;
684
- heading?: number;
685
- styleURL?: string;
686
- writeToDisk?: boolean;
687
- }
688
-
689
- export interface SkyLayerProps extends LayerBaseProps {
690
- id: string;
691
- style?: StyleProp<SkyLayerStyle>;
692
- }
693
-
694
- export import Logger = MapboxGL.Logger;
695
-
696
- export import MapView = MapboxGL.MapView;
697
-
698
- export import Camera = MapboxGL.Camera;
699
- export import CameraStop = MapboxGL.CameraStop;
700
- export import CameraFollowConfig = MapboxGL.CameraFollowConfig;
701
- export import CameraMinMaxConfig = MapboxGL.CameraMinMaxConfig;
702
- export import CameraBounds = MapboxGL.CameraBounds;
703
- export import CameraPadding = MapboxGL.CameraPadding;
704
- export import CameraBoundsWithPadding = MapboxGL.CameraBoundsWithPadding;
705
- export import CameraStops = MapboxGL.CameraStops;
706
- export import CameraAnimationMode = MapboxGL.CameraAnimationMode;
707
-
708
- export import Atmosphere = MapboxGL.Atmosphere;
709
- export import Terrain = MapboxGL.Terrain;
710
- export import RasterDemSource = MapboxGL.RasterDemSource;
711
- export import ShapeSource = MapboxGL.ShapeSource;
712
- export import FillLayer = MapboxGL.FillLayer;
713
- export import FillExtrusionLayer = MapboxGL.FillExtrusionLayer;
714
- export import HeatmapLayer = MapboxGL.HeatmapLayer;
715
- export import LineLayer = MapboxGL.LineLayer;
716
- export import CircleLayer = MapboxGL.CircleLayer;
717
- export import SkyLayer = MapboxGL.SkyLayer;
718
- export import SymbolLayer = MapboxGL.SymbolLayer;
719
- export import RasterLayer = MapboxGL.RasterLayer;
720
- export import BackgroundLayer = MapboxGL.BackgroundLayer;
721
- export import MarkerView = MapboxGL.MarkerView;
722
- export import PointAnnotation = MapboxGL.PointAnnotation;
723
- export import Callout = MapboxGL.Callout;
724
-
725
- export import Location = MapboxGL.Location;
726
- /** @deprecated This will be removed in a future release. Use `Location['coords']` instead. */
727
- export import Coordinates = MapboxGL.Coordinates;
728
-
729
- export import MapboxGLEvent = MapboxGL.MapboxGLEvent;
730
- export import UserTrackingMode = MapboxGL.UserTrackingMode;
731
- export import UserTrackingModeChangeCallback = MapboxGL.UserTrackingModeChangeCallback;
732
- export import AnimatedPoint = MapboxGL.AnimatedPoint;
733
- /** @deprecated This will be removed in a future release. Use `AnimatedPoint` instead. */
734
- export import AnimatedMapPoint = MapboxGL.AnimatedPoint;
735
- export import AnimatedShape = MapboxGL.AnimatedShape;
736
- export import Images = MapboxGL.Images;
737
- export import Image = MapboxGL.Image;
738
- export import Light = MapboxGL.Light;
739
- export import VectorSource = MapboxGL.VectorSource;
740
-
741
- export const { offlineManager } = MapboxGL;
742
-
743
- export const { getAnnotationsLayerID } = MapboxGL;
744
-
745
- export default MapboxGL;