@maplibre/maplibre-react-native 11.0.2 → 11.1.0

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 (54) hide show
  1. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +2 -0
  2. package/android/src/main/java/org/maplibre/reactnative/components/layer/MLRNLayer.kt +34 -25
  3. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/TileSourceInterface.kt +12 -1
  4. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rasterdemsource/MLRNRasterDEMSource.kt +28 -0
  5. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rasterdemsource/MLRNRasterDEMSourceManager.kt +34 -0
  6. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/rastersource/MLRNRasterSource.kt +6 -3
  7. package/android/src/main/java/org/maplibre/reactnative/components/sources/tilesources/vectorsource/MLRNVectorSource.kt +4 -2
  8. package/ios/components/layer/MLRNLayer.h +14 -1
  9. package/ios/components/layer/MLRNLayer.m +52 -37
  10. package/ios/components/layer/MLRNLayerComponentView.mm +26 -1
  11. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSource.h +10 -0
  12. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSource.m +39 -0
  13. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSourceComponentView.h +9 -0
  14. package/ios/components/sources/tile-sources/raster-dem-source/MLRNRasterDEMSourceComponentView.mm +131 -0
  15. package/lib/commonjs/components/layer/LayerNativeComponent.ts +13 -1
  16. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSource.js +31 -0
  17. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSource.js.map +1 -0
  18. package/lib/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  19. package/lib/commonjs/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  20. package/lib/commonjs/index.js +7 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/module/components/layer/LayerNativeComponent.ts +13 -1
  23. package/lib/module/components/sources/raster-dem-source/RasterDEMSource.js +26 -0
  24. package/lib/module/components/sources/raster-dem-source/RasterDEMSource.js.map +1 -0
  25. package/lib/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  26. package/lib/module/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  27. package/lib/module/index.js +1 -0
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/typescript/commonjs/components/layer/LayerNativeComponent.d.ts +1 -1
  30. package/lib/typescript/commonjs/components/layer/LayerNativeComponent.d.ts.map +1 -1
  31. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSource.d.ts +58 -0
  32. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSource.d.ts.map +1 -0
  33. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts +15 -0
  34. package/lib/typescript/commonjs/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/components/sources/raster-source/RasterSourceNativeComponent.d.ts +2 -2
  36. package/lib/typescript/commonjs/components/sources/raster-source/RasterSourceNativeComponent.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/index.d.ts +2 -1
  38. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  39. package/lib/typescript/module/components/layer/LayerNativeComponent.d.ts +1 -1
  40. package/lib/typescript/module/components/layer/LayerNativeComponent.d.ts.map +1 -1
  41. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSource.d.ts +58 -0
  42. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSource.d.ts.map +1 -0
  43. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts +15 -0
  44. package/lib/typescript/module/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.d.ts.map +1 -0
  45. package/lib/typescript/module/components/sources/raster-source/RasterSourceNativeComponent.d.ts +2 -2
  46. package/lib/typescript/module/components/sources/raster-source/RasterSourceNativeComponent.d.ts.map +1 -1
  47. package/lib/typescript/module/index.d.ts +2 -1
  48. package/lib/typescript/module/index.d.ts.map +1 -1
  49. package/package.json +22 -20
  50. package/src/components/layer/LayerNativeComponent.ts +13 -1
  51. package/src/components/sources/raster-dem-source/RasterDEMSource.tsx +83 -0
  52. package/src/components/sources/raster-dem-source/RasterDEMSourceNativeComponent.ts +25 -0
  53. package/src/components/sources/raster-source/RasterSourceNativeComponent.ts +2 -2
  54. package/src/index.ts +14 -9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maplibre/maplibre-react-native",
3
3
  "description": "React Native library for creating maps with MapLibre Native for Android & iOS",
4
- "version": "11.0.2",
4
+ "version": "11.1.0",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": true
@@ -131,6 +131,7 @@
131
131
  "MLRNNativeUserLocation": "MLRNNativeUserLocationComponentView",
132
132
  "MLRNPointAnnotation": "MLRNPointAnnotationComponentView",
133
133
  "MLRNRasterSource": "MLRNRasterSourceComponentView",
134
+ "MLRNRasterDEMSource": "MLRNRasterDEMSourceComponentView",
134
135
  "MLRNGeoJSONSource": "MLRNGeoJSONSourceComponentView",
135
136
  "MLRNVectorSource": "MLRNVectorSourceComponentView"
136
137
  }
@@ -162,28 +163,29 @@
162
163
  "@turf/nearest-point-on-line": "^7.3.5"
163
164
  },
164
165
  "devDependencies": {
165
- "@expo/config-plugins": "~55.0.4",
166
- "@react-native-community/cli": "^20.1.1",
167
- "@react-native/babel-preset": "0.84.1",
168
- "@semantic-release/changelog": "^6.0.3",
169
- "@semantic-release/exec": "^7.1.0",
170
- "@semantic-release/git": "^10.0.1",
171
- "@testing-library/react-native": "^13.3.3",
172
- "@types/geojson": "^7946.0.16",
173
- "@types/jest": "^29.5.14",
174
- "@types/node": "^24.1.0",
175
- "@types/react": "^19.2.14",
176
- "eslint": "^8.57.1",
177
- "eslint-config-universe": "15.0.3",
178
- "jest": "^29.7.0",
166
+ "@expo/config-plugins": "55.0.8",
167
+ "@react-native-community/cli": "20.1.3",
168
+ "@react-native/babel-preset": "0.85.3",
169
+ "@react-native/jest-preset": "0.85.3",
170
+ "@semantic-release/changelog": "6.0.3",
171
+ "@semantic-release/exec": "7.1.0",
172
+ "@semantic-release/git": "10.0.1",
173
+ "@testing-library/react-native": "13.3.3",
174
+ "@types/geojson": "7946.0.16",
175
+ "@types/jest": "29.5.14",
176
+ "@types/node": "24.12.2",
177
+ "@types/react": "19.2.14",
178
+ "eslint": "8.57.1",
179
+ "eslint-config-universe": "15.0.4",
180
+ "jest": "29.7.0",
179
181
  "prettier": "3.8.3",
180
182
  "react": "19.2.3",
181
- "react-native": "0.84.1",
182
- "react-native-builder-bob": "0.40.17",
183
+ "react-native": "0.85.3",
184
+ "react-native-builder-bob": "0.41.0",
183
185
  "react-test-renderer": "19.2.3",
184
- "semantic-release": "^25.0.1",
185
- "snapshot-diff": "^0.10.0",
186
+ "semantic-release": "25.0.3",
187
+ "snapshot-diff": "0.10.0",
186
188
  "ts-node": "10.9.2",
187
- "typescript": "^5.9.2"
189
+ "typescript": "5.9.3"
188
190
  }
189
191
  }
@@ -10,7 +10,19 @@ import type { StyleValue } from "../../utils/StyleValue";
10
10
 
11
11
  export interface NativeProps extends ViewProps {
12
12
  id: string;
13
- layerType: string;
13
+ layerType?: CodegenTypes.WithDefault<
14
+ | "background"
15
+ | "circle"
16
+ | "color-relief"
17
+ | "fill"
18
+ | "fill-extrusion"
19
+ | "heatmap"
20
+ | "hillshade"
21
+ | "line"
22
+ | "raster"
23
+ | "symbol",
24
+ "background"
25
+ >;
14
26
 
15
27
  source?: string;
16
28
  sourceLayer?: string;
@@ -0,0 +1,83 @@
1
+ import { memo, type ReactNode } from "react";
2
+
3
+ import RasterDEMSourceNativeComponent from "./RasterDEMSourceNativeComponent";
4
+ import { useFrozenId } from "../../../hooks/useFrozenId";
5
+ import { type BaseProps } from "../../../types/BaseProps";
6
+ import { cloneReactChildrenWithProps } from "../../../utils";
7
+
8
+ export interface RasterDEMSourceProps extends BaseProps {
9
+ /**
10
+ * A string that uniquely identifies the source.
11
+ */
12
+ id?: string;
13
+
14
+ /**
15
+ * A URL to a TileJSON configuration file describing the source's contents and
16
+ * other metadata.
17
+ */
18
+ url?: string;
19
+
20
+ /**
21
+ * An array of tile URL templates. If multiple endpoints are specified, clients
22
+ * may use any combination of endpoints.
23
+ *
24
+ * @example "https://example.com/dem-tiles/{z}/{x}/{y}.png"
25
+ */
26
+ tiles?: string[];
27
+
28
+ /**
29
+ * An unsigned integer that specifies the minimum zoom level at which to display
30
+ * tiles from the source. The value should be between 0 and 22, inclusive, and
31
+ * less than maxzoom, if specified. The default value for this option is 0.
32
+ */
33
+ minzoom?: number;
34
+
35
+ /**
36
+ * An unsigned integer that specifies the maximum zoom level at which to display
37
+ * tiles from the source. The value should be between 0 and 22, inclusive, and
38
+ * greater than minzoom, if specified. The default value for this option is 22.
39
+ */
40
+ maxzoom?: number;
41
+
42
+ /**
43
+ * Size of the map tiles.
44
+ *
45
+ * @defaultValue 512
46
+ */
47
+ tileSize?: number;
48
+
49
+ /**
50
+ * An HTML or literal text string defining the buttons to be displayed in an
51
+ * action sheet when the source is part of a map view's style and the map view's
52
+ * attribution button is pressed.
53
+ */
54
+ attribution?: string;
55
+
56
+ /**
57
+ * The encoding formula for the raster DEM tileset.
58
+ *
59
+ * @defaultValue "mapbox"
60
+ */
61
+ encoding?: "mapbox" | "terrarium";
62
+
63
+ children?: ReactNode;
64
+ }
65
+
66
+ /**
67
+ * RasterDEMSource is a map content source that supplies rasterized digital
68
+ * elevation model (DEM) tiles to be shown on the map. Use it together with a
69
+ * hillshade layer to visualize terrain.
70
+ */
71
+ export const RasterDEMSource = memo(
72
+ ({ id, ...props }: RasterDEMSourceProps) => {
73
+ const frozenId = useFrozenId(id);
74
+
75
+ return (
76
+ <RasterDEMSourceNativeComponent id={frozenId} {...props}>
77
+ {cloneReactChildrenWithProps(props.children, {
78
+ source: frozenId,
79
+ })}
80
+ </RasterDEMSourceNativeComponent>
81
+ );
82
+ },
83
+ );
@@ -0,0 +1,25 @@
1
+ import {
2
+ codegenNativeComponent,
3
+ type CodegenTypes,
4
+ type HostComponent,
5
+ type ViewProps,
6
+ } from "react-native";
7
+
8
+ type NativeDEMEncoding = "mapbox" | "terrarium";
9
+
10
+ export interface NativeProps extends ViewProps {
11
+ id: string;
12
+ url?: string;
13
+ tiles?: string[];
14
+
15
+ tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
16
+ minzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
17
+ maxzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
18
+ attribution?: string;
19
+
20
+ encoding?: CodegenTypes.WithDefault<NativeDEMEncoding, "mapbox">;
21
+ }
22
+
23
+ export default codegenNativeComponent<NativeProps>(
24
+ "MLRNRasterDEMSource",
25
+ ) as HostComponent<NativeProps>;
@@ -12,12 +12,12 @@ export interface NativeProps extends ViewProps {
12
12
  url?: string;
13
13
  tiles?: string[];
14
14
 
15
+ tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
15
16
  minzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
16
17
  maxzoom?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
17
- scheme?: CodegenTypes.WithDefault<NativeScheme, "xyz">;
18
18
  attribution?: string;
19
19
 
20
- tileSize?: CodegenTypes.WithDefault<CodegenTypes.Int32, 512>;
20
+ scheme?: CodegenTypes.WithDefault<NativeScheme, "xyz">;
21
21
  }
22
22
 
23
23
  export default codegenNativeComponent<NativeProps>(
package/src/index.ts CHANGED
@@ -60,6 +60,10 @@ export {
60
60
  type RasterSourceProps,
61
61
  RasterSource,
62
62
  } from "./components/sources/raster-source/RasterSource";
63
+ export {
64
+ type RasterDEMSourceProps,
65
+ RasterDEMSource,
66
+ } from "./components/sources/raster-dem-source/RasterDEMSource";
63
67
 
64
68
  export {
65
69
  type VectorSourceRef,
@@ -84,24 +88,25 @@ export {
84
88
  export type {
85
89
  // Layers
86
90
  LayerSpecification,
87
- FillLayerSpecification,
88
- LineLayerSpecification,
89
- SymbolLayerSpecification,
91
+ BackgroundLayerSpecification,
90
92
  CircleLayerSpecification,
91
- HeatmapLayerSpecification,
93
+ ColorReliefLayerSpecification,
94
+ FillLayerSpecification,
92
95
  FillExtrusionLayerSpecification,
93
- RasterLayerSpecification,
96
+ HeatmapLayerSpecification,
94
97
  HillshadeLayerSpecification,
95
- BackgroundLayerSpecification,
98
+ LineLayerSpecification,
99
+ RasterLayerSpecification,
100
+ SymbolLayerSpecification,
96
101
 
97
102
  // Sources
98
103
  SourceSpecification,
99
- VectorSourceSpecification,
104
+ GeoJSONSourceSpecification,
105
+ ImageSourceSpecification,
100
106
  RasterSourceSpecification,
101
107
  RasterDEMSourceSpecification,
102
- GeoJSONSourceSpecification,
108
+ VectorSourceSpecification,
103
109
  VideoSourceSpecification,
104
- ImageSourceSpecification,
105
110
 
106
111
  // Filter
107
112
  FilterSpecification,