expo-gaode-map-search 1.3.5 → 1.3.6
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.
|
@@ -7,29 +7,18 @@ const expo_modules_core_1 = require("expo-modules-core");
|
|
|
7
7
|
* 这样可避免导航与核心包的 SDK 冲突时无法使用搜索模块的问题。
|
|
8
8
|
*/
|
|
9
9
|
function ensureBaseInstalled() {
|
|
10
|
-
let installed = false;
|
|
11
10
|
try {
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
// 检查核心地图原生模块是否存在
|
|
12
|
+
// 无论是安装了 expo-gaode-map 还是 expo-gaode-map-navigation,
|
|
13
|
+
// 原生端都会注册名为 'ExpoGaodeMap' 的模块。
|
|
14
|
+
// 我们通过 requireNativeModule 来检测,避免在 JS 层面引入对包的硬依赖。
|
|
15
|
+
(0, expo_modules_core_1.requireNativeModule)('ExpoGaodeMap');
|
|
16
16
|
}
|
|
17
17
|
catch (_) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
installed = true;
|
|
23
|
-
}
|
|
24
|
-
catch (_) {
|
|
25
|
-
installed = false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (!installed) {
|
|
29
|
-
const msg = '[expo-gaode-map-search] 需要先安装基础地图组件,支持以下任一包:\n' +
|
|
30
|
-
' - expo-gaode-map(核心地图包),或\n' +
|
|
31
|
-
' - expo-gaode-map-navigation(导航包,内置地图能力)\n' +
|
|
32
|
-
'请先安装并完成原生配置后再重试。';
|
|
18
|
+
const msg = '[expo-gaode-map-search] 未检测到基础地图原生模块。\n' +
|
|
19
|
+
'请确保已安装以下任一包并重新构建应用 (npx expo prebuild):\n' +
|
|
20
|
+
' - expo-gaode-map(核心地图包)\n' +
|
|
21
|
+
' - expo-gaode-map-navigation(导航包,内置地图能力)';
|
|
33
22
|
throw new Error(msg);
|
|
34
23
|
}
|
|
35
24
|
}
|
package/package.json
CHANGED
|
@@ -21,29 +21,18 @@ import {
|
|
|
21
21
|
* 这样可避免导航与核心包的 SDK 冲突时无法使用搜索模块的问题。
|
|
22
22
|
*/
|
|
23
23
|
function ensureBaseInstalled() {
|
|
24
|
-
let installed = false;
|
|
25
24
|
try {
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// 检查核心地图原生模块是否存在
|
|
26
|
+
// 无论是安装了 expo-gaode-map 还是 expo-gaode-map-navigation,
|
|
27
|
+
// 原生端都会注册名为 'ExpoGaodeMap' 的模块。
|
|
28
|
+
// 我们通过 requireNativeModule 来检测,避免在 JS 层面引入对包的硬依赖。
|
|
29
|
+
requireNativeModule('ExpoGaodeMap');
|
|
30
30
|
} catch (_) {
|
|
31
|
-
// 再尝试导航包(内置地图能力)
|
|
32
|
-
try {
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
34
|
-
require('expo-gaode-map-navigation');
|
|
35
|
-
installed = true;
|
|
36
|
-
} catch (_) {
|
|
37
|
-
installed = false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!installed) {
|
|
42
31
|
const msg =
|
|
43
|
-
'[expo-gaode-map-search]
|
|
44
|
-
'
|
|
45
|
-
' - expo-gaode-map
|
|
46
|
-
'
|
|
32
|
+
'[expo-gaode-map-search] 未检测到基础地图原生模块。\n' +
|
|
33
|
+
'请确保已安装以下任一包并重新构建应用 (npx expo prebuild):\n' +
|
|
34
|
+
' - expo-gaode-map(核心地图包)\n' +
|
|
35
|
+
' - expo-gaode-map-navigation(导航包,内置地图能力)';
|
|
47
36
|
throw new Error(msg);
|
|
48
37
|
}
|
|
49
38
|
}
|