@evnydd0sf/react-native-amap3d-fix 3.2.4-fix.3 → 3.2.4-fix.4
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.
@@ -12,142 +12,143 @@ import qiuxiang.amap3d.toLatLng
|
|
12
12
|
|
13
13
|
@Suppress("unused")
|
14
14
|
internal class MapViewManager : ViewGroupManager<MapView>() {
|
15
|
-
private val commands = mapOf(
|
16
|
-
"moveCamera" to { view: MapView, args: ReadableArray? -> view.moveCamera(args) },
|
17
|
-
"call" to { view: MapView, args: ReadableArray? -> view.call(args) },
|
18
|
-
)
|
19
|
-
|
20
|
-
override fun getName(): String {
|
21
|
-
return "AMapView"
|
22
|
-
}
|
23
|
-
|
24
|
-
override fun createViewInstance(reactContext: ThemedReactContext): MapView {
|
25
|
-
return MapView(reactContext)
|
26
|
-
}
|
27
|
-
|
28
|
-
override fun onDropViewInstance(view: MapView) {
|
29
|
-
super.onDropViewInstance(view)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
mapView
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
view
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
view
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
view
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
view
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
view
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
view
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
view
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
view
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
view
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
view
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
view
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
view
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
view
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
view
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
view
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
view
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
view
|
152
|
-
|
15
|
+
private val commands = mapOf(
|
16
|
+
"moveCamera" to { view: MapView, args: ReadableArray? -> view.moveCamera(args) },
|
17
|
+
"call" to { view: MapView, args: ReadableArray? -> view.call(args) },
|
18
|
+
)
|
19
|
+
|
20
|
+
override fun getName(): String {
|
21
|
+
return "AMapView"
|
22
|
+
}
|
23
|
+
|
24
|
+
override fun createViewInstance(reactContext: ThemedReactContext): MapView {
|
25
|
+
return MapView(reactContext)
|
26
|
+
}
|
27
|
+
|
28
|
+
override fun onDropViewInstance(view: MapView) {
|
29
|
+
super.onDropViewInstance(view)
|
30
|
+
// Fix Unmount View Crash
|
31
|
+
// view.onDestroy()
|
32
|
+
}
|
33
|
+
|
34
|
+
override fun getCommandsMap(): Map<String, Int> {
|
35
|
+
return commands.keys.mapIndexed { index, key -> key to index }.toMap()
|
36
|
+
}
|
37
|
+
|
38
|
+
override fun receiveCommand(view: MapView, command: Int, args: ReadableArray?) {
|
39
|
+
commands.values.toList()[command](view, args)
|
40
|
+
}
|
41
|
+
|
42
|
+
override fun addView(mapView: MapView, child: View, index: Int) {
|
43
|
+
mapView.add(child)
|
44
|
+
super.addView(mapView, child, index)
|
45
|
+
}
|
46
|
+
|
47
|
+
override fun removeViewAt(parent: MapView, index: Int) {
|
48
|
+
parent.remove(parent.getChildAt(index))
|
49
|
+
super.removeViewAt(parent, index)
|
50
|
+
}
|
51
|
+
|
52
|
+
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
|
53
|
+
return getEventTypeConstants(
|
54
|
+
"onLoad",
|
55
|
+
"onPress",
|
56
|
+
"onPressPoi",
|
57
|
+
"onLongPress",
|
58
|
+
"onCameraMove",
|
59
|
+
"onCameraIdle",
|
60
|
+
"onLocation",
|
61
|
+
"onCallback",
|
62
|
+
)
|
63
|
+
}
|
64
|
+
|
65
|
+
@ReactProp(name = "initialCameraPosition")
|
66
|
+
fun setInitialCameraPosition(view: MapView, position: ReadableMap) {
|
67
|
+
view.setInitialCameraPosition(position)
|
68
|
+
}
|
69
|
+
|
70
|
+
@ReactProp(name = "myLocationEnabled")
|
71
|
+
fun setMyLocationEnabled(view: MapView, enabled: Boolean) {
|
72
|
+
view.map.isMyLocationEnabled = enabled
|
73
|
+
}
|
74
|
+
|
75
|
+
@ReactProp(name = "indoorViewEnabled")
|
76
|
+
fun setIndoorViewEnabled(view: MapView, enabled: Boolean) {
|
77
|
+
view.map.showIndoorMap(enabled)
|
78
|
+
}
|
79
|
+
|
80
|
+
@ReactProp(name = "buildingsEnabled")
|
81
|
+
fun setBuildingsEnabled(view: MapView, enabled: Boolean) {
|
82
|
+
view.map.showBuildings(enabled)
|
83
|
+
}
|
84
|
+
|
85
|
+
@ReactProp(name = "compassEnabled")
|
86
|
+
fun setCompassEnabled(view: MapView, show: Boolean) {
|
87
|
+
view.map.uiSettings.isCompassEnabled = show
|
88
|
+
}
|
89
|
+
|
90
|
+
@ReactProp(name = "zoomControlsEnabled")
|
91
|
+
fun setZoomControlsEnabled(view: MapView, enabled: Boolean) {
|
92
|
+
view.map.uiSettings.isZoomControlsEnabled = enabled
|
93
|
+
}
|
94
|
+
|
95
|
+
@ReactProp(name = "scaleControlsEnabled")
|
96
|
+
fun setScaleControlsEnabled(view: MapView, enabled: Boolean) {
|
97
|
+
view.map.uiSettings.isScaleControlsEnabled = enabled
|
98
|
+
}
|
99
|
+
|
100
|
+
@ReactProp(name = "language")
|
101
|
+
fun setLanguage(view: MapView, language: String) {
|
102
|
+
view.map.setMapLanguage(language)
|
103
|
+
}
|
104
|
+
|
105
|
+
@ReactProp(name = "myLocationButtonEnabled")
|
106
|
+
fun setMyLocationButtonEnabled(view: MapView, enabled: Boolean) {
|
107
|
+
view.map.uiSettings.isMyLocationButtonEnabled = enabled
|
108
|
+
}
|
109
|
+
|
110
|
+
@ReactProp(name = "trafficEnabled")
|
111
|
+
fun setTrafficEnabled(view: MapView, enabled: Boolean) {
|
112
|
+
view.map.isTrafficEnabled = enabled
|
113
|
+
}
|
114
|
+
|
115
|
+
@ReactProp(name = "maxZoom")
|
116
|
+
fun setMaxZoom(view: MapView, zoomLevel: Float) {
|
117
|
+
view.map.maxZoomLevel = zoomLevel
|
118
|
+
}
|
119
|
+
|
120
|
+
@ReactProp(name = "minZoom")
|
121
|
+
fun setMinZoom(view: MapView, zoomLevel: Float) {
|
122
|
+
view.map.minZoomLevel = zoomLevel
|
123
|
+
}
|
124
|
+
|
125
|
+
@ReactProp(name = "mapType")
|
126
|
+
fun setMapType(view: MapView, mapType: Int) {
|
127
|
+
view.map.mapType = mapType + 1
|
128
|
+
}
|
129
|
+
|
130
|
+
@ReactProp(name = "zoomGesturesEnabled")
|
131
|
+
fun setZoomGesturesEnabled(view: MapView, enabled: Boolean) {
|
132
|
+
view.map.uiSettings.isZoomGesturesEnabled = enabled
|
133
|
+
}
|
134
|
+
|
135
|
+
@ReactProp(name = "scrollGesturesEnabled")
|
136
|
+
fun setScrollGesturesEnabled(view: MapView, enabled: Boolean) {
|
137
|
+
view.map.uiSettings.isScrollGesturesEnabled = enabled
|
138
|
+
}
|
139
|
+
|
140
|
+
@ReactProp(name = "rotateGesturesEnabled")
|
141
|
+
fun setRotateGesturesEnabled(view: MapView, enabled: Boolean) {
|
142
|
+
view.map.uiSettings.isRotateGesturesEnabled = enabled
|
143
|
+
}
|
144
|
+
|
145
|
+
@ReactProp(name = "tiltGesturesEnabled")
|
146
|
+
fun setTiltGesturesEnabled(view: MapView, enabled: Boolean) {
|
147
|
+
view.map.uiSettings.isTiltGesturesEnabled = enabled
|
148
|
+
}
|
149
|
+
|
150
|
+
@ReactProp(name = "cameraPosition")
|
151
|
+
fun setCameraPosition(view: MapView, center: ReadableMap) {
|
152
|
+
view.map.moveCamera(CameraUpdateFactory.changeLatLng(center.toLatLng()))
|
153
|
+
}
|
153
154
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
@@ -10,6 +10,12 @@
|
|
10
10
|
- **解决方案**:将 `react-native-amap3d.podspec` 中的 AMap3DMap 依赖版本固定为 `10.0.1000`
|
11
11
|
- **测试状态**:✅ 开发调试正常 ✅ 正式编译通过
|
12
12
|
|
13
|
+
- **提升了 Android 依赖版本,修复销毁时崩溃问题**
|
14
|
+
- **问题描述**:在 Android 设备上,地图组件销毁时会触发应用崩溃
|
15
|
+
- **根本原因**:旧版本的高德地图 Android SDK 在资源释放时存在内存管理问题
|
16
|
+
- **解决方案**:将 `lib/android/build.gradle` 中的 `com.amap.api:3dmap` 依赖版本提升至 `10.0.600`
|
17
|
+
- **测试状态**:✅ Android 设备运行稳定 ✅ 组件销毁正常
|
18
|
+
|
13
19
|
## 功能
|
14
20
|
|
15
21
|
- 地图模式切换(常规、卫星、导航、夜间)
|