@rnmapbox/maps 10.0.0-beta.73 → 10.0.0-beta.75
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.
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +61 -46
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/LocationComponentManager.kt +4 -2
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +7 -2
- package/index.d.ts +46 -328
- package/javascript/components/AbstractLayer.tsx +2 -1
- package/javascript/components/AbstractSource.tsx +3 -1
- package/javascript/components/Atmosphere.tsx +2 -1
- package/javascript/components/Camera.tsx +6 -4
- package/javascript/components/ImageSource.tsx +81 -0
- package/javascript/components/Images.tsx +1 -1
- package/javascript/components/Light.tsx +60 -0
- package/javascript/components/{MapView.js → MapView.tsx} +456 -383
- package/javascript/components/NativeBridgeComponent.tsx +1 -1
- package/javascript/components/PointAnnotation.tsx +2 -1
- package/javascript/components/RasterDemSource.tsx +105 -0
- package/javascript/components/RasterSource.tsx +124 -0
- package/javascript/components/ShapeSource.tsx +1 -11
- package/javascript/components/Terrain.tsx +2 -1
- package/javascript/components/VectorSource.tsx +209 -0
- package/javascript/modules/location/locationManager.ts +1 -1
- package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +21 -6
- package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +19 -4
- package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +77 -21
- package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +27 -3
- package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +1 -1
- package/javascript/types/BaseProps.ts +3 -0
- package/javascript/types/OnPressEvent.ts +11 -0
- package/javascript/utils/{Logger.js → Logger.ts} +32 -14
- package/javascript/utils/MapboxStyles.d.ts +1 -1
- package/javascript/utils/deprecation.ts +3 -3
- package/javascript/utils/geoUtils.ts +91 -0
- package/javascript/utils/{index.js → index.ts} +41 -19
- package/javascript/utils/nativeRef.ts +28 -0
- package/lib/commonjs/components/AbstractLayer.js.map +1 -1
- package/lib/commonjs/components/AbstractSource.js.map +1 -1
- package/lib/commonjs/components/Atmosphere.js.map +1 -1
- package/lib/commonjs/components/Camera.js +4 -4
- package/lib/commonjs/components/Camera.js.map +1 -1
- package/lib/commonjs/components/ImageSource.js +8 -25
- package/lib/commonjs/components/ImageSource.js.map +1 -1
- package/lib/commonjs/components/Images.js +1 -1
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/Light.js +32 -33
- package/lib/commonjs/components/Light.js.map +1 -1
- package/lib/commonjs/components/MapView.js +30 -289
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
- package/lib/commonjs/components/PointAnnotation.js.map +1 -1
- package/lib/commonjs/components/RasterDemSource.js +3 -37
- package/lib/commonjs/components/RasterDemSource.js.map +1 -1
- package/lib/commonjs/components/RasterSource.js +2 -46
- package/lib/commonjs/components/RasterSource.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/Terrain.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +15 -74
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/modules/location/locationManager.js +2 -1
- package/lib/commonjs/modules/location/locationManager.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -4
- package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
- package/lib/commonjs/modules/offline/offlineManager.js +1 -2
- package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/commonjs/types/BaseProps.js +2 -0
- package/lib/commonjs/{utils/index.d.js.map → types/BaseProps.js.map} +1 -1
- package/lib/commonjs/types/OnPressEvent.js +2 -0
- package/lib/commonjs/{utils/geoUtils.d.js.map → types/OnPressEvent.js.map} +1 -1
- package/lib/commonjs/utils/Logger.js +7 -7
- package/lib/commonjs/utils/Logger.js.map +1 -1
- package/lib/commonjs/utils/deprecation.js +2 -2
- package/lib/commonjs/utils/geoUtils.js +15 -23
- package/lib/commonjs/utils/geoUtils.js.map +1 -1
- package/lib/commonjs/utils/index.js +3 -6
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/nativeRef.js +27 -0
- package/lib/commonjs/utils/nativeRef.js.map +1 -0
- package/lib/module/components/AbstractLayer.js.map +1 -1
- package/lib/module/components/AbstractSource.js.map +1 -1
- package/lib/module/components/Atmosphere.js.map +1 -1
- package/lib/module/components/Camera.js +4 -4
- package/lib/module/components/Camera.js.map +1 -1
- package/lib/module/components/ImageSource.js +8 -25
- package/lib/module/components/ImageSource.js.map +1 -1
- package/lib/module/components/Images.js +1 -1
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/Light.js +29 -32
- package/lib/module/components/Light.js.map +1 -1
- package/lib/module/components/MapView.js +31 -290
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/NativeBridgeComponent.js.map +1 -1
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterDemSource.js +4 -38
- package/lib/module/components/RasterDemSource.js.map +1 -1
- package/lib/module/components/RasterSource.js +3 -47
- package/lib/module/components/RasterSource.js.map +1 -1
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/Terrain.js.map +1 -1
- package/lib/module/components/VectorSource.js +15 -74
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/modules/location/locationManager.js +1 -1
- package/lib/module/modules/location/locationManager.js.map +1 -1
- package/lib/module/modules/offline/OfflineCreatePackOptions.js +2 -4
- package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
- package/lib/module/modules/offline/OfflinePack.js.map +1 -1
- package/lib/module/modules/offline/offlineManager.js +0 -1
- package/lib/module/modules/offline/offlineManager.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
- package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
- package/lib/module/types/BaseProps.js +2 -0
- package/lib/module/{utils/index.d.js.map → types/BaseProps.js.map} +1 -1
- package/lib/module/types/OnPressEvent.js +2 -0
- package/lib/module/{utils/geoUtils.d.js.map → types/OnPressEvent.js.map} +1 -1
- package/lib/module/utils/Logger.js +7 -7
- package/lib/module/utils/Logger.js.map +1 -1
- package/lib/module/utils/deprecation.js +2 -2
- package/lib/module/utils/geoUtils.js +7 -18
- package/lib/module/utils/geoUtils.js.map +1 -1
- package/lib/module/utils/index.js +3 -5
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/nativeRef.js +21 -0
- package/lib/module/utils/nativeRef.js.map +1 -0
- package/lib/typescript/components/AbstractLayer.d.ts +2 -1
- package/lib/typescript/components/AbstractLayer.d.ts.map +1 -1
- package/lib/typescript/components/AbstractSource.d.ts +2 -1
- package/lib/typescript/components/AbstractSource.d.ts.map +1 -1
- package/lib/typescript/components/Atmosphere.d.ts +2 -1
- package/lib/typescript/components/Atmosphere.d.ts.map +1 -1
- package/lib/typescript/components/Camera.d.ts.map +1 -1
- package/lib/typescript/components/ImageSource.d.ts +32 -0
- package/lib/typescript/components/ImageSource.d.ts.map +1 -0
- package/lib/typescript/components/Images.d.ts +1 -1
- package/lib/typescript/components/Images.d.ts.map +1 -1
- package/lib/typescript/components/Light.d.ts +17 -0
- package/lib/typescript/components/Light.d.ts.map +1 -0
- package/lib/typescript/components/MapView.d.ts +472 -0
- package/lib/typescript/components/MapView.d.ts.map +1 -0
- package/lib/typescript/components/NativeBridgeComponent.d.ts +1 -1
- package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -1
- package/lib/typescript/components/PointAnnotation.d.ts +3 -2
- package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/components/RasterDemSource.d.ts +46 -0
- package/lib/typescript/components/RasterDemSource.d.ts.map +1 -0
- package/lib/typescript/components/RasterSource.d.ts +59 -0
- package/lib/typescript/components/RasterSource.d.ts.map +1 -0
- package/lib/typescript/components/ShapeSource.d.ts +4 -14
- package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/components/Terrain.d.ts +2 -1
- package/lib/typescript/components/Terrain.d.ts.map +1 -1
- package/lib/typescript/components/VectorSource.d.ts +144 -0
- package/lib/typescript/components/VectorSource.d.ts.map +1 -0
- package/lib/typescript/modules/location/locationManager.d.ts +1 -1
- package/lib/typescript/modules/location/locationManager.d.ts.map +1 -1
- package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts +22 -0
- package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -0
- package/lib/typescript/modules/offline/OfflinePack.d.ts +24 -0
- package/lib/typescript/modules/offline/OfflinePack.d.ts.map +1 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts +219 -0
- package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -0
- package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts +41 -0
- package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts.map +1 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts +51 -0
- package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -0
- package/lib/typescript/types/BaseProps.d.ts +4 -0
- package/lib/typescript/types/BaseProps.d.ts.map +1 -0
- package/lib/typescript/types/OnPressEvent.d.ts +12 -0
- package/lib/typescript/types/OnPressEvent.d.ts.map +1 -0
- package/lib/typescript/utils/Logger.d.ts +53 -0
- package/lib/typescript/utils/Logger.d.ts.map +1 -0
- package/lib/typescript/utils/deprecation.d.ts +4 -3
- package/lib/typescript/utils/deprecation.d.ts.map +1 -1
- package/lib/typescript/utils/geoUtils.d.ts +23 -0
- package/lib/typescript/utils/geoUtils.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +48 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/lib/typescript/utils/nativeRef.d.ts +21 -0
- package/lib/typescript/utils/nativeRef.d.ts.map +1 -0
- package/package.json +3 -1
- package/javascript/components/ImageSource.js +0 -82
- package/javascript/components/Light.js +0 -47
- package/javascript/components/RasterDemSource.js +0 -106
- package/javascript/components/RasterSource.js +0 -124
- package/javascript/components/VectorSource.js +0 -203
- package/javascript/utils/geoUtils.d.ts +0 -10
- package/javascript/utils/geoUtils.js +0 -73
- package/javascript/utils/index.d.ts +0 -27
- package/lib/commonjs/utils/geoUtils.d.js +0 -2
- package/lib/commonjs/utils/index.d.js +0 -2
- package/lib/module/utils/geoUtils.d.js +0 -2
- package/lib/module/utils/index.d.js +0 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { EmitterSubscription, NativeEventEmitter } from 'react-native';
|
|
2
|
+
declare type LogLevel = 'error' | 'warning' | 'info' | 'debug' | 'verbose';
|
|
3
|
+
export interface LogObject {
|
|
4
|
+
level: LogLevel;
|
|
5
|
+
message: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
}
|
|
8
|
+
declare type LogCallback = (object: LogObject) => boolean;
|
|
9
|
+
declare class Logger {
|
|
10
|
+
static instance: Logger | null;
|
|
11
|
+
loggerEmitter: NativeEventEmitter;
|
|
12
|
+
startedCount: number;
|
|
13
|
+
logCallback?: LogCallback;
|
|
14
|
+
subscription?: EmitterSubscription;
|
|
15
|
+
static sharedInstance(): Logger;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Set custom logger function.
|
|
19
|
+
* @param {Logger~logCallback} logCallback - callback taking a log object as param. If callback return falsy value then
|
|
20
|
+
* default logging will take place.
|
|
21
|
+
*/
|
|
22
|
+
static setLogCallback(logCallback: LogCallback): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set custom logger function.
|
|
25
|
+
* @param {Logger~logCallback} logCallback - callback taking a log object as param. If callback return falsy value then
|
|
26
|
+
* default logging will take place.
|
|
27
|
+
*/
|
|
28
|
+
setLogCallback(logCallback: LogCallback): void;
|
|
29
|
+
/**
|
|
30
|
+
* This callback is displayed as part of the Requester class.
|
|
31
|
+
* @callback Logger~logCallback
|
|
32
|
+
* @param {object} log
|
|
33
|
+
* @param {string} log.message - the message of the log
|
|
34
|
+
* @param {string} log.level - log level
|
|
35
|
+
* @param {string} log.tag - optional tag used on android
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* setLogLevel
|
|
39
|
+
* @param {LogLevel} level
|
|
40
|
+
*/
|
|
41
|
+
static setLogLevel(level: LogLevel): void;
|
|
42
|
+
/**
|
|
43
|
+
* @type {('error'|'warning'|'info'|'debug'|'verbose')} LogLevel - Supported log levels
|
|
44
|
+
*/
|
|
45
|
+
start(): void;
|
|
46
|
+
stop(): void;
|
|
47
|
+
subscribe(): void;
|
|
48
|
+
unsubscribe(): void;
|
|
49
|
+
effectiveLevel(log: LogObject): LogLevel;
|
|
50
|
+
onLog(log: LogObject): void;
|
|
51
|
+
}
|
|
52
|
+
export default Logger;
|
|
53
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../javascript/utils/Logger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAGtB,aAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,aAAK,WAAW,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC;AAElD,cAAM,MAAM;IACV,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEtC,aAAa,EAAE,kBAAkB,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC,MAAM,CAAC,cAAc;;IAarB;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW;IAI9C;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW;IAIvC;;;;;;;OAOG;IAEH;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ;IAIlC;;OAEG;IACH,KAAK;IAOL,IAAI;IAOJ,SAAS;IAMT,WAAW;IAKX,cAAc,CAAC,GAAG,EAAE,SAAS;IAe7B,KAAK,CAAC,GAAG,EAAE,SAAS;CAarB;AAID,eAAe,MAAM,CAAC"}
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare function deprecatedClass<C extends new (...args: any[]) => object>(origClass: C, deprecationMessage: string): C;
|
|
5
5
|
/**
|
|
6
|
-
* Copy properties from origObject to newObject, which not exists in newObject
|
|
7
|
-
*
|
|
6
|
+
* Copy properties from origObject to newObject, but only those which not exists in newObject.
|
|
7
|
+
* Calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
8
8
|
*/
|
|
9
|
-
export declare function copyPropertiesAsDeprecated<DeprecatedType extends
|
|
9
|
+
export declare function copyPropertiesAsDeprecated<DeprecatedType extends object, // Record<string, unknown>,
|
|
10
|
+
WithDeprecatedType extends Record<string, unknown>>(origObject: DeprecatedType, newObject: WithDeprecatedType, onDeprecatedCalled: (key: string) => void, accessors?: {
|
|
10
11
|
[key: string]: (value: unknown) => unknown;
|
|
11
12
|
}): WithDeprecatedType;
|
|
12
13
|
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../javascript/utils/deprecation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,EACtE,SAAS,EAAE,CAAC,EACZ,kBAAkB,EAAE,MAAM,GACzB,CAAC,CAQH;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../javascript/utils/deprecation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,EACtE,SAAS,EAAE,CAAC,EACZ,kBAAkB,EAAE,MAAM,GACzB,CAAC,CAQH;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,SAAS,MAAM,EAAE,2BAA2B;AAC1D,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAElD,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,kBAAkB,EAC7B,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACzC,SAAS,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAA;CAAO,GAC7D,kBAAkB,CAapB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { point, feature, lineString, Position, Properties, Id, BBox, FeatureCollection, Geometry, Point, Feature } from '@turf/helpers';
|
|
2
|
+
import distance from '@turf/distance';
|
|
3
|
+
import along from '@turf/along';
|
|
4
|
+
export declare const makePoint: typeof point;
|
|
5
|
+
export declare const makeLineString: typeof lineString;
|
|
6
|
+
export declare function makeLatLngBounds(northEastCoordinates: Position, southWestCoordinates: Position): FeatureCollection<Point>;
|
|
7
|
+
export declare const makeFeature: typeof feature;
|
|
8
|
+
export declare function makeFeatureCollection<G = Geometry, P = Properties>(features?: Array<Feature<G, P>>, options?: {
|
|
9
|
+
bbox?: BBox;
|
|
10
|
+
id?: Id;
|
|
11
|
+
}): FeatureCollection<G, P>;
|
|
12
|
+
export declare function addToFeatureCollection(newFeatureCollection: FeatureCollection, newFeature: Feature): FeatureCollection;
|
|
13
|
+
export declare const calculateDistance: typeof distance;
|
|
14
|
+
export declare const pointAlongLine: typeof along;
|
|
15
|
+
export declare function getOrCalculateVisibleRegion(coord: [number, number], zoomLevel: number, width: number, height: number, nativeRegion: {
|
|
16
|
+
properties: {
|
|
17
|
+
visibleBounds: number[][];
|
|
18
|
+
};
|
|
19
|
+
}): {
|
|
20
|
+
ne: number[];
|
|
21
|
+
sw: number[];
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=geoUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geoUtils.d.ts","sourceRoot":"","sources":["../../../javascript/utils/geoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,UAAU,EACV,EAAE,EACF,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,KAAK,EACL,OAAO,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,MAAM,aAAa,CAAC;AAKhC,eAAO,MAAM,SAAS,cAAQ,CAAC;AAE/B,eAAO,MAAM,cAAc,mBAAa,CAAC;AAEzC,wBAAgB,gBAAgB,CAC9B,oBAAoB,EAAE,QAAQ,EAC9B,oBAAoB,EAAE,QAAQ,GAC7B,iBAAiB,CAAC,KAAK,CAAC,CAK1B;AAED,eAAO,MAAM,WAAW,gBAAU,CAAC;AAEnC,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,UAAU,EAChE,QAAQ,GAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAM,EACnC,OAAO,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,EAAE,CAAC;CACT,2BAGF;AAED,wBAAgB,sBAAsB,CACpC,oBAAoB,EAAE,iBAAiB,EACvC,UAAU,EAAE,OAAO,GAClB,iBAAiB,CAKnB;AAED,eAAO,MAAM,iBAAiB,iBAAW,CAAC;AAE1C,eAAO,MAAM,cAAc,cAAQ,CAAC;AAEpC,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE;IACZ,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;KAC3B,CAAC;CACH;;;EAqBF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ImageSourcePropType } from 'react-native';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
export declare const ornamentPositionPropType: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
5
|
+
top: PropTypes.Requireable<number>;
|
|
6
|
+
left: PropTypes.Requireable<number>;
|
|
7
|
+
}> | PropTypes.InferProps<{
|
|
8
|
+
top: PropTypes.Requireable<number>;
|
|
9
|
+
right: PropTypes.Requireable<number>;
|
|
10
|
+
}> | PropTypes.InferProps<{
|
|
11
|
+
bottom: PropTypes.Requireable<number>;
|
|
12
|
+
left: PropTypes.Requireable<number>;
|
|
13
|
+
}> | PropTypes.InferProps<{
|
|
14
|
+
bottom: PropTypes.Requireable<number>;
|
|
15
|
+
right: PropTypes.Requireable<number>;
|
|
16
|
+
}> | null | undefined>>;
|
|
17
|
+
export declare function isAndroid(): boolean;
|
|
18
|
+
export declare function existenceChange(cur: boolean, next: boolean): boolean;
|
|
19
|
+
export declare function isFunction(fn: unknown): fn is boolean;
|
|
20
|
+
export declare function isNumber(num: unknown): num is number;
|
|
21
|
+
export declare function isUndefined(obj: unknown): obj is undefined;
|
|
22
|
+
export declare function isString(str: unknown): str is string;
|
|
23
|
+
export declare function isBoolean(bool: unknown): bool is boolean;
|
|
24
|
+
export declare function isPrimitive(value: unknown): value is string | number | boolean;
|
|
25
|
+
export declare type NativeArg = string | number | boolean | null | {
|
|
26
|
+
[k: string]: NativeArg;
|
|
27
|
+
} | NativeArg[];
|
|
28
|
+
export declare function runNativeCommand<ReturnType = NativeArg>(module: string, name: string, nativeRef: any, args: NativeArg[]): Promise<ReturnType>;
|
|
29
|
+
export declare function cloneReactChildrenWithProps(children: Parameters<typeof React.Children.map>[0], propsToAdd?: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
}): any;
|
|
32
|
+
export declare function resolveImagePath(imageRef: ImageSourcePropType): string;
|
|
33
|
+
export declare function getIOSModuleName(moduleName: string): string;
|
|
34
|
+
export declare function toJSONString(json?: any): string;
|
|
35
|
+
export declare type OrnamentPositonProp = {
|
|
36
|
+
top: number;
|
|
37
|
+
left: number;
|
|
38
|
+
} | {
|
|
39
|
+
top: number;
|
|
40
|
+
right: number;
|
|
41
|
+
} | {
|
|
42
|
+
bottom: number;
|
|
43
|
+
left: number;
|
|
44
|
+
} | {
|
|
45
|
+
bottom: number;
|
|
46
|
+
right: number;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../javascript/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAKL,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,SAAS,MAAM,YAAY,CAAC;AAcnC,eAAO,MAAM,wBAAwB;;;;;;;;;;;;uBAKnC,CAAC;AAEH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAKpE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,OAAO,CAErD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAEpD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,CAE1D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAEpD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAExD;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,CAEpC;AAED,oBAAY,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC1B,SAAS,EAAE,CAAC;AAEhB,wBAAgB,gBAAgB,CAAC,UAAU,GAAG,SAAS,EACrD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,GAAG,EACd,IAAI,EAAE,SAAS,EAAE,GAChB,OAAO,CAAC,UAAU,CAAC,CA0BrB;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAClD,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAO,OAkB3C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAGtE;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED,wBAAgB,YAAY,CAAC,IAAI,GAAE,GAAQ,UAE1C;AAED,oBAAY,mBAAmB,GAC3B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RefObject, type Component, type MutableRefObject } from 'react';
|
|
2
|
+
import { type NativeMethods, type HostComponent } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Helper for useRef and requireNativeComponent:
|
|
5
|
+
* @example
|
|
6
|
+
* RCTMGLCamera = requireNativeComponent<NativeProps>('RCTMGLCamera');
|
|
7
|
+
* const ref = useRef<typeof RCTMGLCamera)(null) as NativeRefType<NativeProps>;
|
|
8
|
+
* ...
|
|
9
|
+
* <RCTMGLCamera ref={ref} ... />
|
|
10
|
+
*/
|
|
11
|
+
export declare type NativeRefType<P> = MutableRefObject<(Component<P> & Readonly<NativeMethods>) | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Helper for useRef and requireNativeComponent:
|
|
14
|
+
* @example
|
|
15
|
+
* RCTMGLCamera = requireNativeComponent<NativeProps>('RCTMGLCamera');
|
|
16
|
+
* const ref = nativeRef(useRef<typeof RCTMGLCamera)(null));
|
|
17
|
+
* ...
|
|
18
|
+
* <RCTMGLCamera ref={ref} ... />
|
|
19
|
+
*/
|
|
20
|
+
export default function nativeRef<P>(c: RefObject<HostComponent<P> | null>): MutableRefObject<(Component<P> & Readonly<NativeMethods>) | null>;
|
|
21
|
+
//# sourceMappingURL=nativeRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeRef.d.ts","sourceRoot":"","sources":["../../../javascript/utils/nativeRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEtE;;;;;;;GAOG;AACH,oBAAY,aAAa,CAAC,CAAC,IAAI,gBAAgB,CAC7C,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAChD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,EACjC,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GACpC,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,CAEnE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnmapbox/maps",
|
|
3
3
|
"description": "A Mapbox react native module for creating custom maps",
|
|
4
|
-
"version": "10.0.0-beta.
|
|
4
|
+
"version": "10.0.0-beta.75",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -70,7 +70,9 @@
|
|
|
70
70
|
"@react-native-community/eslint-config": "^3.0.1",
|
|
71
71
|
"@sinonjs/fake-timers": "^8.0.1",
|
|
72
72
|
"@testing-library/react-native": "^11.0.0",
|
|
73
|
+
"@types/debounce": "^1.2.1",
|
|
73
74
|
"@types/mapbox-gl": "^2.7.5",
|
|
75
|
+
"@types/mapbox__geo-viewport": "^0.4.1",
|
|
74
76
|
"@types/react-native": ">=0.59.9",
|
|
75
77
|
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
76
78
|
"@typescript-eslint/parser": "^5.37.0",
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { requireNativeComponent } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
cloneReactChildrenWithProps,
|
|
7
|
-
viewPropTypes,
|
|
8
|
-
isNumber,
|
|
9
|
-
resolveImagePath,
|
|
10
|
-
} from '../utils';
|
|
11
|
-
|
|
12
|
-
import AbstractSource from './AbstractSource';
|
|
13
|
-
|
|
14
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLImageSource';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* ImageSource is a content source that is used for a georeferenced raster image to be shown on the map.
|
|
18
|
-
* The georeferenced image scales and rotates as the user zooms and rotates the map
|
|
19
|
-
*/
|
|
20
|
-
class ImageSource extends AbstractSource {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
...viewPropTypes,
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* A string that uniquely identifies the source.
|
|
26
|
-
*/
|
|
27
|
-
id: PropTypes.string.isRequired,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* An HTTP(S) URL, absolute file URL, or local file URL to the source image.
|
|
31
|
-
* Gifs are currently not supported.
|
|
32
|
-
*/
|
|
33
|
-
url: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The top left, top right, bottom right, and bottom left coordinates for the image.
|
|
37
|
-
*/
|
|
38
|
-
coordinates: PropTypes.arrayOf(
|
|
39
|
-
PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
40
|
-
).isRequired,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
_getURL() {
|
|
44
|
-
let { url } = this.props;
|
|
45
|
-
|
|
46
|
-
if (isNumber(this.props.url)) {
|
|
47
|
-
url = resolveImagePath(this.props.url);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return url;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
if (
|
|
55
|
-
!this.props.url ||
|
|
56
|
-
!this.props.coordinates ||
|
|
57
|
-
!this.props.coordinates.length
|
|
58
|
-
) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const props = {
|
|
63
|
-
...this.props,
|
|
64
|
-
url: this._getURL(),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<RCTMGLImageSource ref="nativeSource" {...props}>
|
|
69
|
-
{cloneReactChildrenWithProps(this.props.children, {
|
|
70
|
-
sourceID: this.props.id,
|
|
71
|
-
})}
|
|
72
|
-
</RCTMGLImageSource>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const RCTMGLImageSource = requireNativeComponent(
|
|
78
|
-
NATIVE_MODULE_NAME,
|
|
79
|
-
ImageSource,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
export default ImageSource;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { viewPropTypes } from '../utils';
|
|
5
|
-
import { LightLayerStyleProp } from '../utils/styleMap';
|
|
6
|
-
|
|
7
|
-
import AbstractLayer from './AbstractLayer';
|
|
8
|
-
|
|
9
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLLight';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Light represents the light source for extruded geometries
|
|
13
|
-
*/
|
|
14
|
-
class Light extends AbstractLayer {
|
|
15
|
-
static propTypes = {
|
|
16
|
-
...viewPropTypes,
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Customizable style attributes
|
|
20
|
-
*/
|
|
21
|
-
style: LightLayerStyleProp,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
setNativeProps(props) {
|
|
25
|
-
if (this.refs.nativeLight) {
|
|
26
|
-
this.refs.nativeLight.setNativeProps(props);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
return (
|
|
32
|
-
<RCTMGLLight
|
|
33
|
-
ref="nativeLight"
|
|
34
|
-
testID="rctmglLight"
|
|
35
|
-
{...this.props}
|
|
36
|
-
style={undefined}
|
|
37
|
-
reactStyle={this.getStyle(this.props.style)}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const RCTMGLLight = requireNativeComponent(NATIVE_MODULE_NAME, Light, {
|
|
44
|
-
nativeOnly: { reactStyle: true },
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default Light;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { NativeModules, requireNativeComponent } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { cloneReactChildrenWithProps, viewPropTypes } from '../utils';
|
|
6
|
-
|
|
7
|
-
import AbstractSource from './AbstractSource';
|
|
8
|
-
|
|
9
|
-
const isTileTemplateUrl = (url) =>
|
|
10
|
-
url &&
|
|
11
|
-
(url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
|
|
12
|
-
|
|
13
|
-
const MapboxGL = NativeModules.MGLModule;
|
|
14
|
-
|
|
15
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLRasterDemSource';
|
|
16
|
-
|
|
17
|
-
class RasterDemSource extends AbstractSource {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...viewPropTypes,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A string that uniquely identifies the source.
|
|
23
|
-
*/
|
|
24
|
-
id: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
|
|
28
|
-
*/
|
|
29
|
-
url: PropTypes.string,
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
|
|
33
|
-
* Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
|
|
34
|
-
*/
|
|
35
|
-
tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
|
|
39
|
-
* The value should be between 0 and 22, inclusive, and less than
|
|
40
|
-
* maxZoomLevel, if specified. The default value for this option is 0.
|
|
41
|
-
*/
|
|
42
|
-
minZoomLevel: PropTypes.number,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
|
|
46
|
-
* The value should be between 0 and 22, inclusive, and less than
|
|
47
|
-
* minZoomLevel, if specified. The default value for this option is 22.
|
|
48
|
-
*/
|
|
49
|
-
maxZoomLevel: PropTypes.number,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Size of the map tiles.
|
|
53
|
-
* Mapbox urls default to 256, all others default to 512.
|
|
54
|
-
*/
|
|
55
|
-
tileSize: PropTypes.number,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
static defaultProps = {
|
|
59
|
-
id: MapboxGL.StyleSource.DefaultSourceID,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
constructor(props) {
|
|
63
|
-
super(props);
|
|
64
|
-
if (isTileTemplateUrl(props.url)) {
|
|
65
|
-
console.warn(
|
|
66
|
-
`RasterDemSource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your VectorSource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
render() {
|
|
72
|
-
let { url } = this.props;
|
|
73
|
-
let { tileUrlTemplates } = this.props;
|
|
74
|
-
|
|
75
|
-
// Swapping url for tileUrlTemplates to provide backward compatibility
|
|
76
|
-
// when RasterSource supported only tile url as url prop
|
|
77
|
-
if (isTileTemplateUrl(url)) {
|
|
78
|
-
tileUrlTemplates = [url];
|
|
79
|
-
url = undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const props = {
|
|
83
|
-
...this.props,
|
|
84
|
-
id: this.props.id,
|
|
85
|
-
url,
|
|
86
|
-
tileUrlTemplates,
|
|
87
|
-
minZoomLevel: this.props.minZoomLevel,
|
|
88
|
-
maxZoomLevel: this.props.maxZoomLevel,
|
|
89
|
-
tileSize: this.props.tileSize,
|
|
90
|
-
};
|
|
91
|
-
return (
|
|
92
|
-
<RCTMGLRasterDemSource ref="nativeSource" {...props}>
|
|
93
|
-
{cloneReactChildrenWithProps(this.props.children, {
|
|
94
|
-
sourceID: this.props.id,
|
|
95
|
-
})}
|
|
96
|
-
</RCTMGLRasterDemSource>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const RCTMGLRasterDemSource = requireNativeComponent(
|
|
102
|
-
NATIVE_MODULE_NAME,
|
|
103
|
-
RasterDemSource,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
export default RasterDemSource;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { NativeModules, requireNativeComponent } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { cloneReactChildrenWithProps, viewPropTypes } from '../utils';
|
|
6
|
-
|
|
7
|
-
import AbstractSource from './AbstractSource';
|
|
8
|
-
|
|
9
|
-
const MapboxGL = NativeModules.MGLModule;
|
|
10
|
-
|
|
11
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLRasterSource';
|
|
12
|
-
|
|
13
|
-
const isTileTemplateUrl = (url) =>
|
|
14
|
-
url &&
|
|
15
|
-
(url.includes('{z}') || url.includes('{bbox-') || url.includes('{quadkey}'));
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* RasterSource is a map content source that supplies raster image tiles to be shown on the map.
|
|
19
|
-
* The location of and metadata about the tiles are defined either by an option dictionary
|
|
20
|
-
* or by an external file that conforms to the TileJSON specification.
|
|
21
|
-
*/
|
|
22
|
-
class RasterSource extends AbstractSource {
|
|
23
|
-
static propTypes = {
|
|
24
|
-
...viewPropTypes,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* A string that uniquely identifies the source.
|
|
28
|
-
*/
|
|
29
|
-
id: PropTypes.string.isRequired,
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
|
|
33
|
-
*/
|
|
34
|
-
url: PropTypes.string,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
|
|
38
|
-
* Example: https://example.com/raster-tiles/{z}/{x}/{y}.png
|
|
39
|
-
*/
|
|
40
|
-
tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
|
|
44
|
-
* The value should be between 0 and 22, inclusive, and less than
|
|
45
|
-
* maxZoomLevel, if specified. The default value for this option is 0.
|
|
46
|
-
*/
|
|
47
|
-
minZoomLevel: PropTypes.number,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
|
|
51
|
-
* The value should be between 0 and 22, inclusive, and less than
|
|
52
|
-
* minZoomLevel, if specified. The default value for this option is 22.
|
|
53
|
-
*/
|
|
54
|
-
maxZoomLevel: PropTypes.number,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Size of the map tiles.
|
|
58
|
-
* Mapbox urls default to 256, all others default to 512.
|
|
59
|
-
*/
|
|
60
|
-
tileSize: PropTypes.number,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Influences the y direction of the tile coordinates. (tms inverts y axis)
|
|
64
|
-
*/
|
|
65
|
-
tms: PropTypes.bool,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* An HTML or literal text string defining the buttons to be displayed in an action sheet when the
|
|
69
|
-
* source is part of a map view’s style and the map view’s attribution button is pressed.
|
|
70
|
-
*/
|
|
71
|
-
attribution: PropTypes.string,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
static defaultProps = {
|
|
75
|
-
id: MapboxGL.StyleSource.DefaultSourceID,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
constructor(props) {
|
|
79
|
-
super(props);
|
|
80
|
-
if (isTileTemplateUrl(props.url)) {
|
|
81
|
-
console.warn(
|
|
82
|
-
`RasterSource 'url' property contains a Tile URL Template, but is intended for a StyleJSON URL. Please migrate your VectorSource to use: \`tileUrlTemplates=["${props.url}"]\` instead.`,
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
render() {
|
|
88
|
-
let { url } = this.props;
|
|
89
|
-
let { tileUrlTemplates } = this.props;
|
|
90
|
-
|
|
91
|
-
// Swapping url for tileUrlTemplates to provide backward compatibility
|
|
92
|
-
// when RasterSource supported only tile url as url prop
|
|
93
|
-
if (isTileTemplateUrl(url)) {
|
|
94
|
-
tileUrlTemplates = [url];
|
|
95
|
-
url = undefined;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const props = {
|
|
99
|
-
...this.props,
|
|
100
|
-
id: this.props.id,
|
|
101
|
-
url,
|
|
102
|
-
tileUrlTemplates,
|
|
103
|
-
minZoomLevel: this.props.minZoomLevel,
|
|
104
|
-
maxZoomLevel: this.props.maxZoomLevel,
|
|
105
|
-
tileSize: this.props.tileSize,
|
|
106
|
-
tms: this.props.tms,
|
|
107
|
-
attribution: this.props.attribution,
|
|
108
|
-
};
|
|
109
|
-
return (
|
|
110
|
-
<RCTMGLRasterSource ref={this.setNativeRef} {...props}>
|
|
111
|
-
{cloneReactChildrenWithProps(this.props.children, {
|
|
112
|
-
sourceID: this.props.id,
|
|
113
|
-
})}
|
|
114
|
-
</RCTMGLRasterSource>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const RCTMGLRasterSource = requireNativeComponent(
|
|
120
|
-
NATIVE_MODULE_NAME,
|
|
121
|
-
RasterSource,
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
export default RasterSource;
|