@rnmapbox/maps 10.0.0-beta.74 → 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/index.d.ts +28 -257
- package/javascript/components/ImageSource.tsx +81 -0
- package/javascript/components/{MapView.js → MapView.tsx} +456 -383
- package/javascript/components/NativeBridgeComponent.tsx +1 -1
- package/javascript/components/RasterDemSource.tsx +105 -0
- package/javascript/components/RasterSource.tsx +124 -0
- 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/utils/geoUtils.ts +91 -0
- package/javascript/utils/{index.js → index.ts} +41 -19
- package/lib/commonjs/components/ImageSource.js +8 -25
- package/lib/commonjs/components/ImageSource.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/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/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/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/module/components/ImageSource.js +8 -25
- package/lib/module/components/ImageSource.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/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/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/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/typescript/components/ImageSource.d.ts +32 -0
- package/lib/typescript/components/ImageSource.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 +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 +1 -1
- package/lib/typescript/components/VectorSource.d.ts +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/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/package.json +3 -1
- package/javascript/components/ImageSource.js +0 -82
- package/javascript/components/RasterDemSource.js +0 -106
- package/javascript/components/RasterSource.js +0 -124
- 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/geoUtils.d.js.map +0 -1
- package/lib/commonjs/utils/index.d.js +0 -2
- package/lib/commonjs/utils/index.d.js.map +0 -1
- package/lib/module/utils/geoUtils.d.js +0 -2
- package/lib/module/utils/geoUtils.d.js.map +0 -1
- package/lib/module/utils/index.d.js +0 -2
- package/lib/module/utils/index.d.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { requireNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
cloneReactChildrenWithProps,
|
|
6
|
+
isNumber,
|
|
7
|
+
resolveImagePath,
|
|
8
|
+
} from '../utils';
|
|
9
|
+
import { BaseProps } from '../types/BaseProps';
|
|
10
|
+
|
|
11
|
+
import AbstractSource from './AbstractSource';
|
|
12
|
+
|
|
13
|
+
export const NATIVE_MODULE_NAME = 'RCTMGLImageSource';
|
|
14
|
+
|
|
15
|
+
type Position = [number, number];
|
|
16
|
+
|
|
17
|
+
type Props = BaseProps & {
|
|
18
|
+
/**
|
|
19
|
+
* A string that uniquely identifies the source.
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An HTTP(S) URL, absolute file URL, or local file URL to the source image.
|
|
25
|
+
* Gifs are currently not supported.
|
|
26
|
+
*/
|
|
27
|
+
url?: number | string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The top left, top right, bottom right, and bottom left coordinates for the image.
|
|
31
|
+
*/
|
|
32
|
+
coordinates: [Position, Position, Position, Position];
|
|
33
|
+
|
|
34
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
type NativeProps = Props;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* ImageSource is a content source that is used for a georeferenced raster image to be shown on the map.
|
|
41
|
+
* The georeferenced image scales and rotates as the user zooms and rotates the map
|
|
42
|
+
*/
|
|
43
|
+
class ImageSource extends AbstractSource<Props, NativeProps> {
|
|
44
|
+
_getURL(): string | undefined {
|
|
45
|
+
const { url } = this.props;
|
|
46
|
+
|
|
47
|
+
if (isNumber(url)) {
|
|
48
|
+
return resolveImagePath(url);
|
|
49
|
+
} else {
|
|
50
|
+
return url;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render() {
|
|
55
|
+
if (
|
|
56
|
+
!this.props.url ||
|
|
57
|
+
!this.props.coordinates ||
|
|
58
|
+
!this.props.coordinates.length
|
|
59
|
+
) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const props = {
|
|
64
|
+
...this.props,
|
|
65
|
+
url: this._getURL(),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<RCTMGLImageSource ref={this.setNativeRef} {...props}>
|
|
70
|
+
{cloneReactChildrenWithProps(this.props.children, {
|
|
71
|
+
sourceID: this.props.id,
|
|
72
|
+
})}
|
|
73
|
+
</RCTMGLImageSource>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const RCTMGLImageSource =
|
|
79
|
+
requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
80
|
+
|
|
81
|
+
export default ImageSource;
|