@yarrow-uz/rn-map-sdk 0.3.0 → 0.5.0
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/CHANGELOG.md +22 -0
- package/README.md +48 -8
- package/dist/index.d.ts +2 -1277
- package/dist/index.js +3 -2554
- package/dist/preflight.d.ts +15 -0
- package/dist/preflight.js +37 -0
- package/dist/surface-BY-U7jnq.js +2689 -0
- package/dist/surface-CvmTHryW.d.ts +1336 -0
- package/dist/surface.d.ts +2 -0
- package/dist/surface.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-only diagnostic for the most common integration failure: the app was
|
|
3
|
+
* built without MapLibre's native code (peer not installed, Expo config
|
|
4
|
+
* plugin missing, or no native rebuild after installing).
|
|
5
|
+
*
|
|
6
|
+
* Runs once at SDK import — deliberately BEFORE MapLibre React Native is
|
|
7
|
+
* evaluated (this module must stay the first import of `src/index.ts`,
|
|
8
|
+
* without importing MLRN itself). MLRN's own
|
|
9
|
+
* `TurboModuleRegistry.getEnforcing()` throws an obscure error at import
|
|
10
|
+
* time when the native module is missing; this probe fires first and prints
|
|
11
|
+
* the actual fix. `get()` (non-enforcing) never throws, and the try/catch
|
|
12
|
+
* guarantees a probe failure can never false-alarm a working app. Release
|
|
13
|
+
* builds exit immediately (`__DEV__` is false).
|
|
14
|
+
*/
|
|
15
|
+
export declare function warnIfNativeModuleMissing(): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NativeModules, Platform, TurboModuleRegistry } from "react-native";
|
|
2
|
+
|
|
3
|
+
// src/runtime/nativePreflight.ts
|
|
4
|
+
/**
|
|
5
|
+
* Identifiers that prove MapLibre React Native's native side is linked into
|
|
6
|
+
* the app: the v11 TurboModule and the legacy/interop native component name.
|
|
7
|
+
*/
|
|
8
|
+
const NATIVE_MODULE_NAMES = ["MLRNMapViewModule", "MLRNMapView"];
|
|
9
|
+
/**
|
|
10
|
+
* Dev-only diagnostic for the most common integration failure: the app was
|
|
11
|
+
* built without MapLibre's native code (peer not installed, Expo config
|
|
12
|
+
* plugin missing, or no native rebuild after installing).
|
|
13
|
+
*
|
|
14
|
+
* Runs once at SDK import — deliberately BEFORE MapLibre React Native is
|
|
15
|
+
* evaluated (this module must stay the first import of `src/index.ts`,
|
|
16
|
+
* without importing MLRN itself). MLRN's own
|
|
17
|
+
* `TurboModuleRegistry.getEnforcing()` throws an obscure error at import
|
|
18
|
+
* time when the native module is missing; this probe fires first and prints
|
|
19
|
+
* the actual fix. `get()` (non-enforcing) never throws, and the try/catch
|
|
20
|
+
* guarantees a probe failure can never false-alarm a working app. Release
|
|
21
|
+
* builds exit immediately (`__DEV__` is false).
|
|
22
|
+
*/
|
|
23
|
+
function warnIfNativeModuleMissing() {
|
|
24
|
+
if (typeof __DEV__ === "undefined" || !__DEV__) return;
|
|
25
|
+
if (Platform.OS === "web") return;
|
|
26
|
+
if (NATIVE_MODULE_NAMES.some((name) => {
|
|
27
|
+
try {
|
|
28
|
+
return Boolean(TurboModuleRegistry?.get?.(name) ?? NativeModules?.[name]);
|
|
29
|
+
} catch {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
})) return;
|
|
33
|
+
console.error("[YarrowMap] MapLibre native module is not linked into this build.\n@yarrow-uz/rn-map-sdk needs @maplibre/maplibre-react-native installed in the app with a native rebuild:\n Expo: add \"plugins\": [\"@maplibre/maplibre-react-native\"] to app.json,\n then rebuild (npx expo run:android / npx expo run:ios, or a new\n dev/EAS build — Expo Go cannot load the map).\n Bare RN: install the peer and rebuild (pod install on iOS, gradle on\n Android).\nSee the README installation section for the exact commands.");
|
|
34
|
+
}
|
|
35
|
+
warnIfNativeModuleMissing();
|
|
36
|
+
|
|
37
|
+
export { warnIfNativeModuleMissing };
|