expo-gaode-map 2.2.35 → 2.2.36

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.
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Jun 11 10:42:28 CST 2026
2
+ gradle.version=8.9
File without changes
@@ -30,8 +30,8 @@ public class ExpoGaodeMapSearchModule: Module {
30
30
 
31
31
  let city = options["city"] as? String ?? ""
32
32
  let types = options["types"] as? String ?? ""
33
- let pageSize = options["pageSize"] as? Int ?? 20
34
- let pageNum = options["pageNum"] as? Int ?? 1
33
+ let pageSize = self.intOption(options, "pageSize", defaultValue: 20)
34
+ let pageNum = self.intOption(options, "pageNum", defaultValue: 1)
35
35
 
36
36
  let request = AMapPOIKeywordsSearchRequest()
37
37
  request.keywords = keyword
@@ -65,10 +65,10 @@ public class ExpoGaodeMapSearchModule: Module {
65
65
  return
66
66
  }
67
67
 
68
- let radius = options["radius"] as? Int ?? 1000
68
+ let radius = self.intOption(options, "radius", defaultValue: 1000)
69
69
  let types = options["types"] as? String ?? ""
70
- let pageSize = options["pageSize"] as? Int ?? 20
71
- let pageNum = options["pageNum"] as? Int ?? 1
70
+ let pageSize = self.intOption(options, "pageSize", defaultValue: 20)
71
+ let pageNum = self.intOption(options, "pageNum", defaultValue: 1)
72
72
 
73
73
  let request = AMapPOIAroundSearchRequest()
74
74
  request.keywords = keyword
@@ -136,7 +136,7 @@ public class ExpoGaodeMapSearchModule: Module {
136
136
  let request = AMapRoutePOISearchRequest()
137
137
  request.polyline = Array(points.prefix(100))
138
138
  request.searchType = searchType
139
- request.range = min(max(options["range"] as? Int ?? 250, 0), 500)
139
+ request.range = min(max(self.intOption(options, "range", defaultValue: 250), 0), 500)
140
140
  request.strategy = 0
141
141
 
142
142
  guard let searchAPI = self.createSearchAPI(promise: promise, errorCode: "SEARCH_ERROR") else {
@@ -160,8 +160,8 @@ public class ExpoGaodeMapSearchModule: Module {
160
160
  }
161
161
 
162
162
  let types = options["types"] as? String ?? ""
163
- let pageSize = options["pageSize"] as? Int ?? 20
164
- let pageNum = options["pageNum"] as? Int ?? 1
163
+ let pageSize = self.intOption(options, "pageSize", defaultValue: 20)
164
+ let pageNum = self.intOption(options, "pageNum", defaultValue: 1)
165
165
 
166
166
  // 转换路线点
167
167
  var points: [AMapGeoPoint] = []
@@ -224,7 +224,7 @@ public class ExpoGaodeMapSearchModule: Module {
224
224
  return
225
225
  }
226
226
 
227
- let radius = options["radius"] as? Int ?? 1000
227
+ let radius = self.intOption(options, "radius", defaultValue: 1000)
228
228
  let requireExtension = options["requireExtension"] as? Bool ?? true
229
229
 
230
230
  let request = AMapReGeocodeSearchRequest()
@@ -259,6 +259,18 @@ public class ExpoGaodeMapSearchModule: Module {
259
259
 
260
260
 
261
261
  // MARK: - Private Methods
262
+
263
+ private func intOption(_ options: [String: Any], _ key: String, defaultValue: Int) -> Int {
264
+ if let value = options[key] as? Int {
265
+ return value
266
+ }
267
+
268
+ if let value = options[key] as? NSNumber {
269
+ return value.intValue
270
+ }
271
+
272
+ return defaultValue
273
+ }
262
274
 
263
275
  private func limitReGeocodeRadius(_ radius: Int) -> Int {
264
276
  // AMapReGeocodeSearchRequest radius property is NSInteger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "2.2.35",
3
+ "version": "2.2.36",
4
4
  "description": "A full-featured React Native AMap (Gaode Map) library for Expo, including map display, location, overlays, offline maps, and geometry utilities.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",