expo-gaode-map 2.2.33 → 2.2.34

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 (57) hide show
  1. package/README.md +20 -14
  2. package/android/build.gradle +8 -4
  3. package/android/src/main/AndroidManifest.xml +14 -0
  4. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapModule.kt +7 -8
  5. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapOfflineModule.kt +150 -27
  6. package/android/src/main/java/expo/modules/gaodemap/ExpoGaodeMapView.kt +24 -14
  7. package/android/src/main/java/expo/modules/gaodemap/managers/UIManager.kt +38 -41
  8. package/android/src/main/java/expo/modules/gaodemap/modules/SDKInitializer.kt +18 -17
  9. package/android/src/main/java/expo/modules/gaodemap/overlays/CircleView.kt +3 -1
  10. package/android/src/main/java/expo/modules/gaodemap/overlays/ClusterView.kt +6 -1
  11. package/android/src/main/java/expo/modules/gaodemap/overlays/HeatMapView.kt +124 -10
  12. package/android/src/main/java/expo/modules/gaodemap/overlays/HeatMapViewModule.kt +2 -2
  13. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerBitmapRenderer.kt +10 -9
  14. package/android/src/main/java/expo/modules/gaodemap/overlays/MarkerView.kt +7 -11
  15. package/android/src/main/java/expo/modules/gaodemap/overlays/MultiPointView.kt +3 -1
  16. package/android/src/main/java/expo/modules/gaodemap/overlays/PolygonView.kt +2 -1
  17. package/android/src/main/java/expo/modules/gaodemap/overlays/PolylineView.kt +1 -0
  18. package/android/src/main/java/expo/modules/gaodemap/search/ExpoGaodeMapSearchModule.kt +751 -0
  19. package/android/src/main/java/expo/modules/gaodemap/utils/GeometryUtils.kt +5 -5
  20. package/android/src/main/java/expo/modules/gaodemap/utils/PermissionHelper.kt +13 -16
  21. package/build/ExpoGaodeMapOfflineModule.d.ts +5 -0
  22. package/build/ExpoGaodeMapOfflineModule.d.ts.map +1 -1
  23. package/build/ExpoGaodeMapOfflineModule.js.map +1 -1
  24. package/build/components/overlays/HeatMap.d.ts.map +1 -1
  25. package/build/components/overlays/HeatMap.js +21 -2
  26. package/build/components/overlays/HeatMap.js.map +1 -1
  27. package/build/index.d.ts +3 -0
  28. package/build/index.d.ts.map +1 -1
  29. package/build/index.js +3 -0
  30. package/build/index.js.map +1 -1
  31. package/build/search/ExpoGaodeMapSearch.types.d.ts +340 -0
  32. package/build/search/ExpoGaodeMapSearch.types.d.ts.map +1 -0
  33. package/build/search/ExpoGaodeMapSearch.types.js +19 -0
  34. package/build/search/ExpoGaodeMapSearch.types.js.map +1 -0
  35. package/build/search/ExpoGaodeMapSearchModule.d.ts +74 -0
  36. package/build/search/ExpoGaodeMapSearchModule.d.ts.map +1 -0
  37. package/build/search/ExpoGaodeMapSearchModule.js +47 -0
  38. package/build/search/ExpoGaodeMapSearchModule.js.map +1 -0
  39. package/build/search/index.d.ts +156 -0
  40. package/build/search/index.d.ts.map +1 -0
  41. package/build/search/index.js +171 -0
  42. package/build/search/index.js.map +1 -0
  43. package/build/types/map-view.types.d.ts +4 -2
  44. package/build/types/map-view.types.d.ts.map +1 -1
  45. package/build/types/map-view.types.js.map +1 -1
  46. package/build/utils/OfflineMapManager.d.ts +4 -0
  47. package/build/utils/OfflineMapManager.d.ts.map +1 -1
  48. package/build/utils/OfflineMapManager.js +6 -0
  49. package/build/utils/OfflineMapManager.js.map +1 -1
  50. package/expo-module.config.json +4 -2
  51. package/ios/ExpoGaodeMap.podspec +2 -2
  52. package/ios/ExpoGaodeMapOfflineModule.swift +60 -0
  53. package/ios/ExpoGaodeMapSearchModule.swift +773 -0
  54. package/ios/modules/LocationManager.swift +9 -3
  55. package/ios/overlays/PolylineView.swift +6 -12
  56. package/package.json +1 -1
  57. package/plugin/build/withGaodeMap.js +12 -0
@@ -101,14 +101,20 @@ class LocationManager: NSObject, AMapLocationManagerDelegate {
101
101
  ensureLocationManager()?.allowsBackgroundLocationUpdates = allows
102
102
  }
103
103
 
104
+ private func setReGeocodeLanguage(_ rawValue: AMapRegionLanguageType.RawValue) {
105
+ if let language = AMapRegionLanguageType(rawValue: rawValue) {
106
+ ensureLocationManager()?.reGeocodeLanguage = language
107
+ }
108
+ }
109
+
104
110
  func setGeoLanguage(_ language: String) {
105
111
  switch language.uppercased() {
106
112
  case "ZH":
107
- ensureLocationManager()?.reGeocodeLanguage = .chinse
113
+ setReGeocodeLanguage(0)
108
114
  case "EN":
109
- ensureLocationManager()?.reGeocodeLanguage = .english
115
+ setReGeocodeLanguage(2)
110
116
  default:
111
- ensureLocationManager()?.reGeocodeLanguage = .default
117
+ setReGeocodeLanguage(0)
112
118
  }
113
119
  }
114
120
 
@@ -71,6 +71,9 @@ class PolylineView: ExpoView {
71
71
  func setMap(_ map: MAMapView) {
72
72
  // 🔑 关键优化:如果是同一个地图引用,跳过重复设置
73
73
  if lastSetMapView === map {
74
+ if polyline == nil {
75
+ updatePolyline()
76
+ }
74
77
  return
75
78
  }
76
79
 
@@ -105,10 +108,9 @@ class PolylineView: ExpoView {
105
108
  // 🔑 至少需要2个点才能绘制折线
106
109
  guard coords.count >= 2 else { return }
107
110
 
111
+ renderer = nil
108
112
  polyline = MAPolyline(coordinates: &coords, count: UInt(coords.count))
109
113
  mapView.add(polyline!)
110
-
111
- renderer = nil
112
114
  }
113
115
 
114
116
  /**
@@ -221,18 +223,10 @@ class PolylineView: ExpoView {
221
223
 
222
224
  /**
223
225
  * 强制重新渲染折线
224
- * 通过移除并重新添加 overlay 来触发地图重新请求 renderer
226
+ * 通过重建 overlay 来触发地图重新请求 renderer
225
227
  */
226
228
  private func forceRerender() {
227
- guard let mapView = mapView, let polyline = polyline else {
228
- return
229
- }
230
-
231
- // 移除旧的 overlay
232
- mapView.remove(polyline)
233
-
234
- // 重新添加(地图会调用 rendererFor overlay)
235
- mapView.add(polyline)
229
+ updatePolyline()
236
230
  }
237
231
 
238
232
  func setDotted(_ dotted: Bool) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "2.2.33",
3
+ "version": "2.2.34",
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",
@@ -186,6 +186,18 @@ configurations.all {
186
186
  */
187
187
  const withGaodeMapAndroidSdk = (config, props) => {
188
188
  return (0, config_plugins_1.withGradleProperties)(config, (config) => {
189
+ const jetifierKey = 'android.enableJetifier';
190
+ const jetifier = config.modResults.find((item) => item.type === 'property' && item.key === jetifierKey);
191
+ if (jetifier && jetifier.type === 'property') {
192
+ jetifier.value = 'true';
193
+ }
194
+ else {
195
+ config.modResults.push({
196
+ type: 'property',
197
+ key: jetifierKey,
198
+ value: 'true',
199
+ });
200
+ }
189
201
  if (props.customMapSdkPath) {
190
202
  const key = 'EXPO_GAODE_MAP_CUSTOM_SDK_PATH';
191
203
  const existing = config.modResults.find((item) => item.type === 'property' && item.key === key);