expo-arcgis 0.2.1 → 0.2.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.
- package/build/MapView.d.ts.map +1 -1
- package/build/MapView.js +5 -1
- package/build/MapView.js.map +1 -1
- package/build/SceneView.d.ts.map +1 -1
- package/build/SceneView.js +3 -2
- package/build/SceneView.js.map +1 -1
- package/build/utils/sharedObjectId.d.ts +14 -0
- package/build/utils/sharedObjectId.d.ts.map +1 -0
- package/build/utils/sharedObjectId.js +18 -0
- package/build/utils/sharedObjectId.js.map +1 -0
- package/package.json +1 -1
- package/plugin/build/index.d.ts +6 -0
- package/plugin/build/index.d.ts.map +1 -0
- package/plugin/build/index.js +24 -0
- package/plugin/build/index.js.map +1 -0
- package/plugin/build/types.d.ts +26 -0
- package/plugin/build/types.d.ts.map +1 -0
- package/plugin/build/types.js +3 -0
- package/plugin/build/types.js.map +1 -0
- package/plugin/build/withArcGISAndroid.d.ts +4 -0
- package/plugin/build/withArcGISAndroid.d.ts.map +1 -0
- package/plugin/build/withArcGISAndroid.js +101 -0
- package/plugin/build/withArcGISAndroid.js.map +1 -0
- package/plugin/build/withArcGISIos.d.ts +4 -0
- package/plugin/build/withArcGISIos.d.ts.map +1 -0
- package/plugin/build/withArcGISIos.js +117 -0
- package/plugin/build/withArcGISIos.js.map +1 -0
- package/src/MapView.tsx +7 -4
- package/src/SceneView.tsx +6 -4
- package/src/utils/sharedObjectId.ts +17 -0
package/build/MapView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../src/MapView.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../src/MapView.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0BtE;;;GAGG;AACH,eAAO,MAAM,OAAO;;iDA4CnB,CAAC"}
|
package/build/MapView.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { forwardRef, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { GeoViewContext, useGeoModel } from './contexts';
|
|
4
|
+
import { sharedObjectId } from './utils/sharedObjectId';
|
|
4
5
|
const NativeMapView = requireNativeView('ExpoArcgis');
|
|
5
6
|
/**
|
|
6
7
|
* Declarative 2D map view. Renders the `ArcGISMap` from the nearest `<Map>`, hosts the
|
|
@@ -26,7 +27,10 @@ export const MapView = forwardRef(function MapView({ children, ...props }, handl
|
|
|
26
27
|
// The native view exposes `identify` on its ref, so hand that ref over directly. (It's
|
|
27
28
|
// attached before this layout-phase handle runs, so reading it here is safe.)
|
|
28
29
|
useImperativeHandle(handle, () => nativeRef.current, []);
|
|
29
|
-
return (<NativeMapView ref={nativeRef}
|
|
30
|
+
return (<NativeMapView ref={nativeRef}
|
|
31
|
+
// SharedObjects are passed by registry id so they survive the Fabric prop pipeline on
|
|
32
|
+
// expo-modules-core < 56.0.13 (which lacks the auto-unwrap from expo/expo#46212).
|
|
33
|
+
map={sharedObjectId(map)} graphicsOverlays={overlays.map(sharedObjectId)} imageOverlays={imageOverlays.map(sharedObjectId)} geometryEditor={sharedObjectId(geometryEditor)} {...props}>
|
|
30
34
|
<GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>
|
|
31
35
|
</NativeMapView>);
|
|
32
36
|
});
|
package/build/MapView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.js","sourceRoot":"","sources":["../src/MapView.tsx"],"names":[],"mappings":"AAAA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,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAC/C,aAAa,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CACjD,cAAc,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAC/C,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAC3E;MAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport {\n forwardRef,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport type { MapViewHandle, MapViewProps } from './ExpoArcgis.types';\nimport type {\n MapRef,\n GraphicsOverlayRef,\n GeometryEditorRef,\n ImageOverlayRef,\n} from './ExpoArcgisModule';\nimport { GeoViewContext, useGeoModel, type GeoViewHost } from './contexts';\nimport { sharedObjectId } from './utils/sharedObjectId';\n\ntype NativeMapViewProps = MapViewProps & {\n /** The native map handle (SharedObject), passed by reference as a view prop. */\n map: MapRef;\n /** Graphics overlays declared as `<GraphicsOverlay>` children, passed by reference. */\n graphicsOverlays: GraphicsOverlayRef[];\n /** Image overlays declared as `<ImageOverlay>` children, passed by reference. */\n imageOverlays: ImageOverlayRef[];\n /** Interactive geometry editor declared as a `<GeometryEditor>` child, passed by reference. */\n geometryEditor?: GeometryEditorRef | null;\n /** Ref to the native view, whose `identify` async function is callable through it. */\n ref?: Ref<unknown>;\n children?: ReactNode;\n};\n\nconst NativeMapView = requireNativeView<NativeMapViewProps>('ExpoArcgis');\n\n/**\n * Declarative 2D map view. Renders the `ArcGISMap` from the nearest `<Map>`, hosts the\n * `<GraphicsOverlay>` / `<GeometryEditor>` children, and exposes `identify` via a `ref`.\n */\nexport const MapView = forwardRef<MapViewHandle, PropsWithChildren<MapViewProps>>(\n function MapView({ children, ...props }, handle) {\n const map = useGeoModel() as MapRef;\n // The native view exposes an async `identify` function callable through its ref.\n const nativeRef = useRef<any>(null);\n\n const [overlays, setOverlays] = useState<GraphicsOverlayRef[]>([]);\n const [imageOverlays, setImageOverlays] = useState<ImageOverlayRef[]>([]);\n const [geometryEditor, setGeometryEditor] = useState<GeometryEditorRef | null>(null);\n const host = useMemo<GeoViewHost>(\n () => ({\n add: (overlay) => setOverlays((prev) => (prev.includes(overlay) ? prev : [...prev, overlay])),\n remove: (overlay) => setOverlays((prev) => prev.filter((o) => o !== overlay)),\n addImageOverlay: (overlay) =>\n setImageOverlays((prev) => (prev.includes(overlay) ? prev : [...prev, overlay])),\n removeImageOverlay: (overlay) =>\n setImageOverlays((prev) => prev.filter((o) => o !== overlay)),\n setGeometryEditor: (editor) => setGeometryEditor(editor),\n // Visual analyses (viewshed / line-of-sight) are 3D only — no-op on a 2D map.\n addAnalysisOverlay: () => {},\n removeAnalysisOverlay: () => {},\n }),\n []\n );\n\n // The native view exposes `identify` on its ref, so hand that ref over directly. (It's\n // attached before this layout-phase handle runs, so reading it here is safe.)\n useImperativeHandle(handle, () => nativeRef.current as MapViewHandle, []);\n\n return (\n <NativeMapView\n ref={nativeRef}\n // SharedObjects are passed by registry id so they survive the Fabric prop pipeline on\n // expo-modules-core < 56.0.13 (which lacks the auto-unwrap from expo/expo#46212).\n map={sharedObjectId(map)}\n graphicsOverlays={overlays.map(sharedObjectId)}\n imageOverlays={imageOverlays.map(sharedObjectId)}\n geometryEditor={sharedObjectId(geometryEditor)}\n {...props}\n >\n <GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>\n </NativeMapView>\n );\n }\n);\n"]}
|
package/build/SceneView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneView.d.ts","sourceRoot":"","sources":["../src/SceneView.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"SceneView.d.ts","sourceRoot":"","sources":["../src/SceneView.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAmB1E;;;GAGG;AACH,eAAO,MAAM,SAAS;;mDAyCrB,CAAC"}
|
package/build/SceneView.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { forwardRef, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { GeoViewContext, useGeoModel } from './contexts';
|
|
4
|
+
import { sharedObjectId } from './utils/sharedObjectId';
|
|
4
5
|
const NativeSceneView = requireNativeView('ExpoArcgis', 'ExpoArcgisSceneView');
|
|
5
6
|
/**
|
|
6
7
|
* Declarative 3D scene view. Renders the `Scene` from the nearest `<Scene>`, hosts the
|
|
7
8
|
* `<GraphicsOverlay>` / `<AnalysisOverlay>` children, and exposes `retryLoad` via a `ref`.
|
|
8
9
|
*/
|
|
9
|
-
export const SceneView = forwardRef(function SceneView({ children, ...props }, handle) {
|
|
10
|
+
export const SceneView = forwardRef(function SceneView({ children, orbitGraphic, ...props }, handle) {
|
|
10
11
|
const scene = useGeoModel();
|
|
11
12
|
// The native view exposes an async `retryLoad` function callable through its ref.
|
|
12
13
|
const nativeRef = useRef(null);
|
|
@@ -25,7 +26,7 @@ export const SceneView = forwardRef(function SceneView({ children, ...props }, h
|
|
|
25
26
|
}), []);
|
|
26
27
|
// The native view exposes `retryLoad` on its ref, so hand that ref over directly.
|
|
27
28
|
useImperativeHandle(handle, () => nativeRef.current, []);
|
|
28
|
-
return (<NativeSceneView ref={nativeRef} scene={scene} graphicsOverlays={overlays} analysisOverlays={analysisOverlays} {...props}>
|
|
29
|
+
return (<NativeSceneView ref={nativeRef} scene={sharedObjectId(scene)} graphicsOverlays={overlays.map(sharedObjectId)} analysisOverlays={analysisOverlays.map(sharedObjectId)} orbitGraphic={sharedObjectId(orbitGraphic)} {...props}>
|
|
29
30
|
<GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>
|
|
30
31
|
</NativeSceneView>);
|
|
31
32
|
});
|
package/build/SceneView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneView.js","sourceRoot":"","sources":["../src/SceneView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"SceneView.js","sourceRoot":"","sources":["../src/SceneView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAcxD,MAAM,eAAe,GAAG,iBAAiB,CAAuB,YAAY,EAAE,qBAAqB,CAAC,CAAC;AAErG;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,SAAS,SAAS,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,MAAM;IAC7D,MAAM,KAAK,GAAG,WAAW,EAAc,CAAC;IACxC,kFAAkF;IAClF,MAAM,SAAS,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C;KAC7B,CAAC,EACF,EAAE,CACH,CAAC;IAEF,kFAAkF;IAClF,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;IAE5E,OAAO,CACL,CAAC,eAAe,CACd,GAAG,CAAC,CAAC,SAAS,CAAC,CACf,KAAK,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAC7B,gBAAgB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAC/C,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CACvD,YAAY,CAAC,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAC3C,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAC3E;MAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { requireNativeView } from 'expo';\nimport {\n forwardRef,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type ReactNode,\n type Ref,\n} from 'react';\n\nimport type { SceneViewHandle, SceneViewProps } from './ExpoArcgis.types';\nimport type { SceneRef, GraphicsOverlayRef, AnalysisOverlayRef } from './ExpoArcgisModule';\nimport { GeoViewContext, useGeoModel, type GeoViewHost } from './contexts';\nimport { sharedObjectId } from './utils/sharedObjectId';\n\ntype NativeSceneViewProps = SceneViewProps & {\n /** The native scene handle (SharedObject), passed by reference as a view prop. */\n scene: SceneRef;\n /** Graphics overlays declared as `<GraphicsOverlay>` children, passed by reference. */\n graphicsOverlays: GraphicsOverlayRef[];\n /** Analysis overlays declared as `<AnalysisOverlay>` children, passed by reference. */\n analysisOverlays: AnalysisOverlayRef[];\n /** Ref to the native view, whose `retryLoad` async function is callable through it. */\n ref?: Ref<unknown>;\n children?: ReactNode;\n};\n\nconst NativeSceneView = requireNativeView<NativeSceneViewProps>('ExpoArcgis', 'ExpoArcgisSceneView');\n\n/**\n * Declarative 3D scene view. Renders the `Scene` from the nearest `<Scene>`, hosts the\n * `<GraphicsOverlay>` / `<AnalysisOverlay>` children, and exposes `retryLoad` via a `ref`.\n */\nexport const SceneView = forwardRef<SceneViewHandle, PropsWithChildren<SceneViewProps>>(\n function SceneView({ children, orbitGraphic, ...props }, handle) {\n const scene = useGeoModel() as SceneRef;\n // The native view exposes an async `retryLoad` function callable through its ref.\n const nativeRef = useRef<any>(null);\n\n const [overlays, setOverlays] = useState<GraphicsOverlayRef[]>([]);\n const [analysisOverlays, setAnalysisOverlays] = useState<AnalysisOverlayRef[]>([]);\n const host = useMemo<GeoViewHost>(\n () => ({\n add: (overlay) => setOverlays((prev) => (prev.includes(overlay) ? prev : [...prev, overlay])),\n remove: (overlay) => setOverlays((prev) => prev.filter((o) => o !== overlay)),\n // The SDK binds a GeometryEditor to MapView only; 3D scene editing is not supported.\n setGeometryEditor: () => {},\n addAnalysisOverlay: (overlay) =>\n setAnalysisOverlays((prev) => (prev.includes(overlay) ? prev : [...prev, overlay])),\n removeAnalysisOverlay: (overlay) =>\n setAnalysisOverlays((prev) => prev.filter((o) => o !== overlay)),\n // Image overlays are bound to <MapView> (2D) only.\n addImageOverlay: () => {},\n removeImageOverlay: () => {},\n }),\n []\n );\n\n // The native view exposes `retryLoad` on its ref, so hand that ref over directly.\n useImperativeHandle(handle, () => nativeRef.current as SceneViewHandle, []);\n\n return (\n <NativeSceneView\n ref={nativeRef}\n scene={sharedObjectId(scene)}\n graphicsOverlays={overlays.map(sharedObjectId)}\n analysisOverlays={analysisOverlays.map(sharedObjectId)}\n orbitGraphic={sharedObjectId(orbitGraphic)}\n {...props}\n >\n <GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>\n </NativeSceneView>\n );\n }\n);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a SharedObject's registry id (a number) so it can be passed as a native view prop.
|
|
3
|
+
*
|
|
4
|
+
* Why: expo-modules-core only started auto-unwrapping shared objects passed as view props in
|
|
5
|
+
* 56.0.13 (expo/expo#46212). On older SDK 56 patches a raw shared object does not survive the
|
|
6
|
+
* Fabric prop pipeline (it serializes to an empty value), so the native `Prop` is never set and the
|
|
7
|
+
* view stays blank. Passing the registry id explicitly works on every version — the native side
|
|
8
|
+
* resolves the id back to the object (expo/expo#24431), and array props resolve element-wise.
|
|
9
|
+
*
|
|
10
|
+
* Non-shared-object values (null / undefined / already a number) pass through unchanged, so this is
|
|
11
|
+
* also a no-op once #46212 is present. Callers map it over array props.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sharedObjectId<T>(value: T): T;
|
|
14
|
+
//# sourceMappingURL=sharedObjectId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedObjectId.d.ts","sourceRoot":"","sources":["../../src/utils/sharedObjectId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAI7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a SharedObject's registry id (a number) so it can be passed as a native view prop.
|
|
3
|
+
*
|
|
4
|
+
* Why: expo-modules-core only started auto-unwrapping shared objects passed as view props in
|
|
5
|
+
* 56.0.13 (expo/expo#46212). On older SDK 56 patches a raw shared object does not survive the
|
|
6
|
+
* Fabric prop pipeline (it serializes to an empty value), so the native `Prop` is never set and the
|
|
7
|
+
* view stays blank. Passing the registry id explicitly works on every version — the native side
|
|
8
|
+
* resolves the id back to the object (expo/expo#24431), and array props resolve element-wise.
|
|
9
|
+
*
|
|
10
|
+
* Non-shared-object values (null / undefined / already a number) pass through unchanged, so this is
|
|
11
|
+
* also a no-op once #46212 is present. Callers map it over array props.
|
|
12
|
+
*/
|
|
13
|
+
export function sharedObjectId(value) {
|
|
14
|
+
const id = value
|
|
15
|
+
?.__expo_shared_object_id__;
|
|
16
|
+
return (typeof id === 'number' ? id : value);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=sharedObjectId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedObjectId.js","sourceRoot":"","sources":["../../src/utils/sharedObjectId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAI,KAAQ;IACxC,MAAM,EAAE,GAAI,KAAmE;QAC7E,EAAE,yBAAyB,CAAC;IAC9B,OAAO,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAM,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Returns a SharedObject's registry id (a number) so it can be passed as a native view prop.\n *\n * Why: expo-modules-core only started auto-unwrapping shared objects passed as view props in\n * 56.0.13 (expo/expo#46212). On older SDK 56 patches a raw shared object does not survive the\n * Fabric prop pipeline (it serializes to an empty value), so the native `Prop` is never set and the\n * view stays blank. Passing the registry id explicitly works on every version — the native side\n * resolves the id back to the object (expo/expo#24431), and array props resolve element-wise.\n *\n * Non-shared-object values (null / undefined / already a number) pass through unchanged, so this is\n * also a no-op once #46212 is present. Callers map it over array props.\n */\nexport function sharedObjectId<T>(value: T): T {\n const id = (value as { __expo_shared_object_id__?: number } | null | undefined)\n ?.__expo_shared_object_id__;\n return (typeof id === 'number' ? id : value) as T;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import { ArcGISPluginProps } from './types';
|
|
3
|
+
export type { ArcGISPluginProps } from './types';
|
|
4
|
+
declare const _default: ConfigPlugin<void | ArcGISPluginProps>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoC,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAsB5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;;AAEjD,wBAAuE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
+
const withArcGISAndroid_1 = require("./withArcGISAndroid");
|
|
5
|
+
const withArcGISIos_1 = require("./withArcGISIos");
|
|
6
|
+
/**
|
|
7
|
+
* Expo config plugin for `expo-arcgis`.
|
|
8
|
+
*
|
|
9
|
+
* Pulls the native ArcGIS Maps SDK into the consuming app and configures the build:
|
|
10
|
+
* - Android: Esri Maven repository, minSdk >= 28, compileSdk >= 36, optional API key + location.
|
|
11
|
+
* - iOS: deployment target >= 17.0, optional API key + location usage description.
|
|
12
|
+
*
|
|
13
|
+
* The ArcGIS SDK artifacts themselves are declared by the module's own android/build.gradle
|
|
14
|
+
* and ios/ExpoArcgis.podspec; this plugin makes the surrounding app build able to resolve them.
|
|
15
|
+
*/
|
|
16
|
+
const withArcGIS = (config, props) => {
|
|
17
|
+
const options = props || {};
|
|
18
|
+
return (0, config_plugins_1.withPlugins)(config, [
|
|
19
|
+
[withArcGISAndroid_1.withArcGISAndroid, options],
|
|
20
|
+
[withArcGISIos_1.withArcGISIos, options],
|
|
21
|
+
]);
|
|
22
|
+
};
|
|
23
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withArcGIS, 'expo-arcgis', '0.1.0');
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,wDAAqF;AAGrF,2DAAwD;AACxD,mDAAgD;AAEhD;;;;;;;;;GASG;AACH,MAAM,UAAU,GAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;IAC3E,MAAM,OAAO,GAAsB,KAAK,IAAI,EAAE,CAAC;IAC/C,OAAO,IAAA,4BAAW,EAAC,MAAM,EAAE;QACzB,CAAC,qCAAiB,EAAE,OAAO,CAAC;QAC5B,CAAC,6BAAa,EAAE,OAAO,CAAC;KACzB,CAAC,CAAC;AACL,CAAC,CAAC;AAIF,kBAAe,IAAA,oCAAmB,EAAC,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ArcGISPluginProps = {
|
|
2
|
+
/**
|
|
3
|
+
* ArcGIS API key (access token) used by the native runtime to authenticate with
|
|
4
|
+
* ArcGIS location services. Typically supplied from an environment variable in
|
|
5
|
+
* app.config.js, e.g. `apiKey: process.env.ARCGIS_API_KEY`.
|
|
6
|
+
*
|
|
7
|
+
* When provided it is written to a native resource (Android `strings.xml` →
|
|
8
|
+
* `arcgis_api_key`, iOS `Info.plist` → `ArcGISAPIKey`) for the module to read at init.
|
|
9
|
+
*/
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Esri Maven repository URL (Android). Defaults to Esri's public artifactory. */
|
|
12
|
+
androidMavenUrl?: string;
|
|
13
|
+
/** Minimum Android SDK level. ArcGIS Maps SDK 300.0 requires >= 28. */
|
|
14
|
+
androidMinSdkVersion?: number;
|
|
15
|
+
/** Android compileSdk level. ArcGIS Maps SDK 300.0 requires >= 36. */
|
|
16
|
+
androidCompileSdkVersion?: number;
|
|
17
|
+
/** Minimum iOS deployment target. ArcGIS Maps SDK 300.0 requires >= 17.0. */
|
|
18
|
+
iosDeploymentTarget?: string;
|
|
19
|
+
/**
|
|
20
|
+
* When set, adds ACCESS_FINE/COARSE_LOCATION (Android) and the matching iOS usage
|
|
21
|
+
* description so the map can display the device location. Pass the iOS usage string;
|
|
22
|
+
* omit to skip location permissions entirely.
|
|
23
|
+
*/
|
|
24
|
+
locationWhenInUseUsageDescription?: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,sEAAsE;IACtE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC,6EAA6E;IAC7E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISAndroid.d.ts","sourceRoot":"","sources":["../src/withArcGISAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAIb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS5C,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,CAiB7D,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withArcGISAndroid = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
/** Esri public Maven repository that serves the ArcGIS Maps SDK for Kotlin. */
|
|
6
|
+
const DEFAULT_ESRI_MAVEN_URL = 'https://esri.jfrog.io/artifactory/arcgis';
|
|
7
|
+
// ArcGIS Maps SDK for Kotlin 300.0 minimum build requirements.
|
|
8
|
+
const REQUIRED_MIN_SDK = 28;
|
|
9
|
+
const REQUIRED_COMPILE_SDK = 36;
|
|
10
|
+
const withArcGISAndroid = (config, props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
config = withEsriMavenRepository(config, (_a = props.androidMavenUrl) !== null && _a !== void 0 ? _a : DEFAULT_ESRI_MAVEN_URL);
|
|
13
|
+
config = withArcGISSdkVersions(config, props);
|
|
14
|
+
config = withArcGISKotlinMetadataFix(config);
|
|
15
|
+
if (props.apiKey) {
|
|
16
|
+
config = withArcGISApiKeyResource(config, props.apiKey);
|
|
17
|
+
}
|
|
18
|
+
if (props.locationWhenInUseUsageDescription) {
|
|
19
|
+
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
20
|
+
'android.permission.ACCESS_FINE_LOCATION',
|
|
21
|
+
'android.permission.ACCESS_COARSE_LOCATION',
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
return config;
|
|
25
|
+
};
|
|
26
|
+
exports.withArcGISAndroid = withArcGISAndroid;
|
|
27
|
+
/** Adds the Esri Maven repository to the app's root build.gradle (allprojects.repositories). */
|
|
28
|
+
const withEsriMavenRepository = (config, url) => (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
|
|
29
|
+
if (cfg.modResults.language !== 'groovy') {
|
|
30
|
+
throw new Error('expo-arcgis: cannot add the Esri Maven repository — android/build.gradle is not Groovy.');
|
|
31
|
+
}
|
|
32
|
+
cfg.modResults.contents = addMavenRepository(cfg.modResults.contents, url);
|
|
33
|
+
return cfg;
|
|
34
|
+
});
|
|
35
|
+
function addMavenRepository(buildGradle, url) {
|
|
36
|
+
if (buildGradle.includes(url)) {
|
|
37
|
+
return buildGradle; // idempotent
|
|
38
|
+
}
|
|
39
|
+
const snippet = `maven { url '${url}' }`;
|
|
40
|
+
const allprojectsRepositories = /allprojects\s*\{[\s\S]*?repositories\s*\{/;
|
|
41
|
+
if (allprojectsRepositories.test(buildGradle)) {
|
|
42
|
+
return buildGradle.replace(allprojectsRepositories, (match) => `${match}\n ${snippet}`);
|
|
43
|
+
}
|
|
44
|
+
// No allprojects block found — append a minimal one.
|
|
45
|
+
return `${buildGradle}\n\nallprojects {\n repositories {\n ${snippet}\n }\n}\n`;
|
|
46
|
+
}
|
|
47
|
+
/** Raises android.minSdkVersion / android.compileSdkVersion via gradle.properties (never lowers). */
|
|
48
|
+
const withArcGISSdkVersions = (config, props) => {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const minSdk = (_a = props.androidMinSdkVersion) !== null && _a !== void 0 ? _a : REQUIRED_MIN_SDK;
|
|
51
|
+
const compileSdk = (_b = props.androidCompileSdkVersion) !== null && _b !== void 0 ? _b : REQUIRED_COMPILE_SDK;
|
|
52
|
+
return (0, config_plugins_1.withGradleProperties)(config, (cfg) => {
|
|
53
|
+
for (const [key, minValue] of [
|
|
54
|
+
['android.minSdkVersion', minSdk],
|
|
55
|
+
['android.compileSdkVersion', compileSdk],
|
|
56
|
+
]) {
|
|
57
|
+
const existing = cfg.modResults.find((item) => item.type === 'property' && item.key === key);
|
|
58
|
+
if (existing) {
|
|
59
|
+
const current = parseInt(existing.value, 10);
|
|
60
|
+
if (Number.isNaN(current) || current < minValue) {
|
|
61
|
+
existing.value = String(minValue);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
cfg.modResults.push({ type: 'property', key, value: String(minValue) });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return cfg;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/** Stores the API key in strings.xml as `arcgis_api_key` for the native runtime to read. */
|
|
72
|
+
const withArcGISApiKeyResource = (config, apiKey) => (0, config_plugins_1.withStringsXml)(config, (cfg) => {
|
|
73
|
+
cfg.modResults = config_plugins_1.AndroidConfig.Strings.setStringItem([{ _: apiKey, $: { name: 'arcgis_api_key', translatable: 'false' } }], cfg.modResults);
|
|
74
|
+
return cfg;
|
|
75
|
+
});
|
|
76
|
+
const SKIP_METADATA_FLAG = '-Xskip-metadata-version-check';
|
|
77
|
+
/**
|
|
78
|
+
* ArcGIS Maps SDK 300.0 is built with Kotlin 2.3.0; its kotlin-stdlib/reflect 2.3.0 resolve across
|
|
79
|
+
* the whole app, but Expo SDK 56 compiles with Kotlin 2.1.0. Let every module read the newer
|
|
80
|
+
* metadata so the app (expo, expo-modules-core, this module) compiles.
|
|
81
|
+
*/
|
|
82
|
+
const withArcGISKotlinMetadataFix = (config) => (0, config_plugins_1.withProjectBuildGradle)(config, (cfg) => {
|
|
83
|
+
if (cfg.modResults.language !== 'groovy') {
|
|
84
|
+
throw new Error('expo-arcgis: cannot apply the Kotlin metadata fix — android/build.gradle is not Groovy.');
|
|
85
|
+
}
|
|
86
|
+
if (!cfg.modResults.contents.includes(SKIP_METADATA_FLAG)) {
|
|
87
|
+
cfg.modResults.contents += `
|
|
88
|
+
|
|
89
|
+
// expo-arcgis: ArcGIS Maps SDK 300.0 ships Kotlin 2.3.0 metadata, newer than Expo SDK 56's compiler.
|
|
90
|
+
allprojects {
|
|
91
|
+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
92
|
+
kotlinOptions {
|
|
93
|
+
freeCompilerArgs += ["${SKIP_METADATA_FLAG}"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
return cfg;
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=withArcGISAndroid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISAndroid.js","sourceRoot":"","sources":["../src/withArcGISAndroid.ts"],"names":[],"mappings":";;;AAAA,wDAM6B;AAI7B,+EAA+E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AC1D,GAAG,CAAC,UAAU,CAAC,QAAQ,IAAI;;;;;;8BAMH,kBAAkB;;;;CAI/C,CAAC;IACE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISIos.d.ts","sourceRoot":"","sources":["../src/withArcGISIos.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAK5C,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,iBAAiB,CAmBzD,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withArcGISIos = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
/** ArcGIS Maps SDK for Swift 300.0 requires iOS 17.0+. */
|
|
6
|
+
const REQUIRED_IOS_DEPLOYMENT_TARGET = '17.0';
|
|
7
|
+
const withArcGISIos = (config, props) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const target = (_a = props.iosDeploymentTarget) !== null && _a !== void 0 ? _a : REQUIRED_IOS_DEPLOYMENT_TARGET;
|
|
10
|
+
// Pods read the target from Podfile.properties.json; the app target reads it from the
|
|
11
|
+
// .xcodeproj build settings. ArcGIS needs both raised to 17.0, or the app target (which
|
|
12
|
+
// imports our module via ExpoModulesProvider.swift) fails: "compiling for iOS 16.4, but
|
|
13
|
+
// module 'ExpoArcgis' has a minimum deployment target of iOS 17.0".
|
|
14
|
+
config = withArcGISPodfileDeploymentTarget(config, target);
|
|
15
|
+
config = withArcGISAppDeploymentTarget(config, target);
|
|
16
|
+
config = withArcGISEmbedFramework(config);
|
|
17
|
+
if (props.apiKey) {
|
|
18
|
+
config = withArcGISApiKeyInfoPlist(config, props.apiKey);
|
|
19
|
+
}
|
|
20
|
+
if (props.locationWhenInUseUsageDescription) {
|
|
21
|
+
config = withLocationUsageDescription(config, props.locationWhenInUseUsageDescription);
|
|
22
|
+
}
|
|
23
|
+
return config;
|
|
24
|
+
};
|
|
25
|
+
exports.withArcGISIos = withArcGISIos;
|
|
26
|
+
/** Raises the iOS deployment target in Podfile.properties.json (never lowers it). */
|
|
27
|
+
const withArcGISPodfileDeploymentTarget = (config, target) => (0, config_plugins_1.withPodfileProperties)(config, (cfg) => {
|
|
28
|
+
const current = cfg.modResults['ios.deploymentTarget'];
|
|
29
|
+
if (!current || parseFloat(current) < parseFloat(target)) {
|
|
30
|
+
cfg.modResults['ios.deploymentTarget'] = target;
|
|
31
|
+
}
|
|
32
|
+
return cfg;
|
|
33
|
+
});
|
|
34
|
+
/** Raises IPHONEOS_DEPLOYMENT_TARGET on the app project's build configurations (never lowers). */
|
|
35
|
+
const withArcGISAppDeploymentTarget = (config, target) => (0, config_plugins_1.withXcodeProject)(config, (cfg) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const project = cfg.modResults;
|
|
38
|
+
const configurations = project.pbxXCBuildConfigurationSection();
|
|
39
|
+
for (const key of Object.keys(configurations)) {
|
|
40
|
+
const buildSettings = (_a = configurations[key]) === null || _a === void 0 ? void 0 : _a.buildSettings;
|
|
41
|
+
// Skip `*_comment` string entries (no buildSettings) and configs that don't pin the target.
|
|
42
|
+
const current = buildSettings === null || buildSettings === void 0 ? void 0 : buildSettings.IPHONEOS_DEPLOYMENT_TARGET;
|
|
43
|
+
if (current && parseFloat(String(current).replace(/"/g, '')) < parseFloat(target)) {
|
|
44
|
+
buildSettings.IPHONEOS_DEPLOYMENT_TARGET = target;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return cfg;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Embeds the ArcGIS dynamic framework into the app bundle. ArcGIS is pulled in as a Swift Package
|
|
51
|
+
* product (spm_dependency) and linked into the static ExpoArcgis pod, but neither CocoaPods nor
|
|
52
|
+
* Xcode copies it into the app's Frameworks dir — so the app links fine yet crashes at launch with
|
|
53
|
+
* `Library not loaded: @rpath/ArcGIS.framework/ArcGIS`. We add an "Embed Frameworks" copy phase
|
|
54
|
+
* (CodeSignOnCopy) on the app target referencing the built product — Xcode's "Embed & Sign".
|
|
55
|
+
*/
|
|
56
|
+
const withArcGISEmbedFramework = (config) => (0, config_plugins_1.withXcodeProject)(config, (cfg) => {
|
|
57
|
+
const project = cfg.modResults;
|
|
58
|
+
const FRAMEWORK = 'ArcGIS.framework';
|
|
59
|
+
const COMMENT = `${FRAMEWORK} in Embed Frameworks`;
|
|
60
|
+
const objects = project.hash.project.objects;
|
|
61
|
+
// Idempotent: skip if already embedded (prebuild may run plugins more than once).
|
|
62
|
+
const buildFiles = objects.PBXBuildFile || {};
|
|
63
|
+
for (const key of Object.keys(buildFiles)) {
|
|
64
|
+
if (buildFiles[key] === COMMENT) {
|
|
65
|
+
return cfg;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Find the application target (fall back to the first target).
|
|
69
|
+
const nativeTargets = objects.PBXNativeTarget || {};
|
|
70
|
+
let targetUuid;
|
|
71
|
+
for (const key of Object.keys(nativeTargets)) {
|
|
72
|
+
if (key.endsWith('_comment'))
|
|
73
|
+
continue;
|
|
74
|
+
const productType = String(nativeTargets[key].productType || '').replace(/"/g, '');
|
|
75
|
+
if (productType === 'com.apple.product-type.application') {
|
|
76
|
+
targetUuid = key;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!targetUuid) {
|
|
81
|
+
targetUuid = project.getFirstTarget().uuid;
|
|
82
|
+
}
|
|
83
|
+
// Create an "Embed Frameworks" copy-files phase (dstSubfolderSpec 10 = Frameworks).
|
|
84
|
+
const phase = project.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', targetUuid, 'frameworks');
|
|
85
|
+
// Reference the framework as a build product and embed it with code signing.
|
|
86
|
+
const fileRefUuid = project.generateUuid();
|
|
87
|
+
objects.PBXFileReference[fileRefUuid] = {
|
|
88
|
+
isa: 'PBXFileReference',
|
|
89
|
+
lastKnownFileType: 'wrapper.framework',
|
|
90
|
+
name: FRAMEWORK,
|
|
91
|
+
path: FRAMEWORK,
|
|
92
|
+
sourceTree: 'BUILT_PRODUCTS_DIR',
|
|
93
|
+
};
|
|
94
|
+
objects.PBXFileReference[`${fileRefUuid}_comment`] = FRAMEWORK;
|
|
95
|
+
const buildFileUuid = project.generateUuid();
|
|
96
|
+
objects.PBXBuildFile[buildFileUuid] = {
|
|
97
|
+
isa: 'PBXBuildFile',
|
|
98
|
+
fileRef: fileRefUuid,
|
|
99
|
+
fileRef_comment: FRAMEWORK,
|
|
100
|
+
settings: { ATTRIBUTES: ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] },
|
|
101
|
+
};
|
|
102
|
+
objects.PBXBuildFile[`${buildFileUuid}_comment`] = COMMENT;
|
|
103
|
+
phase.buildPhase.files.push({ value: buildFileUuid, comment: COMMENT });
|
|
104
|
+
return cfg;
|
|
105
|
+
});
|
|
106
|
+
/** Stores the API key in Info.plist as `ArcGISAPIKey` for the native runtime to read. */
|
|
107
|
+
const withArcGISApiKeyInfoPlist = (config, apiKey) => (0, config_plugins_1.withInfoPlist)(config, (cfg) => {
|
|
108
|
+
cfg.modResults.ArcGISAPIKey = apiKey;
|
|
109
|
+
return cfg;
|
|
110
|
+
});
|
|
111
|
+
const withLocationUsageDescription = (config, description) => (0, config_plugins_1.withInfoPlist)(config, (cfg) => {
|
|
112
|
+
var _a;
|
|
113
|
+
cfg.modResults.NSLocationWhenInUseUsageDescription =
|
|
114
|
+
(_a = cfg.modResults.NSLocationWhenInUseUsageDescription) !== null && _a !== void 0 ? _a : description;
|
|
115
|
+
return cfg;
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=withArcGISIos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withArcGISIos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a,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAC7C,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG;QACpC,GAAG,EAAE,cAAc;QACnB,OAAO,EAAE,WAAW;QACpB,eAAe,EAAE,SAAS;QAC1B,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,EAAE;KACpE,CAAC;IACF,OAAO,CAAC,YAAY,CAAC,GAAG,aAAa,UAAU,CAAC,GAAG,OAAO,CAAC;IAC3D,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAExE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CAAC;AAEL,yFAAyF;AACzF,MAAM,yBAAyB,GAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CACzE,IAAA,8BAAa,EAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;IAC5B,GAAG,CAAC,UAAU,CAAC,YAAY,GAAG,MAAM,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CAAC;AAEL,MAAM,4BAA4B,GAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CACjF,IAAA,8BAAa,EAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;;IAC5B,GAAG,CAAC,UAAU,CAAC,mCAAmC;QAChD,MAAA,GAAG,CAAC,UAAU,CAAC,mCAAmC,mCAAI,WAAW,CAAC;IACpE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC,CAAC"}
|
package/src/MapView.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
ImageOverlayRef,
|
|
19
19
|
} from './ExpoArcgisModule';
|
|
20
20
|
import { GeoViewContext, useGeoModel, type GeoViewHost } from './contexts';
|
|
21
|
+
import { sharedObjectId } from './utils/sharedObjectId';
|
|
21
22
|
|
|
22
23
|
type NativeMapViewProps = MapViewProps & {
|
|
23
24
|
/** The native map handle (SharedObject), passed by reference as a view prop. */
|
|
@@ -71,10 +72,12 @@ export const MapView = forwardRef<MapViewHandle, PropsWithChildren<MapViewProps>
|
|
|
71
72
|
return (
|
|
72
73
|
<NativeMapView
|
|
73
74
|
ref={nativeRef}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
// SharedObjects are passed by registry id so they survive the Fabric prop pipeline on
|
|
76
|
+
// expo-modules-core < 56.0.13 (which lacks the auto-unwrap from expo/expo#46212).
|
|
77
|
+
map={sharedObjectId(map)}
|
|
78
|
+
graphicsOverlays={overlays.map(sharedObjectId)}
|
|
79
|
+
imageOverlays={imageOverlays.map(sharedObjectId)}
|
|
80
|
+
geometryEditor={sharedObjectId(geometryEditor)}
|
|
78
81
|
{...props}
|
|
79
82
|
>
|
|
80
83
|
<GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>
|
package/src/SceneView.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import type { SceneViewHandle, SceneViewProps } from './ExpoArcgis.types';
|
|
14
14
|
import type { SceneRef, GraphicsOverlayRef, AnalysisOverlayRef } from './ExpoArcgisModule';
|
|
15
15
|
import { GeoViewContext, useGeoModel, type GeoViewHost } from './contexts';
|
|
16
|
+
import { sharedObjectId } from './utils/sharedObjectId';
|
|
16
17
|
|
|
17
18
|
type NativeSceneViewProps = SceneViewProps & {
|
|
18
19
|
/** The native scene handle (SharedObject), passed by reference as a view prop. */
|
|
@@ -33,7 +34,7 @@ const NativeSceneView = requireNativeView<NativeSceneViewProps>('ExpoArcgis', 'E
|
|
|
33
34
|
* `<GraphicsOverlay>` / `<AnalysisOverlay>` children, and exposes `retryLoad` via a `ref`.
|
|
34
35
|
*/
|
|
35
36
|
export const SceneView = forwardRef<SceneViewHandle, PropsWithChildren<SceneViewProps>>(
|
|
36
|
-
function SceneView({ children, ...props }, handle) {
|
|
37
|
+
function SceneView({ children, orbitGraphic, ...props }, handle) {
|
|
37
38
|
const scene = useGeoModel() as SceneRef;
|
|
38
39
|
// The native view exposes an async `retryLoad` function callable through its ref.
|
|
39
40
|
const nativeRef = useRef<any>(null);
|
|
@@ -63,9 +64,10 @@ export const SceneView = forwardRef<SceneViewHandle, PropsWithChildren<SceneView
|
|
|
63
64
|
return (
|
|
64
65
|
<NativeSceneView
|
|
65
66
|
ref={nativeRef}
|
|
66
|
-
scene={scene}
|
|
67
|
-
graphicsOverlays={overlays}
|
|
68
|
-
analysisOverlays={analysisOverlays}
|
|
67
|
+
scene={sharedObjectId(scene)}
|
|
68
|
+
graphicsOverlays={overlays.map(sharedObjectId)}
|
|
69
|
+
analysisOverlays={analysisOverlays.map(sharedObjectId)}
|
|
70
|
+
orbitGraphic={sharedObjectId(orbitGraphic)}
|
|
69
71
|
{...props}
|
|
70
72
|
>
|
|
71
73
|
<GeoViewContext.Provider value={host}>{children}</GeoViewContext.Provider>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a SharedObject's registry id (a number) so it can be passed as a native view prop.
|
|
3
|
+
*
|
|
4
|
+
* Why: expo-modules-core only started auto-unwrapping shared objects passed as view props in
|
|
5
|
+
* 56.0.13 (expo/expo#46212). On older SDK 56 patches a raw shared object does not survive the
|
|
6
|
+
* Fabric prop pipeline (it serializes to an empty value), so the native `Prop` is never set and the
|
|
7
|
+
* view stays blank. Passing the registry id explicitly works on every version — the native side
|
|
8
|
+
* resolves the id back to the object (expo/expo#24431), and array props resolve element-wise.
|
|
9
|
+
*
|
|
10
|
+
* Non-shared-object values (null / undefined / already a number) pass through unchanged, so this is
|
|
11
|
+
* also a no-op once #46212 is present. Callers map it over array props.
|
|
12
|
+
*/
|
|
13
|
+
export function sharedObjectId<T>(value: T): T {
|
|
14
|
+
const id = (value as { __expo_shared_object_id__?: number } | null | undefined)
|
|
15
|
+
?.__expo_shared_object_id__;
|
|
16
|
+
return (typeof id === 'number' ? id : value) as T;
|
|
17
|
+
}
|