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