@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.
Files changed (96) hide show
  1. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +61 -46
  2. package/index.d.ts +28 -257
  3. package/javascript/components/ImageSource.tsx +81 -0
  4. package/javascript/components/{MapView.js → MapView.tsx} +456 -383
  5. package/javascript/components/NativeBridgeComponent.tsx +1 -1
  6. package/javascript/components/RasterDemSource.tsx +105 -0
  7. package/javascript/components/RasterSource.tsx +124 -0
  8. package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +21 -6
  9. package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +19 -4
  10. package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +77 -21
  11. package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +27 -3
  12. package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +1 -1
  13. package/javascript/utils/geoUtils.ts +91 -0
  14. package/javascript/utils/{index.js → index.ts} +41 -19
  15. package/lib/commonjs/components/ImageSource.js +8 -25
  16. package/lib/commonjs/components/ImageSource.js.map +1 -1
  17. package/lib/commonjs/components/MapView.js +30 -289
  18. package/lib/commonjs/components/MapView.js.map +1 -1
  19. package/lib/commonjs/components/NativeBridgeComponent.js.map +1 -1
  20. package/lib/commonjs/components/RasterDemSource.js +3 -37
  21. package/lib/commonjs/components/RasterDemSource.js.map +1 -1
  22. package/lib/commonjs/components/RasterSource.js +2 -46
  23. package/lib/commonjs/components/RasterSource.js.map +1 -1
  24. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js +2 -4
  25. package/lib/commonjs/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  26. package/lib/commonjs/modules/offline/OfflinePack.js.map +1 -1
  27. package/lib/commonjs/modules/offline/offlineManager.js +1 -2
  28. package/lib/commonjs/modules/offline/offlineManager.js.map +1 -1
  29. package/lib/commonjs/modules/snapshot/SnapshotOptions.js.map +1 -1
  30. package/lib/commonjs/modules/snapshot/snapshotManager.js.map +1 -1
  31. package/lib/commonjs/utils/geoUtils.js +15 -23
  32. package/lib/commonjs/utils/geoUtils.js.map +1 -1
  33. package/lib/commonjs/utils/index.js +3 -6
  34. package/lib/commonjs/utils/index.js.map +1 -1
  35. package/lib/module/components/ImageSource.js +8 -25
  36. package/lib/module/components/ImageSource.js.map +1 -1
  37. package/lib/module/components/MapView.js +31 -290
  38. package/lib/module/components/MapView.js.map +1 -1
  39. package/lib/module/components/NativeBridgeComponent.js.map +1 -1
  40. package/lib/module/components/RasterDemSource.js +4 -38
  41. package/lib/module/components/RasterDemSource.js.map +1 -1
  42. package/lib/module/components/RasterSource.js +3 -47
  43. package/lib/module/components/RasterSource.js.map +1 -1
  44. package/lib/module/modules/offline/OfflineCreatePackOptions.js +2 -4
  45. package/lib/module/modules/offline/OfflineCreatePackOptions.js.map +1 -1
  46. package/lib/module/modules/offline/OfflinePack.js.map +1 -1
  47. package/lib/module/modules/offline/offlineManager.js +0 -1
  48. package/lib/module/modules/offline/offlineManager.js.map +1 -1
  49. package/lib/module/modules/snapshot/SnapshotOptions.js.map +1 -1
  50. package/lib/module/modules/snapshot/snapshotManager.js.map +1 -1
  51. package/lib/module/utils/geoUtils.js +7 -18
  52. package/lib/module/utils/geoUtils.js.map +1 -1
  53. package/lib/module/utils/index.js +3 -5
  54. package/lib/module/utils/index.js.map +1 -1
  55. package/lib/typescript/components/ImageSource.d.ts +32 -0
  56. package/lib/typescript/components/ImageSource.d.ts.map +1 -0
  57. package/lib/typescript/components/MapView.d.ts +472 -0
  58. package/lib/typescript/components/MapView.d.ts.map +1 -0
  59. package/lib/typescript/components/NativeBridgeComponent.d.ts +1 -1
  60. package/lib/typescript/components/NativeBridgeComponent.d.ts.map +1 -1
  61. package/lib/typescript/components/PointAnnotation.d.ts +1 -1
  62. package/lib/typescript/components/RasterDemSource.d.ts +46 -0
  63. package/lib/typescript/components/RasterDemSource.d.ts.map +1 -0
  64. package/lib/typescript/components/RasterSource.d.ts +59 -0
  65. package/lib/typescript/components/RasterSource.d.ts.map +1 -0
  66. package/lib/typescript/components/ShapeSource.d.ts +1 -1
  67. package/lib/typescript/components/VectorSource.d.ts +1 -1
  68. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts +22 -0
  69. package/lib/typescript/modules/offline/OfflineCreatePackOptions.d.ts.map +1 -0
  70. package/lib/typescript/modules/offline/OfflinePack.d.ts +24 -0
  71. package/lib/typescript/modules/offline/OfflinePack.d.ts.map +1 -0
  72. package/lib/typescript/modules/offline/offlineManager.d.ts +219 -0
  73. package/lib/typescript/modules/offline/offlineManager.d.ts.map +1 -0
  74. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts +41 -0
  75. package/lib/typescript/modules/snapshot/SnapshotOptions.d.ts.map +1 -0
  76. package/lib/typescript/modules/snapshot/snapshotManager.d.ts +51 -0
  77. package/lib/typescript/modules/snapshot/snapshotManager.d.ts.map +1 -0
  78. package/lib/typescript/utils/geoUtils.d.ts +23 -0
  79. package/lib/typescript/utils/geoUtils.d.ts.map +1 -0
  80. package/lib/typescript/utils/index.d.ts +48 -0
  81. package/lib/typescript/utils/index.d.ts.map +1 -0
  82. package/package.json +3 -1
  83. package/javascript/components/ImageSource.js +0 -82
  84. package/javascript/components/RasterDemSource.js +0 -106
  85. package/javascript/components/RasterSource.js +0 -124
  86. package/javascript/utils/geoUtils.d.ts +0 -10
  87. package/javascript/utils/geoUtils.js +0 -73
  88. package/javascript/utils/index.d.ts +0 -27
  89. package/lib/commonjs/utils/geoUtils.d.js +0 -2
  90. package/lib/commonjs/utils/geoUtils.d.js.map +0 -1
  91. package/lib/commonjs/utils/index.d.js +0 -2
  92. package/lib/commonjs/utils/index.d.js.map +0 -1
  93. package/lib/module/utils/geoUtils.d.js +0 -2
  94. package/lib/module/utils/geoUtils.d.js.map +0 -1
  95. package/lib/module/utils/index.d.js +0 -2
  96. 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;