expo-gaode-map-navigation 2.0.12-next.0 → 2.0.13
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.
- package/README.md +296 -7
- package/android/build.gradle +12 -4
- package/android/src/main/AndroidManifest.xml +10 -1
- package/android/src/main/cpp/cluster_jni.cpp +56 -0
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapModule.kt +49 -8
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapOfflineModule.kt +83 -15
- package/android/src/main/java/expo/modules/gaodemap/map/ExpoGaodeMapView.kt +13 -3
- package/android/src/main/java/expo/modules/gaodemap/map/managers/UIManager.kt +36 -39
- package/android/src/main/java/expo/modules/gaodemap/map/modules/SDKInitializer.kt +23 -17
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/ClusterView.kt +5 -2
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapView.kt +122 -10
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/HeatMapViewModule.kt +2 -2
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerView.kt +37 -25
- package/android/src/main/java/expo/modules/gaodemap/map/overlays/MarkerViewModule.kt +6 -6
- package/android/src/main/java/expo/modules/gaodemap/map/search/ExpoGaodeMapSearchModule.kt +751 -0
- package/android/src/main/java/expo/modules/gaodemap/map/utils/GeometryUtils.kt +103 -0
- package/android/src/main/java/expo/modules/gaodemap/navigation/ExpoGaodeMapNaviView.kt +1408 -394
- package/android/src/main/java/expo/modules/gaodemap/navigation/ExpoGaodeMapNaviViewModule.kt +121 -1
- package/android/src/main/java/expo/modules/gaodemap/navigation/ExpoGaodeMapNavigationModule.kt +14 -28
- package/android/src/main/java/expo/modules/gaodemap/navigation/listeners/IndependentRouteListener.kt +28 -3
- package/android/src/main/java/expo/modules/gaodemap/navigation/listeners/RouteCalculateListener.kt +2 -2
- package/android/src/main/java/expo/modules/gaodemap/navigation/managers/IndependentRouteManager.kt +114 -15
- package/android/src/main/java/expo/modules/gaodemap/navigation/routes/drive/DriveTruckRouteCalculator.kt +24 -35
- package/android/src/main/java/expo/modules/gaodemap/navigation/services/IndependentRouteService.kt +50 -36
- package/android/src/main/java/expo/modules/gaodemap/navigation/services/NavigationForegroundService.kt +661 -0
- package/android/src/main/java/expo/modules/gaodemap/navigation/utils/Converters.kt +21 -12
- package/android/src/main/res/drawable/ic_nav_notification_small.xml +10 -0
- package/android/src/main/res/drawable/landback_0.png +0 -0
- package/android/src/main/res/drawable/landback_1.png +0 -0
- package/android/src/main/res/drawable/landback_2.png +0 -0
- package/android/src/main/res/drawable/landback_3.png +0 -0
- package/android/src/main/res/drawable/landback_4.png +0 -0
- package/android/src/main/res/drawable/landback_5.png +0 -0
- package/android/src/main/res/drawable/landback_6.png +0 -0
- package/android/src/main/res/drawable/landback_7.png +0 -0
- package/android/src/main/res/drawable/landback_8.png +0 -0
- package/android/src/main/res/drawable/landback_9.png +0 -0
- package/android/src/main/res/drawable/landback_a.png +0 -0
- package/android/src/main/res/drawable/landback_b.png +0 -0
- package/android/src/main/res/drawable/landback_c.png +0 -0
- package/android/src/main/res/drawable/landback_d.png +0 -0
- package/android/src/main/res/drawable/landback_e.png +0 -0
- package/android/src/main/res/drawable/landback_f.png +0 -0
- package/android/src/main/res/drawable/landback_g.png +0 -0
- package/android/src/main/res/drawable/landback_h.png +0 -0
- package/android/src/main/res/drawable/landback_i.png +0 -0
- package/android/src/main/res/drawable/landback_j.png +0 -0
- package/android/src/main/res/drawable/landback_k.png +0 -0
- package/android/src/main/res/drawable/landback_l.png +0 -0
- package/android/src/main/res/drawable/landfront_0.png +0 -0
- package/android/src/main/res/drawable/landfront_00.png +0 -0
- package/android/src/main/res/drawable/landfront_1.png +0 -0
- package/android/src/main/res/drawable/landfront_11.png +0 -0
- package/android/src/main/res/drawable/landfront_20.png +0 -0
- package/android/src/main/res/drawable/landfront_21.png +0 -0
- package/android/src/main/res/drawable/landfront_22.png +0 -0
- package/android/src/main/res/drawable/landfront_3.png +0 -0
- package/android/src/main/res/drawable/landfront_33.png +0 -0
- package/android/src/main/res/drawable/landfront_40.png +0 -0
- package/android/src/main/res/drawable/landfront_43.png +0 -0
- package/android/src/main/res/drawable/landfront_44.png +0 -0
- package/android/src/main/res/drawable/landfront_5.png +0 -0
- package/android/src/main/res/drawable/landfront_55.png +0 -0
- package/android/src/main/res/drawable/landfront_61.png +0 -0
- package/android/src/main/res/drawable/landfront_63.png +0 -0
- package/android/src/main/res/drawable/landfront_66.png +0 -0
- package/android/src/main/res/drawable/landfront_70.png +0 -0
- package/android/src/main/res/drawable/landfront_71.png +0 -0
- package/android/src/main/res/drawable/landfront_73.png +0 -0
- package/android/src/main/res/drawable/landfront_77.png +0 -0
- package/android/src/main/res/drawable/landfront_8.png +0 -0
- package/android/src/main/res/drawable/landfront_88.png +0 -0
- package/android/src/main/res/drawable/landfront_90.png +0 -0
- package/android/src/main/res/drawable/landfront_95.png +0 -0
- package/android/src/main/res/drawable/landfront_99.png +0 -0
- package/android/src/main/res/drawable/landfront_a0.png +0 -0
- package/android/src/main/res/drawable/landfront_a8.png +0 -0
- package/android/src/main/res/drawable/landfront_aa.png +0 -0
- package/android/src/main/res/drawable/landfront_b1.png +0 -0
- package/android/src/main/res/drawable/landfront_b5.png +0 -0
- package/android/src/main/res/drawable/landfront_bb.png +0 -0
- package/android/src/main/res/drawable/landfront_c3.png +0 -0
- package/android/src/main/res/drawable/landfront_c8.png +0 -0
- package/android/src/main/res/drawable/landfront_cc.png +0 -0
- package/android/src/main/res/drawable/landfront_d.png +0 -0
- package/android/src/main/res/drawable/landfront_dd.png +0 -0
- package/android/src/main/res/drawable/landfront_e1.png +0 -0
- package/android/src/main/res/drawable/landfront_e5.png +0 -0
- package/android/src/main/res/drawable/landfront_ee.png +0 -0
- package/android/src/main/res/drawable/landfront_f0.png +0 -0
- package/android/src/main/res/drawable/landfront_f1.png +0 -0
- package/android/src/main/res/drawable/landfront_f5.png +0 -0
- package/android/src/main/res/drawable/landfront_ff.png +0 -0
- package/android/src/main/res/drawable/landfront_g3.png +0 -0
- package/android/src/main/res/drawable/landfront_g5.png +0 -0
- package/android/src/main/res/drawable/landfront_gg.png +0 -0
- package/android/src/main/res/drawable/landfront_h1.png +0 -0
- package/android/src/main/res/drawable/landfront_h3.png +0 -0
- package/android/src/main/res/drawable/landfront_h5.png +0 -0
- package/android/src/main/res/drawable/landfront_hh.png +0 -0
- package/android/src/main/res/drawable/landfront_i0.png +0 -0
- package/android/src/main/res/drawable/landfront_i3.png +0 -0
- package/android/src/main/res/drawable/landfront_i5.png +0 -0
- package/android/src/main/res/drawable/landfront_ii.png +0 -0
- package/android/src/main/res/drawable/landfront_j1.png +0 -0
- package/android/src/main/res/drawable/landfront_j8.png +0 -0
- package/android/src/main/res/drawable/landfront_jj.png +0 -0
- package/android/src/main/res/drawable/landfront_kk.png +0 -0
- package/android/src/main/res/drawable/landfront_ll.png +0 -0
- package/android/src/main/res/drawable/nav_notification_brand_icon.xml +16 -0
- package/android/src/main/res/drawable/navi_arrow_leftline.png +0 -0
- package/android/src/main/res/drawable/navi_lane_shape_bg_center.xml +5 -0
- package/android/src/main/res/drawable/navi_lane_shape_bg_left.xml +8 -0
- package/android/src/main/res/drawable/navi_lane_shape_bg_over.xml +6 -0
- package/android/src/main/res/drawable/navi_lane_shape_bg_right.xml +8 -0
- package/android/src/main/res/drawable-nodpi/nav_tracker_car.png +0 -0
- package/build/ExpoGaodeMapNaviView.d.ts +16 -0
- package/build/ExpoGaodeMapNaviView.d.ts.map +1 -1
- package/build/ExpoGaodeMapNaviView.js +74 -1
- package/build/ExpoGaodeMapNaviView.js.map +1 -1
- package/build/index.d.ts +56 -8
- package/build/index.d.ts.map +1 -1
- package/build/index.js +452 -10
- package/build/index.js.map +1 -1
- package/build/map/ExpoGaodeMapModule.d.ts +15 -13
- package/build/map/ExpoGaodeMapModule.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapModule.js +31 -39
- package/build/map/ExpoGaodeMapModule.js.map +1 -1
- package/build/map/ExpoGaodeMapOfflineModule.d.ts +5 -0
- package/build/map/ExpoGaodeMapOfflineModule.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapOfflineModule.js.map +1 -1
- package/build/map/ExpoGaodeMapView.d.ts +3 -4
- package/build/map/ExpoGaodeMapView.d.ts.map +1 -1
- package/build/map/ExpoGaodeMapView.js +28 -25
- package/build/map/ExpoGaodeMapView.js.map +1 -1
- package/build/map/components/overlays/Circle.d.ts.map +1 -1
- package/build/map/components/overlays/Circle.js +1 -30
- package/build/map/components/overlays/Circle.js.map +1 -1
- package/build/map/components/overlays/Cluster.d.ts.map +1 -1
- package/build/map/components/overlays/Cluster.js +1 -42
- package/build/map/components/overlays/Cluster.js.map +1 -1
- package/build/map/components/overlays/HeatMap.d.ts.map +1 -1
- package/build/map/components/overlays/HeatMap.js +21 -21
- package/build/map/components/overlays/HeatMap.js.map +1 -1
- package/build/map/components/overlays/Marker.d.ts.map +1 -1
- package/build/map/components/overlays/Marker.js +76 -80
- package/build/map/components/overlays/Marker.js.map +1 -1
- package/build/map/components/overlays/Polygon.d.ts.map +1 -1
- package/build/map/components/overlays/Polygon.js +1 -25
- package/build/map/components/overlays/Polygon.js.map +1 -1
- package/build/map/components/overlays/Polyline.d.ts.map +1 -1
- package/build/map/components/overlays/Polyline.js +1 -31
- package/build/map/components/overlays/Polyline.js.map +1 -1
- package/build/map/index.d.ts +9 -2
- package/build/map/index.d.ts.map +1 -1
- package/build/map/index.js +9 -2
- package/build/map/index.js.map +1 -1
- package/build/map/search/ExpoGaodeMapSearch.types.d.ts +340 -0
- package/build/map/search/ExpoGaodeMapSearch.types.d.ts.map +1 -0
- package/build/map/search/ExpoGaodeMapSearch.types.js +19 -0
- package/build/map/search/ExpoGaodeMapSearch.types.js.map +1 -0
- package/build/map/search/ExpoGaodeMapSearchModule.d.ts +74 -0
- package/build/map/search/ExpoGaodeMapSearchModule.d.ts.map +1 -0
- package/build/map/search/ExpoGaodeMapSearchModule.js +47 -0
- package/build/map/search/ExpoGaodeMapSearchModule.js.map +1 -0
- package/build/map/search/index.d.ts +156 -0
- package/build/map/search/index.d.ts.map +1 -0
- package/build/map/search/index.js +171 -0
- package/build/map/search/index.js.map +1 -0
- package/build/map/types/index.d.ts +2 -2
- package/build/map/types/index.d.ts.map +1 -1
- package/build/map/types/index.js.map +1 -1
- package/build/map/types/map-view.types.d.ts +4 -2
- package/build/map/types/map-view.types.d.ts.map +1 -1
- package/build/map/types/map-view.types.js.map +1 -1
- package/build/map/types/native-module.types.d.ts +11 -12
- package/build/map/types/native-module.types.d.ts.map +1 -1
- package/build/map/types/native-module.types.js.map +1 -1
- package/build/map/types/overlays.types.d.ts +9 -14
- package/build/map/types/overlays.types.d.ts.map +1 -1
- package/build/map/types/overlays.types.js.map +1 -1
- package/build/map/types/route-playback.types.d.ts +16 -0
- package/build/map/types/route-playback.types.d.ts.map +1 -1
- package/build/map/types/route-playback.types.js.map +1 -1
- package/build/map/utils/ErrorHandler.js +11 -11
- package/build/map/utils/ErrorHandler.js.map +1 -1
- package/build/map/utils/OfflineMapManager.d.ts +4 -0
- package/build/map/utils/OfflineMapManager.d.ts.map +1 -1
- package/build/map/utils/OfflineMapManager.js +6 -0
- package/build/map/utils/OfflineMapManager.js.map +1 -1
- package/build/types/coordinates.types.d.ts +3 -0
- package/build/types/coordinates.types.d.ts.map +1 -1
- package/build/types/coordinates.types.js.map +1 -1
- package/build/types/independent.types.d.ts +111 -12
- package/build/types/independent.types.d.ts.map +1 -1
- package/build/types/independent.types.js.map +1 -1
- package/build/types/native-module.types.d.ts +1 -1
- package/build/types/native-module.types.js.map +1 -1
- package/build/types/naviview.types.d.ts +304 -14
- package/build/types/naviview.types.d.ts.map +1 -1
- package/build/types/naviview.types.js.map +1 -1
- package/build/types/route.types.d.ts +12 -2
- package/build/types/route.types.d.ts.map +1 -1
- package/build/types/route.types.js.map +1 -1
- package/expo-module.config.json +4 -2
- package/ios/ExpoGaodeMapNaviView.swift +2331 -201
- package/ios/ExpoGaodeMapNaviViewModule.swift +109 -1
- package/ios/ExpoGaodeMapNavigation.podspec +2 -1
- package/ios/ExpoGaodeMapNavigationModule.swift +7 -5
- package/ios/managers/IndependentRouteManager.swift +90 -26
- package/ios/map/ExpoGaodeMapModule.swift +72 -21
- package/ios/map/ExpoGaodeMapOfflineModule.swift +61 -0
- package/ios/map/ExpoGaodeMapSearchModule.swift +773 -0
- package/ios/map/ExpoGaodeMapView.swift +23 -5
- package/ios/map/GaodeMapPrivacyManager.swift +26 -18
- package/ios/map/cpp/GeometryEngine.cpp +112 -0
- package/ios/map/cpp/GeometryEngine.hpp +21 -0
- package/ios/map/modules/LocationManager.swift +37 -5
- package/ios/map/overlays/MarkerView.swift +11 -11
- package/ios/map/overlays/MarkerViewModule.swift +4 -4
- package/ios/map/overlays/PolylineView.swift +6 -12
- package/ios/map/utils/ClusterNative.h +8 -0
- package/ios/map/utils/ClusterNative.mm +27 -0
- package/ios/map/utils/PermissionManager.swift +115 -6
- package/ios/routes/drive/DriveTruckRouteCalculator.swift +165 -77
- package/ios/routes/walkride/WalkRideRouteCalculator.swift +127 -1
- package/ios/services/IndependentRouteService.swift +198 -39
- package/ios/services/NavigationLiveActivityAttributes.swift +48 -0
- package/ios/services/NavigationLiveActivityManager.swift +359 -0
- package/package.json +22 -7
- package/plugin/build/withGaodeMap.d.ts +8 -0
- package/plugin/build/withGaodeMap.js +60 -4
- package/scripts/check-expo-modules.js +68 -0
- package/shared/cpp/GeometryEngine.cpp +112 -0
- package/shared/cpp/GeometryEngine.hpp +21 -0
- package/widget-template/README.md +46 -0
- package/widget-template/ios/NavigationLiveActivityWidget.swift +367 -0
- package/android/src/main/java/expo/modules/gaodemap/navigation/managers/RouteCalculator.kt +0 -173
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import ExpoGaodeMapModule from '../../ExpoGaodeMapModule';
|
|
3
4
|
import { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';
|
|
4
5
|
import { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';
|
|
5
6
|
const getNativeMarkerView = createLazyNativeViewManager('MarkerView');
|
|
6
7
|
const AUTO_SIZE_FALLBACK = { width: 0, height: 0 };
|
|
7
|
-
function areSmoothMovePathsEqual(prevPath, nextPath) {
|
|
8
|
-
if (prevPath === nextPath) {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
if (!prevPath || !nextPath) {
|
|
12
|
-
return prevPath === nextPath;
|
|
13
|
-
}
|
|
14
|
-
if (prevPath.length !== nextPath.length) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
for (let index = 0; index < prevPath.length; index += 1) {
|
|
18
|
-
const prevPoint = normalizeLatLng(prevPath[index]);
|
|
19
|
-
const nextPoint = normalizeLatLng(nextPath[index]);
|
|
20
|
-
if (prevPoint.latitude !== nextPoint.latitude ||
|
|
21
|
-
prevPoint.longitude !== nextPoint.longitude) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
8
|
/**
|
|
28
9
|
* Marker 组件 - 完全声明式 API
|
|
29
10
|
*
|
|
@@ -38,27 +19,82 @@ function Marker(props) {
|
|
|
38
19
|
const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);
|
|
39
20
|
const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);
|
|
40
21
|
// 从 props 中排除 position 属性,避免传递到原生层
|
|
41
|
-
const { position,
|
|
22
|
+
const { position, iconWidth, iconHeight, children, smoothMovePath, cacheKey, ...restProps } = props;
|
|
42
23
|
// 归一化坐标处理
|
|
43
24
|
const normalizedPosition = normalizeLatLng(position);
|
|
44
25
|
const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;
|
|
45
26
|
// 根据是否有 children 来决定使用哪个尺寸属性
|
|
46
27
|
const hasChildren = !!children;
|
|
47
28
|
const shouldWrapChildrenForMeasurement = hasChildren;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
29
|
+
// Android 的 children marker 之前始终透传 0 尺寸,点击后重新快照时容易直接消失。
|
|
30
|
+
// 统一走自动测量后,两个平台都会拿到稳定尺寸。
|
|
31
|
+
const shouldUseAutoMeasuredSize = hasChildren;
|
|
32
|
+
const resolvedContentWidth = shouldUseAutoMeasuredSize ? measuredSize.width : 0;
|
|
33
|
+
const resolvedContentHeight = shouldUseAutoMeasuredSize ? measuredSize.height : 0;
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (!normalizedSmoothMovePath ||
|
|
36
|
+
normalizedSmoothMovePath.length < 2 ||
|
|
37
|
+
!props.smoothMoveDuration ||
|
|
38
|
+
props.smoothMoveDuration <= 0) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const totalDistance = ExpoGaodeMapModule.calculatePathLength(normalizedSmoothMovePath);
|
|
42
|
+
if (totalDistance <= 0) {
|
|
43
|
+
props.onSmoothMoveEnd?.({
|
|
44
|
+
nativeEvent: {
|
|
45
|
+
position: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1],
|
|
46
|
+
angle: 0,
|
|
47
|
+
totalDistance,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const durationMs = props.smoothMoveDuration * 1000;
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
const tick = () => {
|
|
55
|
+
const progress = Math.min(1, (Date.now() - startedAt) / durationMs);
|
|
56
|
+
const distance = totalDistance * progress;
|
|
57
|
+
const pointInfo = ExpoGaodeMapModule.getPointAtDistance(normalizedSmoothMovePath, distance);
|
|
58
|
+
const point = pointInfo
|
|
59
|
+
? { latitude: pointInfo.latitude, longitude: pointInfo.longitude }
|
|
60
|
+
: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1];
|
|
61
|
+
const angle = pointInfo?.angle ?? 0;
|
|
62
|
+
props.onSmoothMoveProgress?.({
|
|
63
|
+
nativeEvent: {
|
|
64
|
+
position: point,
|
|
65
|
+
angle,
|
|
66
|
+
progress,
|
|
67
|
+
distance,
|
|
68
|
+
totalDistance,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
if (progress >= 1) {
|
|
72
|
+
props.onSmoothMoveEnd?.({
|
|
73
|
+
nativeEvent: {
|
|
74
|
+
position: point,
|
|
75
|
+
angle,
|
|
76
|
+
totalDistance,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
tick();
|
|
82
|
+
const intervalId = setInterval(() => {
|
|
83
|
+
tick();
|
|
84
|
+
if (Date.now() - startedAt >= durationMs) {
|
|
85
|
+
clearInterval(intervalId);
|
|
86
|
+
}
|
|
87
|
+
}, 100);
|
|
88
|
+
return () => clearInterval(intervalId);
|
|
89
|
+
}, [
|
|
90
|
+
normalizedSmoothMovePath,
|
|
91
|
+
props.onSmoothMoveEnd,
|
|
92
|
+
props.onSmoothMoveProgress,
|
|
93
|
+
props.smoothMoveDuration,
|
|
94
|
+
]);
|
|
55
95
|
const handleAutoMeasure = (event) => {
|
|
56
|
-
const nextWidth =
|
|
57
|
-
|
|
58
|
-
: Math.ceil(event.nativeEvent.layout.width);
|
|
59
|
-
const nextHeight = customViewHeight && customViewHeight > 0
|
|
60
|
-
? customViewHeight
|
|
61
|
-
: Math.ceil(event.nativeEvent.layout.height);
|
|
96
|
+
const nextWidth = Math.ceil(event.nativeEvent.layout.width);
|
|
97
|
+
const nextHeight = Math.ceil(event.nativeEvent.layout.height);
|
|
62
98
|
if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {
|
|
63
99
|
return;
|
|
64
100
|
}
|
|
@@ -69,59 +105,19 @@ function Marker(props) {
|
|
|
69
105
|
};
|
|
70
106
|
// 智能尺寸计算
|
|
71
107
|
const finalIconWidth = hasChildren
|
|
72
|
-
?
|
|
108
|
+
? resolvedContentWidth
|
|
73
109
|
: (iconWidth && iconWidth > 0 ? iconWidth : 40);
|
|
74
110
|
const finalIconHeight = hasChildren
|
|
75
|
-
?
|
|
111
|
+
? resolvedContentHeight
|
|
76
112
|
: (iconHeight && iconHeight > 0 ? iconHeight : 40);
|
|
77
113
|
const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;
|
|
78
|
-
return (<NativeMarkerView latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight}
|
|
79
|
-
{hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={
|
|
114
|
+
return (<NativeMarkerView {...restProps} {...optionalNativeProps} latitude={normalizedPosition.latitude} longitude={normalizedPosition.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight} contentWidth={hasChildren ? finalIconWidth : 0} contentHeight={hasChildren ? finalIconHeight : 0} smoothMovePath={normalizedSmoothMovePath}>
|
|
115
|
+
{hasChildren && shouldWrapChildrenForMeasurement ? (<View collapsable={false} onLayout={handleAutoMeasure} style={styles.measureContainer}>
|
|
80
116
|
{children}
|
|
81
117
|
</View>) : children}
|
|
82
118
|
</NativeMarkerView>);
|
|
83
119
|
}
|
|
84
|
-
|
|
85
|
-
* 🔑 性能优化:极简比较函数
|
|
86
|
-
* 只检查最常变化的关键属性,减少 JS 线程开销
|
|
87
|
-
*/
|
|
88
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
89
|
-
// 快速路径:比较 position (最常变化)
|
|
90
|
-
const prevPos = normalizeLatLng(prevProps.position);
|
|
91
|
-
const nextPos = normalizeLatLng(nextProps.position);
|
|
92
|
-
if (prevPos.latitude !== nextPos.latitude ||
|
|
93
|
-
prevPos.longitude !== nextPos.longitude) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
// 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)
|
|
97
|
-
if (prevProps.cacheKey !== nextProps.cacheKey) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
// 比较 children (如果有 children)
|
|
101
|
-
if (prevProps.children !== nextProps.children) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
// 比较自定义内容尺寸和图标尺寸
|
|
105
|
-
if (prevProps.customViewWidth !== nextProps.customViewWidth ||
|
|
106
|
-
prevProps.customViewHeight !== nextProps.customViewHeight ||
|
|
107
|
-
prevProps.icon !== nextProps.icon ||
|
|
108
|
-
prevProps.iconWidth !== nextProps.iconWidth ||
|
|
109
|
-
prevProps.iconHeight !== nextProps.iconHeight) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
// 比较 smoothMovePath (平滑移动路径)
|
|
113
|
-
if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
// 比较 smoothMoveDuration (平滑移动时长)
|
|
117
|
-
if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
// 其他属性相同,不重新渲染
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
// 导出优化后的组件
|
|
124
|
-
export default React.memo(Marker, arePropsEqual);
|
|
120
|
+
export default React.memo(Marker);
|
|
125
121
|
const styles = StyleSheet.create({
|
|
126
122
|
measureContainer: {
|
|
127
123
|
alignSelf: 'flex-start',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,eAAe,E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AO,KAAK,CAAC;IACf,CAAC;IAED,6BAA6B;IAC7B,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;QACjF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iCAAiC;IACjC,IAAI,SAAS,CAAC,kBAAkB,KAAK,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAEjD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { Platform, StyleSheet, View } from 'react-native';\nimport type { MarkerProps } from '../../types';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\nconst AUTO_SIZE_FALLBACK = { width: 0, height: 0 };\n\nfunction areSmoothMovePathsEqual(\n prevPath: MarkerProps['smoothMovePath'],\n nextPath: MarkerProps['smoothMovePath']\n): boolean {\n if (prevPath === nextPath) {\n return true;\n }\n\n if (!prevPath || !nextPath) {\n return prevPath === nextPath;\n }\n\n if (prevPath.length !== nextPath.length) {\n return false;\n }\n\n for (let index = 0; index < prevPath.length; index += 1) {\n const prevPoint = normalizeLatLng(prevPath[index]);\n const nextPoint = normalizeLatLng(nextPath[index]);\n\n if (\n prevPoint.latitude !== nextPoint.latitude ||\n prevPoint.longitude !== nextPoint.longitude\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);\n // 从 props 中排除 position 属性,避免传递到原生层\n const {\n position,\n customViewWidth,\n customViewHeight,\n iconWidth,\n iconHeight,\n children,\n smoothMovePath,\n cacheKey,\n ...restProps\n } = props;\n \n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const shouldWrapChildrenForMeasurement = hasChildren;\n const shouldUseAutoMeasuredSize = Platform.OS === 'ios';\n const resolvedCustomViewWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : (shouldUseAutoMeasuredSize ? measuredSize.width : 0);\n const resolvedCustomViewHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : (shouldUseAutoMeasuredSize ? measuredSize.height : 0);\n\n const handleAutoMeasure = (event: LayoutChangeEvent) => {\n const nextWidth = customViewWidth && customViewWidth > 0\n ? customViewWidth\n : Math.ceil(event.nativeEvent.layout.width);\n const nextHeight = customViewHeight && customViewHeight > 0\n ? customViewHeight\n : Math.ceil(event.nativeEvent.layout.height);\n\n if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {\n return;\n }\n\n setMeasuredSize({\n width: nextWidth,\n height: nextHeight,\n });\n };\n \n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? resolvedCustomViewWidth\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n \n const finalIconHeight = hasChildren\n ? resolvedCustomViewHeight\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n\n const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;\n \n return (\n <NativeMarkerView\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n customViewWidth={finalIconWidth}\n customViewHeight={finalIconHeight}\n smoothMovePath={normalizedSmoothMovePath}\n {...optionalNativeProps}\n {...restProps}\n >\n {hasChildren && shouldWrapChildrenForMeasurement ? (\n <View\n collapsable={false}\n onLayout={Platform.OS === 'ios' ? handleAutoMeasure : undefined}\n style={styles.measureContainer}\n >\n {children}\n </View>\n ) : children}\n </NativeMarkerView>\n );\n}\n\n/**\n * 🔑 性能优化:极简比较函数\n * 只检查最常变化的关键属性,减少 JS 线程开销\n */\nfunction arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {\n // 快速路径:比较 position (最常变化)\n const prevPos = normalizeLatLng(prevProps.position);\n const nextPos = normalizeLatLng(nextProps.position);\n\n if (\n prevPos.latitude !== nextPos.latitude ||\n prevPos.longitude !== nextPos.longitude\n ) {\n return false;\n }\n \n // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)\n if (prevProps.cacheKey !== nextProps.cacheKey) {\n return false;\n }\n \n // 比较 children (如果有 children)\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n\n // 比较自定义内容尺寸和图标尺寸\n if (\n prevProps.customViewWidth !== nextProps.customViewWidth ||\n prevProps.customViewHeight !== nextProps.customViewHeight ||\n prevProps.icon !== nextProps.icon ||\n prevProps.iconWidth !== nextProps.iconWidth ||\n prevProps.iconHeight !== nextProps.iconHeight\n ) {\n return false;\n }\n \n // 比较 smoothMovePath (平滑移动路径)\n if (!areSmoothMovePathsEqual(prevProps.smoothMovePath, nextProps.smoothMovePath)) {\n return false;\n }\n \n // 比较 smoothMoveDuration (平滑移动时长)\n if (prevProps.smoothMoveDuration !== nextProps.smoothMoveDuration) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Marker, arePropsEqual);\n\nconst styles = StyleSheet.create({\n measureContainer: {\n alignSelf: 'flex-start',\n alignItems: 'flex-start',\n flexShrink: 0,\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAShF,MAAM,mBAAmB,GAAG,2BAA2B,CAAwB,YAAY,CAAC,CAAC;AAE7F,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAEnD;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,KAAkB;IAChC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC;IACxE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC3E,mCAAmC;IACnC,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,UAAU;IACV,MAAM,kBAAkB,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACrD,MAAM,wBAAwB,GAAG,cAAc,CAAC,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC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AC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/C,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACjD,cAAc,CAAC,CAAC,wBAAwB,CAAC,CAEzC;MAAA,CAAC,WAAW,IAAI,gCAAgC,CAAC,CAAC,CAAC,CACjD,CAAC,IAAI,CACH,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAE/B;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,QAAQ,CACd;IAAA,EAAE,gBAAgB,CAAC,CACpB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAElC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,gBAAgB,EAAE;QAChB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,YAAY;QACxB,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { LayoutChangeEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\nimport type { MarkerProps } from '../../types';\nimport ExpoGaodeMapModule from '../../ExpoGaodeMapModule';\nimport { normalizeLatLng, normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\n\ntype NativeMarkerViewProps = Omit<MarkerProps, 'position'> & {\n latitude: number;\n longitude: number;\n contentWidth?: number;\n contentHeight?: number;\n};\n\nconst getNativeMarkerView = createLazyNativeViewManager<NativeMarkerViewProps>('MarkerView');\n\nconst AUTO_SIZE_FALLBACK = { width: 0, height: 0 };\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)- 自动测量尺寸\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n const NativeMarkerView = React.useMemo(() => getNativeMarkerView(), []);\n const [measuredSize, setMeasuredSize] = React.useState(AUTO_SIZE_FALLBACK);\n // 从 props 中排除 position 属性,避免传递到原生层\n const {\n position,\n iconWidth,\n iconHeight,\n children,\n smoothMovePath,\n cacheKey,\n ...restProps\n } = props;\n\n // 归一化坐标处理\n const normalizedPosition = normalizeLatLng(position);\n const normalizedSmoothMovePath = smoothMovePath ? normalizeLatLngList(smoothMovePath) : undefined;\n\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const shouldWrapChildrenForMeasurement = hasChildren;\n // Android 的 children marker 之前始终透传 0 尺寸,点击后重新快照时容易直接消失。\n // 统一走自动测量后,两个平台都会拿到稳定尺寸。\n const shouldUseAutoMeasuredSize = hasChildren;\n const resolvedContentWidth = shouldUseAutoMeasuredSize ? measuredSize.width : 0;\n const resolvedContentHeight = shouldUseAutoMeasuredSize ? measuredSize.height : 0;\n\n React.useEffect(() => {\n if (\n !normalizedSmoothMovePath ||\n normalizedSmoothMovePath.length < 2 ||\n !props.smoothMoveDuration ||\n props.smoothMoveDuration <= 0\n ) {\n return undefined;\n }\n\n const totalDistance = ExpoGaodeMapModule.calculatePathLength(normalizedSmoothMovePath);\n if (totalDistance <= 0) {\n props.onSmoothMoveEnd?.({\n nativeEvent: {\n position: normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1],\n angle: 0,\n totalDistance,\n },\n } as never);\n return undefined;\n }\n\n const durationMs = props.smoothMoveDuration * 1000;\n const startedAt = Date.now();\n const tick = () => {\n const progress = Math.min(1, (Date.now() - startedAt) / durationMs);\n const distance = totalDistance * progress;\n const pointInfo = ExpoGaodeMapModule.getPointAtDistance(normalizedSmoothMovePath, distance);\n const point = pointInfo\n ? { latitude: pointInfo.latitude, longitude: pointInfo.longitude }\n : normalizedSmoothMovePath[normalizedSmoothMovePath.length - 1];\n const angle = pointInfo?.angle ?? 0;\n\n props.onSmoothMoveProgress?.({\n nativeEvent: {\n position: point,\n angle,\n progress,\n distance,\n totalDistance,\n },\n } as never);\n\n if (progress >= 1) {\n props.onSmoothMoveEnd?.({\n nativeEvent: {\n position: point,\n angle,\n totalDistance,\n },\n } as never);\n }\n };\n\n tick();\n const intervalId = setInterval(() => {\n tick();\n if (Date.now() - startedAt >= durationMs) {\n clearInterval(intervalId);\n }\n }, 100);\n\n return () => clearInterval(intervalId);\n }, [\n normalizedSmoothMovePath,\n props.onSmoothMoveEnd,\n props.onSmoothMoveProgress,\n props.smoothMoveDuration,\n ]);\n\n const handleAutoMeasure = (event: LayoutChangeEvent) => {\n const nextWidth = Math.ceil(event.nativeEvent.layout.width);\n const nextHeight = Math.ceil(event.nativeEvent.layout.height);\n\n if (nextWidth === measuredSize.width && nextHeight === measuredSize.height) {\n return;\n }\n\n setMeasuredSize({\n width: nextWidth,\n height: nextHeight,\n });\n };\n\n // 智能尺寸计算\n const finalIconWidth = hasChildren\n ? resolvedContentWidth\n : (iconWidth && iconWidth > 0 ? iconWidth : 40);\n\n const finalIconHeight = hasChildren\n ? resolvedContentHeight\n : (iconHeight && iconHeight > 0 ? iconHeight : 40);\n\n const optionalNativeProps = cacheKey != null ? { cacheKey } : undefined;\n\n return (\n <NativeMarkerView\n {...restProps}\n {...optionalNativeProps}\n latitude={normalizedPosition.latitude}\n longitude={normalizedPosition.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n contentWidth={hasChildren ? finalIconWidth : 0}\n contentHeight={hasChildren ? finalIconHeight : 0}\n smoothMovePath={normalizedSmoothMovePath}\n >\n {hasChildren && shouldWrapChildrenForMeasurement ? (\n <View\n collapsable={false}\n onLayout={handleAutoMeasure}\n style={styles.measureContainer}\n >\n {children}\n </View>\n ) : children}\n </NativeMarkerView>\n );\n}\n\nexport default React.memo(Marker);\n\nconst styles = StyleSheet.create({\n measureContainer: {\n alignSelf: 'flex-start',\n alignItems: 'flex-start',\n flexShrink: 0,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAOnC;;
|
|
1
|
+
{"version":3,"file":"Polygon.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD;;;;;GAKG;AACH,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAOnC;;AAED,wBAAmC"}
|
|
@@ -15,29 +15,5 @@ function Polygon(props) {
|
|
|
15
15
|
const normalizedPoints = normalizeLatLngList(points);
|
|
16
16
|
return <NativePolygonView points={normalizedPoints} {...restProps}/>;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* 🔑 性能优化:浅比较关键属性
|
|
20
|
-
*/
|
|
21
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
22
|
-
// 比较 points 数组引用(最常变化)
|
|
23
|
-
if (prevProps.points !== nextProps.points) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// 比较样式属性
|
|
27
|
-
if (prevProps.strokeWidth !== nextProps.strokeWidth ||
|
|
28
|
-
prevProps.strokeColor !== nextProps.strokeColor ||
|
|
29
|
-
prevProps.fillColor !== nextProps.fillColor ||
|
|
30
|
-
prevProps.zIndex !== nextProps.zIndex ||
|
|
31
|
-
prevProps.simplificationTolerance !== nextProps.simplificationTolerance) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
// 比较回调
|
|
35
|
-
if (prevProps.onPolygonPress !== nextProps.onPolygonPress ||
|
|
36
|
-
prevProps.onPolygonSimplified !== nextProps.onPolygonSimplified) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
// 导出优化后的组件
|
|
42
|
-
export default React.memo(Polygon, arePropsEqual);
|
|
18
|
+
export default React.memo(Polygon);
|
|
43
19
|
//# sourceMappingURL=Polygon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,oBAAoB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACxE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"Polygon.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polygon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,oBAAoB,GAAG,2BAA2B,CAAe,aAAa,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACxE,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { PolygonProps } from '../../types';\nimport { normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\nconst getNativePolygonView = createLazyNativeViewManager<PolygonProps>('PolygonView');\n\n/**\n * 渲染一个高德地图多边形覆盖物组件\n *\n * @param props - 多边形属性配置,继承自PolygonProps类型\n * @returns 高德地图原生多边形视图组件\n */\nfunction Polygon(props: PolygonProps) {\n const NativePolygonView = React.useMemo(() => getNativePolygonView(), []);\n const { points, ...restProps } = props;\n // 归一化坐标数组\n const normalizedPoints = normalizeLatLngList(points);\n\n return <NativePolygonView points={normalizedPoints} {...restProps} />;\n}\n\nexport default React.memo(Polygon);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAOrC;;
|
|
1
|
+
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;GAKG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAOrC;;AAED,wBAAoC"}
|
|
@@ -15,35 +15,5 @@ function Polyline(props) {
|
|
|
15
15
|
const normalizedPoints = normalizeLatLngList(points);
|
|
16
16
|
return <NativePolylineView points={normalizedPoints} {...restProps}/>;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* 🔑 性能优化:浅比较关键属性
|
|
20
|
-
*/
|
|
21
|
-
function arePropsEqual(prevProps, nextProps) {
|
|
22
|
-
// 比较 points 数组引用(最常变化)
|
|
23
|
-
if (prevProps.points !== nextProps.points) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// 比较样式属性
|
|
27
|
-
if (prevProps.strokeWidth !== nextProps.strokeWidth ||
|
|
28
|
-
prevProps.strokeColor !== nextProps.strokeColor ||
|
|
29
|
-
prevProps.zIndex !== nextProps.zIndex ||
|
|
30
|
-
prevProps.geodesic !== nextProps.geodesic ||
|
|
31
|
-
prevProps.dotted !== nextProps.dotted ||
|
|
32
|
-
prevProps.gradient !== nextProps.gradient ||
|
|
33
|
-
prevProps.simplificationTolerance !== nextProps.simplificationTolerance ||
|
|
34
|
-
prevProps.texture !== nextProps.texture) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
// 比较 colors 数组
|
|
38
|
-
if (prevProps.colors !== nextProps.colors) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
// 比较回调
|
|
42
|
-
if (prevProps.onPolylinePress !== nextProps.onPolylinePress) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
// 导出优化后的组件
|
|
48
|
-
export default React.memo(Polyline, arePropsEqual);
|
|
18
|
+
export default React.memo(Polyline);
|
|
49
19
|
//# sourceMappingURL=Polyline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,qBAAqB,GAAG,2BAA2B,CAAgB,cAAc,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoB;IACpC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACzE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"Polyline.js","sourceRoot":"","sources":["../../../../src/map/components/overlays/Polyline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,MAAM,qBAAqB,GAAG,2BAA2B,CAAgB,cAAc,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAoB;IACpC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,qBAAqB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IACvC,UAAU;IACV,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAG,CAAC;AACzE,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport type { PolylineProps } from '../../types';\nimport { normalizeLatLngList } from '../../utils/GeoUtils';\nimport { createLazyNativeViewManager } from '../../utils/lazyNativeViewManager';\nconst getNativePolylineView = createLazyNativeViewManager<PolylineProps>('PolylineView');\n\n/**\n * 渲染高德地图上的折线覆盖物组件\n *\n * @param props - 折线属性配置,继承自PolylineProps类型\n * @returns 高德地图原生折线视图组件\n */\nfunction Polyline(props: PolylineProps) {\n const NativePolylineView = React.useMemo(() => getNativePolylineView(), []);\n const { points, ...restProps } = props;\n // 归一化坐标数组\n const normalizedPoints = normalizeLatLngList(points);\n \n return <NativePolylineView points={normalizedPoints} {...restProps} />;\n}\n\nexport default React.memo(Polyline);\n"]}
|
package/build/map/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionUtils, LocationPermissionType } from './utils/PermissionUtils';
|
|
1
2
|
export * from './types';
|
|
2
3
|
export { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';
|
|
3
4
|
export { default as MapView } from './ExpoGaodeMapView';
|
|
@@ -8,8 +9,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
|
|
|
8
9
|
export type { ErrorDetails } from './utils/ErrorHandler';
|
|
9
10
|
export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
|
|
10
11
|
export type { DeviceInfo, SystemVersion } from './utils/PlatformDetector';
|
|
11
|
-
export { PermissionUtils,
|
|
12
|
-
|
|
12
|
+
export { PermissionUtils, LocationPermissionType };
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated 请使用 `PermissionUtils`
|
|
15
|
+
*/
|
|
16
|
+
export declare const PermissionManager: typeof PermissionUtils;
|
|
13
17
|
export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
|
|
14
18
|
export type { FoldableMapViewProps, FoldableConfig, } from './components/FoldableMapView';
|
|
15
19
|
export { OfflineMapManager as ExpoGaodeMapOfflineModule } from './utils/OfflineMapManager';
|
|
@@ -25,4 +29,7 @@ export type { OfflineMapInfo, OfflineMapStatus, OfflineMapDownloadConfig, Offlin
|
|
|
25
29
|
*/
|
|
26
30
|
export declare const useLocationPermissions: (options?: import("expo-modules-core").PermissionHookOptions<object> | undefined) => [import("./types").PermissionStatus | null, () => Promise<import("./types").PermissionStatus>, () => Promise<import("./types").PermissionStatus>];
|
|
27
31
|
export { getSDKConfig, getWebKey } from './ExpoGaodeMapModule';
|
|
32
|
+
export { initSearch, searchPOI, searchNearby, searchAlong, searchPolygon, getInputTips, reGeocode, getPoiDetail, SearchType, } from './search';
|
|
33
|
+
export type { Coordinates as SearchCoordinates, POI, POISearchOptions, NearbySearchOptions, AlongSearchOptions, PolygonSearchOptions, InputTipsOptions, InputTip, SearchResult, InputTipsResult, ReGeocodeOptions, ReGeocodeResult, AddressComponent, Road, RoadCross, AOI, RoutePOIType, } from './search';
|
|
34
|
+
export { default as Search } from './search';
|
|
28
35
|
//# sourceMappingURL=index.d.ts.map
|
package/build/map/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"
|
|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BAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAM/B;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,wOAGjC,CAAA;AAGF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,WAAW,IAAI,iBAAiB,EAChC,GAAG,EACH,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,SAAS,EACT,GAAG,EACH,YAAY,GACb,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/build/map/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPermissionHook } from 'expo-modules-core';
|
|
2
2
|
import ExpoGaodeMapModuleWithHelpers from './ExpoGaodeMapModule';
|
|
3
|
+
import { PermissionUtils, LocationPermissionType, } from './utils/PermissionUtils';
|
|
3
4
|
// 导出类型定义(包含所有通用类型)
|
|
4
5
|
export * from './types';
|
|
5
6
|
// 导出原生模块
|
|
@@ -15,8 +16,11 @@ export { ErrorHandler, ErrorLogger, GaodeMapError, ErrorType, } from './utils/Er
|
|
|
15
16
|
// 导出平台检测工具
|
|
16
17
|
export { PlatformDetector, DeviceType, FoldState, isAndroid14Plus, isiOS17Plus, isTablet, isFoldable, isIPad, } from './utils/PlatformDetector';
|
|
17
18
|
// 导出权限工具类(仅提供文案和诊断,实际权限请求使用 ExpoGaodeMapModule)
|
|
18
|
-
export { PermissionUtils,
|
|
19
|
-
|
|
19
|
+
export { PermissionUtils, LocationPermissionType };
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated 请使用 `PermissionUtils`
|
|
22
|
+
*/
|
|
23
|
+
export const PermissionManager = PermissionUtils;
|
|
20
24
|
// 导出折叠屏适配组件
|
|
21
25
|
export { FoldableMapView, useFoldableMap, } from './components/FoldableMapView';
|
|
22
26
|
// 导出离线地图 API
|
|
@@ -38,4 +42,7 @@ export const useLocationPermissions = createPermissionHook({
|
|
|
38
42
|
});
|
|
39
43
|
// 导出便捷读取的 SDK 配置与 webKey
|
|
40
44
|
export { getSDKConfig, getWebKey } from './ExpoGaodeMapModule';
|
|
45
|
+
// 导出内置搜索 API
|
|
46
|
+
export { initSearch, searchPOI, searchNearby, searchAlong, searchPolygon, getInputTips, reGeocode, getPoiDetail, SearchType, } from './search';
|
|
47
|
+
export { default as Search } from './search';
|
|
41
48
|
//# sourceMappingURL=index.js.map
|
package/build/map/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,6BAA6B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,6BAA6B,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,mBAAmB;AACnB,cAAc,SAAS,CAAC;AACxB,SAAS;AACT,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,WAAW;AACX,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,M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,EAAE,MAAM,UAAU,CAAC","sourcesContent":["\nimport { createPermissionHook } from 'expo-modules-core';\nimport ExpoGaodeMapModuleWithHelpers from './ExpoGaodeMapModule';\nimport {\n PermissionUtils,\n LocationPermissionType,\n} from './utils/PermissionUtils';\n\n// 导出类型定义(包含所有通用类型)\nexport * from './types';\n// 导出原生模块\nexport { default as ExpoGaodeMapModule } from './ExpoGaodeMapModule';\n\n// 导出地图视图组件\nexport { default as MapView } from './ExpoGaodeMapView';\nexport { useMap } from './components/MapContext';\nexport { MapUI } from './components/MapUI';\n\n// 导出覆盖物组件\nexport {\n Marker,\n Polyline,\n Polygon,\n Circle,\n HeatMap,\n MultiPoint,\n Cluster,\n} from './components/overlays';\n\n// 导出错误处理工具\nexport {\n ErrorHandler,\n ErrorLogger,\n GaodeMapError,\n ErrorType,\n} from './utils/ErrorHandler';\nexport type { ErrorDetails } from './utils/ErrorHandler';\n\n// 导出平台检测工具\nexport {\n PlatformDetector,\n DeviceType,\n FoldState,\n isAndroid14Plus,\n isiOS17Plus,\n isTablet,\n isFoldable,\n isIPad,\n} from './utils/PlatformDetector';\nexport type { DeviceInfo, SystemVersion } from './utils/PlatformDetector';\n\n// 导出权限工具类(仅提供文案和诊断,实际权限请求使用 ExpoGaodeMapModule)\nexport { PermissionUtils, LocationPermissionType };\n\n/**\n * @deprecated 请使用 `PermissionUtils`\n */\nexport const PermissionManager = PermissionUtils;\n\n// 导出折叠屏适配组件\nexport {\n FoldableMapView,\n useFoldableMap,\n} from './components/FoldableMapView';\nexport type {\n FoldableMapViewProps,\n FoldableConfig,\n} from './components/FoldableMapView';\n\n// 导出离线地图 API\nexport { OfflineMapManager as ExpoGaodeMapOfflineModule } from './utils/OfflineMapManager';\n\nexport type {\n OfflineMapInfo,\n OfflineMapStatus,\n OfflineMapDownloadConfig,\n OfflineMapDownloadEvent,\n OfflineMapCompleteEvent,\n OfflineMapErrorEvent,\n OfflineMapPausedEvent,\n OfflineMapCancelledEvent,\n OfflineMapStorageInfo,\n OfflineMapEvents,\n} from './types/offline.types';\n\nconst requestPermissionsAsync = ExpoGaodeMapModuleWithHelpers.requestLocationPermission\nconst getPermissionsAsync = ExpoGaodeMapModuleWithHelpers.checkLocationPermission\n\n\n/**\n * Check or request permissions to access the location.\n * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.\n *\n * @example\n * ```ts\n * const [status, requestPermission] = useLocationPermissions();\n * ```\n */\nexport const useLocationPermissions = createPermissionHook({\n getMethod: getPermissionsAsync,\n requestMethod: requestPermissionsAsync,\n})\n\n// 导出便捷读取的 SDK 配置与 webKey\nexport { getSDKConfig, getWebKey } from './ExpoGaodeMapModule';\n\n// 导出内置搜索 API\nexport {\n initSearch,\n searchPOI,\n searchNearby,\n searchAlong,\n searchPolygon,\n getInputTips,\n reGeocode,\n getPoiDetail,\n SearchType,\n} from './search';\n\nexport type {\n Coordinates as SearchCoordinates,\n POI,\n POISearchOptions,\n NearbySearchOptions,\n AlongSearchOptions,\n PolygonSearchOptions,\n InputTipsOptions,\n InputTip,\n SearchResult,\n InputTipsResult,\n ReGeocodeOptions,\n ReGeocodeResult,\n AddressComponent,\n Road,\n RoadCross,\n AOI,\n RoutePOIType,\n} from './search';\n\nexport { default as Search } from './search';\n"]}
|