@maplibre/maplibre-react-native 11.0.2 → 11.0.3

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.
@@ -10,8 +10,19 @@ interface TileSourceInterface {
10
10
  var maxZoom: Int?
11
11
  var scheme: String?
12
12
 
13
+ fun validate() {
14
+ require(!(url.isNullOrEmpty() && tiles.isNullOrEmpty())) {
15
+ "Either `url` or `tiles` must be provided"
16
+ }
17
+ }
18
+
13
19
  fun buildTileset(): TileSet {
14
- val tileUrlTemplates = tiles!!.toTypedArray<String>()
20
+ val currentTiles = tiles
21
+ require(!currentTiles.isNullOrEmpty()) {
22
+ "`tiles` must be provided"
23
+ }
24
+
25
+ val tileUrlTemplates = currentTiles.toTypedArray<String>()
15
26
  val tileSet = TileSet(TILE_SPEC_VERSION, *tileUrlTemplates)
16
27
 
17
28
  if (this.minZoom != null) {
@@ -10,11 +10,14 @@ class MLRNRasterSource(
10
10
  var tileSize: Int? = null
11
11
 
12
12
  override fun makeSource(): RasterSource {
13
- val configurationUrl = url
13
+ validate()
14
+
14
15
  val tileSize = (if (tileSize != null) tileSize else RasterSource.DEFAULT_TILE_SIZE)!!
15
- if (configurationUrl != null) {
16
- return RasterSource(mID, configurationUrl, tileSize)
16
+
17
+ if (!url.isNullOrEmpty()) {
18
+ return RasterSource(mID, url, tileSize)
17
19
  }
20
+
18
21
  return RasterSource(mID, buildTileset(), tileSize)
19
22
  }
20
23
  }
@@ -12,10 +12,12 @@ class MLRNVectorSource(
12
12
  context: Context,
13
13
  ) : MLRNPressableTileSource<VectorSource>(context) {
14
14
  override fun makeSource(): VectorSource {
15
- val configurationUrl = url
16
- if (configurationUrl != null) {
15
+ validate()
16
+
17
+ if (!url.isNullOrEmpty()) {
17
18
  return VectorSource(mID, url)
18
19
  }
20
+
19
21
  return VectorSource(mID, buildTileset())
20
22
  }
21
23
 
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.0.3",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": true
@@ -162,28 +162,29 @@
162
162
  "@turf/nearest-point-on-line": "^7.3.5"
163
163
  },
164
164
  "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",
165
+ "@expo/config-plugins": "55.0.8",
166
+ "@react-native-community/cli": "20.1.3",
167
+ "@react-native/babel-preset": "0.85.2",
168
+ "@react-native/jest-preset": "0.85.2",
169
+ "@semantic-release/changelog": "6.0.3",
170
+ "@semantic-release/exec": "7.1.0",
171
+ "@semantic-release/git": "10.0.1",
172
+ "@testing-library/react-native": "13.3.3",
173
+ "@types/geojson": "7946.0.16",
174
+ "@types/jest": "29.5.14",
175
+ "@types/node": "24.12.2",
176
+ "@types/react": "19.2.14",
177
+ "eslint": "8.57.1",
178
+ "eslint-config-universe": "15.0.4",
179
+ "jest": "29.7.0",
179
180
  "prettier": "3.8.3",
180
181
  "react": "19.2.3",
181
- "react-native": "0.84.1",
182
- "react-native-builder-bob": "0.40.17",
182
+ "react-native": "0.85.2",
183
+ "react-native-builder-bob": "0.41.0",
183
184
  "react-test-renderer": "19.2.3",
184
- "semantic-release": "^25.0.1",
185
- "snapshot-diff": "^0.10.0",
185
+ "semantic-release": "25.0.3",
186
+ "snapshot-diff": "0.10.0",
186
187
  "ts-node": "10.9.2",
187
- "typescript": "^5.9.2"
188
+ "typescript": "5.9.3"
188
189
  }
189
190
  }