@lugg/maps 1.0.0-beta.2 → 1.0.0-beta.20
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 +3 -0
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +9 -2
- package/android/src/main/java/com/luggmaps/LuggCalloutViewManager.kt +4 -3
- package/android/src/main/java/com/luggmaps/LuggCircleView.kt +85 -0
- package/android/src/main/java/com/luggmaps/LuggCircleViewManager.kt +79 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayView.kt +81 -0
- package/android/src/main/java/com/luggmaps/LuggGroundOverlayViewManager.kt +82 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +90 -0
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +45 -0
- package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +27 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +30 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerViewManager.kt +13 -0
- package/android/src/main/java/com/luggmaps/LuggPackage.kt +4 -1
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +3 -23
- package/android/src/main/java/com/luggmaps/LuggTileOverlayView.kt +92 -0
- package/android/src/main/java/com/luggmaps/LuggTileOverlayViewManager.kt +80 -0
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +676 -36
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +15 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +65 -11
- package/android/src/main/java/com/luggmaps/events/CirclePressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/GroundOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/events/TileOverlayPressEvent.kt +12 -0
- package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +11 -0
- package/ios/LuggCalloutView.h +1 -1
- package/ios/LuggCalloutView.mm +21 -11
- package/ios/LuggCircleView.h +31 -0
- package/ios/LuggCircleView.mm +133 -0
- package/ios/LuggGroundOverlayView.h +30 -0
- package/ios/LuggGroundOverlayView.mm +125 -0
- package/ios/LuggMapView.mm +254 -4
- package/ios/LuggMapWrapperView.h +5 -0
- package/ios/LuggMapWrapperView.mm +18 -0
- package/ios/LuggMarkerView.h +3 -0
- package/ios/LuggMarkerView.mm +25 -0
- package/ios/LuggTileOverlayView.h +31 -0
- package/ios/LuggTileOverlayView.mm +130 -0
- package/ios/core/AppleMapProvider.h +8 -0
- package/ios/core/AppleMapProvider.mm +663 -29
- package/ios/core/AppleStaticMapProvider.h +14 -0
- package/ios/core/AppleStaticMapProvider.mm +159 -0
- package/ios/core/GMSPolylineAnimator.m +46 -18
- package/ios/core/GoogleMapProvider.h +10 -0
- package/ios/core/GoogleMapProvider.mm +430 -51
- package/ios/core/GoogleStaticMapProvider.h +21 -0
- package/ios/core/GoogleStaticMapProvider.mm +213 -0
- package/ios/core/MKPolylineAnimator.m +67 -43
- package/ios/core/MapProviderDelegate.h +27 -1
- package/ios/core/StaticMapProviderBase.h +75 -0
- package/ios/core/StaticMapProviderBase.mm +845 -0
- package/ios/events/CameraIdleEvent.h +4 -2
- package/ios/events/CameraMoveEvent.h +4 -2
- package/ios/events/CirclePressEvent.h +22 -0
- package/ios/events/GroundOverlayPressEvent.h +22 -0
- package/ios/events/LongPressEvent.h +4 -2
- package/ios/events/MarkerDragEvent.h +12 -6
- package/ios/events/MarkerPressEvent.h +4 -2
- package/ios/events/PolygonPressEvent.h +4 -2
- package/ios/events/PressEvent.h +4 -2
- package/ios/events/ReadyEvent.h +4 -2
- package/ios/events/TileOverlayPressEvent.h +22 -0
- package/ios/extensions/MKMapView+Zoom.h +20 -0
- package/ios/extensions/MKMapView+Zoom.m +28 -18
- package/ios/extensions/UIView+Snapshot.h +16 -0
- package/ios/extensions/UIView+Snapshot.m +27 -0
- package/lib/module/MapProvider.web.js +4 -1
- package/lib/module/MapProvider.web.js.map +1 -1
- package/lib/module/MapView.js +19 -1
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +30 -22
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/components/Circle.js +46 -0
- package/lib/module/components/Circle.js.map +1 -0
- package/lib/module/components/Circle.types.js +4 -0
- package/lib/module/components/Circle.types.js.map +1 -0
- package/lib/module/components/Circle.web.js +79 -0
- package/lib/module/components/Circle.web.js.map +1 -0
- package/lib/module/components/GeoJson.js +3 -3
- package/lib/module/components/GeoJson.js.map +1 -1
- package/lib/module/components/GroundOverlay.js +45 -0
- package/lib/module/components/GroundOverlay.js.map +1 -0
- package/lib/module/components/GroundOverlay.types.js +4 -0
- package/lib/module/components/GroundOverlay.types.js.map +1 -0
- package/lib/module/components/GroundOverlay.web.js +77 -0
- package/lib/module/components/GroundOverlay.web.js.map +1 -0
- package/lib/module/components/Marker.js +22 -4
- package/lib/module/components/Marker.js.map +1 -1
- package/lib/module/components/Marker.web.js +23 -10
- package/lib/module/components/Marker.web.js.map +1 -1
- package/lib/module/components/Polygon.web.js +3 -3
- package/lib/module/components/Polygon.web.js.map +1 -1
- package/lib/module/components/Polyline.web.js +6 -12
- package/lib/module/components/Polyline.web.js.map +1 -1
- package/lib/module/components/TileOverlay.js +44 -0
- package/lib/module/components/TileOverlay.js.map +1 -0
- package/lib/module/components/TileOverlay.types.js +4 -0
- package/lib/module/components/TileOverlay.types.js.map +1 -0
- package/lib/module/components/TileOverlay.web.js +69 -0
- package/lib/module/components/TileOverlay.web.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/index.web.js +3 -0
- package/lib/module/components/index.web.js.map +1 -1
- package/lib/module/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/lib/module/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/lib/module/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/lib/module/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/lib/module/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/src/MapProvider.web.d.ts +3 -2
- package/lib/typescript/src/MapProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/MapView.d.ts +1 -1
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +60 -1
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Circle.d.ts +10 -0
- package/lib/typescript/src/components/Circle.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.types.d.ts +33 -0
- package/lib/typescript/src/components/Circle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/Circle.web.d.ts +3 -0
- package/lib/typescript/src/components/Circle.web.d.ts.map +1 -0
- package/lib/typescript/src/components/GeoJson.d.ts +2 -1
- package/lib/typescript/src/components/GeoJson.d.ts.map +1 -1
- package/lib/typescript/src/components/GroundOverlay.d.ts +10 -0
- package/lib/typescript/src/components/GroundOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts +35 -0
- package/lib/typescript/src/components/GroundOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/GroundOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/Marker.d.ts +6 -3
- package/lib/typescript/src/components/Marker.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.types.d.ts +18 -6
- package/lib/typescript/src/components/Marker.types.d.ts.map +1 -1
- package/lib/typescript/src/components/Marker.web.d.ts +3 -2
- package/lib/typescript/src/components/Marker.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts +1 -1
- package/lib/typescript/src/components/Polygon.web.d.ts.map +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts +1 -1
- package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -1
- package/lib/typescript/src/components/TileOverlay.d.ts +10 -0
- package/lib/typescript/src/components/TileOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts +36 -0
- package/lib/typescript/src/components/TileOverlay.types.d.ts.map +1 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts +3 -0
- package/lib/typescript/src/components/TileOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +7 -1
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/index.web.d.ts +6 -0
- package/lib/typescript/src/components/index.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggCalloutViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/fabric/LuggCircleViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggGroundOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +13 -5
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts +8 -1
- package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts +21 -0
- package/lib/typescript/src/fabric/LuggTileOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +7 -1
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +17 -11
- package/src/MapProvider.web.tsx +5 -3
- package/src/MapView.tsx +19 -1
- package/src/MapView.types.ts +142 -1
- package/src/MapView.web.tsx +379 -340
- package/src/components/Circle.tsx +52 -0
- package/src/components/Circle.types.ts +33 -0
- package/src/components/Circle.web.tsx +95 -0
- package/src/components/GeoJson.tsx +3 -3
- package/src/components/GroundOverlay.tsx +47 -0
- package/src/components/GroundOverlay.types.ts +36 -0
- package/src/components/GroundOverlay.web.tsx +81 -0
- package/src/components/Marker.tsx +32 -6
- package/src/components/Marker.types.ts +19 -6
- package/src/components/Marker.web.tsx +196 -150
- package/src/components/Polygon.web.tsx +93 -89
- package/src/components/Polyline.web.tsx +235 -235
- package/src/components/TileOverlay.tsx +44 -0
- package/src/components/TileOverlay.types.ts +37 -0
- package/src/components/TileOverlay.web.tsx +97 -0
- package/src/components/index.ts +10 -0
- package/src/components/index.web.ts +9 -0
- package/src/fabric/LuggCalloutViewNativeComponent.ts +1 -1
- package/src/fabric/LuggCircleViewNativeComponent.ts +25 -0
- package/src/fabric/LuggGroundOverlayViewNativeComponent.ts +29 -0
- package/src/fabric/LuggMapViewNativeComponent.ts +16 -5
- package/src/fabric/LuggMarkerViewNativeComponent.ts +14 -2
- package/src/fabric/LuggTileOverlayViewNativeComponent.ts +30 -0
- package/src/index.ts +12 -1
- package/src/index.web.ts +15 -0
- package/src/types.ts +0 -5
- package/plugin/build/withMapsAndroid.d.ts +0 -5
- package/plugin/build/withMapsAndroid.js +0 -15
- package/plugin/build/withMapsIOS.d.ts +0 -5
- package/plugin/build/withMapsIOS.js +0 -27
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { useMapContext } from '../MapProvider.web';
|
|
3
|
+
import type { TileOverlayProps } from './TileOverlay.types';
|
|
4
|
+
|
|
5
|
+
export const TileOverlay = memo(
|
|
6
|
+
({
|
|
7
|
+
urlTemplate,
|
|
8
|
+
tileSize = 256,
|
|
9
|
+
opacity = 1,
|
|
10
|
+
bounds,
|
|
11
|
+
zIndex = 0,
|
|
12
|
+
onPress,
|
|
13
|
+
}: TileOverlayProps) => {
|
|
14
|
+
const { map } = useMapContext();
|
|
15
|
+
const overlayRef = useRef<google.maps.ImageMapType | null>(null);
|
|
16
|
+
const indexRef = useRef<number>(-1);
|
|
17
|
+
|
|
18
|
+
const handleClick = useCallback(() => {
|
|
19
|
+
onPress?.();
|
|
20
|
+
}, [onPress]);
|
|
21
|
+
|
|
22
|
+
// Cleanup on unmount
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
return () => {
|
|
25
|
+
if (overlayRef.current && indexRef.current >= 0) {
|
|
26
|
+
map?.overlayMapTypes.removeAt(indexRef.current);
|
|
27
|
+
}
|
|
28
|
+
overlayRef.current = null;
|
|
29
|
+
indexRef.current = -1;
|
|
30
|
+
};
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
// Sync overlay with props
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!map) return;
|
|
37
|
+
|
|
38
|
+
// Remove old overlay
|
|
39
|
+
if (overlayRef.current && indexRef.current >= 0) {
|
|
40
|
+
map.overlayMapTypes.removeAt(indexRef.current);
|
|
41
|
+
overlayRef.current = null;
|
|
42
|
+
indexRef.current = -1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!urlTemplate) return;
|
|
46
|
+
|
|
47
|
+
const imageMapType = new google.maps.ImageMapType({
|
|
48
|
+
getTileUrl: (coord, zoom) => {
|
|
49
|
+
if (bounds) {
|
|
50
|
+
const n = Math.pow(2, zoom);
|
|
51
|
+
const tileSWLat =
|
|
52
|
+
(Math.atan(Math.sinh(Math.PI * (1 - (2 * (coord.y + 1)) / n))) *
|
|
53
|
+
180) /
|
|
54
|
+
Math.PI;
|
|
55
|
+
const tileNELat =
|
|
56
|
+
(Math.atan(Math.sinh(Math.PI * (1 - (2 * coord.y) / n))) * 180) /
|
|
57
|
+
Math.PI;
|
|
58
|
+
const tileSWLng = (coord.x / n) * 360 - 180;
|
|
59
|
+
const tileNELng = ((coord.x + 1) / n) * 360 - 180;
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
tileNELat < bounds.southwest.latitude ||
|
|
63
|
+
tileSWLat > bounds.northeast.latitude ||
|
|
64
|
+
tileNELng < bounds.southwest.longitude ||
|
|
65
|
+
tileSWLng > bounds.northeast.longitude
|
|
66
|
+
) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return urlTemplate
|
|
72
|
+
.replace('{x}', String(coord.x))
|
|
73
|
+
.replace('{y}', String(coord.y))
|
|
74
|
+
.replace('{z}', String(zoom));
|
|
75
|
+
},
|
|
76
|
+
tileSize: new google.maps.Size(tileSize, tileSize),
|
|
77
|
+
opacity,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const length = map.overlayMapTypes.getLength();
|
|
81
|
+
map.overlayMapTypes.insertAt(length, imageMapType);
|
|
82
|
+
overlayRef.current = imageMapType;
|
|
83
|
+
indexRef.current = length;
|
|
84
|
+
}, [
|
|
85
|
+
map,
|
|
86
|
+
urlTemplate,
|
|
87
|
+
tileSize,
|
|
88
|
+
opacity,
|
|
89
|
+
bounds,
|
|
90
|
+
zIndex,
|
|
91
|
+
onPress,
|
|
92
|
+
handleClick,
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export { Marker } from './Marker';
|
|
2
2
|
export type {
|
|
3
3
|
CalloutOptions,
|
|
4
|
+
MarkerRef,
|
|
4
5
|
MarkerProps,
|
|
5
6
|
MarkerPressEvent,
|
|
6
7
|
MarkerDragEvent,
|
|
7
8
|
} from './Marker.types';
|
|
8
9
|
export { Polygon } from './Polygon';
|
|
9
10
|
export type { PolygonProps } from './Polygon.types';
|
|
11
|
+
export { Circle } from './Circle';
|
|
12
|
+
export type { CircleProps } from './Circle.types';
|
|
10
13
|
export { Polyline } from './Polyline';
|
|
11
14
|
export type {
|
|
12
15
|
PolylineProps,
|
|
@@ -15,3 +18,10 @@ export type {
|
|
|
15
18
|
} from './Polyline.types';
|
|
16
19
|
export { GeoJson } from './GeoJson';
|
|
17
20
|
export type { GeoJsonProps } from './GeoJson.types';
|
|
21
|
+
export { GroundOverlay } from './GroundOverlay';
|
|
22
|
+
export type {
|
|
23
|
+
GroundOverlayProps,
|
|
24
|
+
GroundOverlayBounds,
|
|
25
|
+
} from './GroundOverlay.types';
|
|
26
|
+
export { TileOverlay } from './TileOverlay';
|
|
27
|
+
export type { TileOverlayProps, TileOverlayBounds } from './TileOverlay.types';
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { Marker } from './Marker.web';
|
|
2
2
|
export { Polygon } from './Polygon.web';
|
|
3
|
+
export { Circle } from './Circle.web';
|
|
3
4
|
export { Polyline } from './Polyline.web';
|
|
4
5
|
export type { CalloutOptions, MarkerProps } from './Marker.types';
|
|
5
6
|
export type { PolygonProps } from './Polygon.types';
|
|
7
|
+
export type { CircleProps } from './Circle.types';
|
|
6
8
|
export type { PolylineProps } from './Polyline.types';
|
|
7
9
|
export { GeoJson } from './GeoJson';
|
|
8
10
|
export type { GeoJsonProps } from './GeoJson.types';
|
|
11
|
+
export { GroundOverlay } from './GroundOverlay.web';
|
|
12
|
+
export type {
|
|
13
|
+
GroundOverlayProps,
|
|
14
|
+
GroundOverlayBounds,
|
|
15
|
+
} from './GroundOverlay.types';
|
|
16
|
+
export { TileOverlay } from './TileOverlay.web';
|
|
17
|
+
export type { TileOverlayProps, TileOverlayBounds } from './TileOverlay.types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
import type { ViewProps, HostComponent, ColorValue } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
Double,
|
|
5
|
+
DirectEventHandler,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export interface Coordinate {
|
|
9
|
+
latitude: Double;
|
|
10
|
+
longitude: Double;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NativeProps extends ViewProps {
|
|
14
|
+
center: Coordinate;
|
|
15
|
+
radius?: Double;
|
|
16
|
+
strokeColor?: ColorValue;
|
|
17
|
+
strokeWidth?: Double;
|
|
18
|
+
fillColor?: ColorValue;
|
|
19
|
+
tappable?: boolean;
|
|
20
|
+
onCirclePress?: DirectEventHandler<null>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default codegenNativeComponent<NativeProps>(
|
|
24
|
+
'LuggCircleView'
|
|
25
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
import type { ViewProps, HostComponent } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
Double,
|
|
5
|
+
DirectEventHandler,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export interface Coordinate {
|
|
9
|
+
latitude: Double;
|
|
10
|
+
longitude: Double;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Bounds {
|
|
14
|
+
northeast: Coordinate;
|
|
15
|
+
southwest: Coordinate;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface NativeProps extends ViewProps {
|
|
19
|
+
image: string;
|
|
20
|
+
bounds: Bounds;
|
|
21
|
+
opacity?: Double;
|
|
22
|
+
bearing?: Double;
|
|
23
|
+
tappable?: boolean;
|
|
24
|
+
onGroundOverlayPress?: DirectEventHandler<null>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default codegenNativeComponent<NativeProps>(
|
|
28
|
+
'LuggGroundOverlayView'
|
|
29
|
+
) as HostComponent<NativeProps>;
|
|
@@ -62,19 +62,30 @@ export interface ReadyEvent {}
|
|
|
62
62
|
|
|
63
63
|
export interface NativeProps extends ViewProps {
|
|
64
64
|
provider?: WithDefault<'google' | 'apple', 'google'>;
|
|
65
|
+
mapType?: WithDefault<
|
|
66
|
+
'standard' | 'satellite' | 'terrain' | 'hybrid' | 'muted-standard',
|
|
67
|
+
'standard'
|
|
68
|
+
>;
|
|
65
69
|
mapId?: string;
|
|
66
70
|
initialCoordinate?: Coordinate;
|
|
67
71
|
initialZoom?: Double;
|
|
68
72
|
minZoom?: Double;
|
|
69
73
|
maxZoom?: Double;
|
|
70
|
-
zoomEnabled?: boolean
|
|
71
|
-
scrollEnabled?: boolean
|
|
72
|
-
rotateEnabled?: boolean
|
|
73
|
-
pitchEnabled?: boolean
|
|
74
|
+
zoomEnabled?: WithDefault<boolean, true>;
|
|
75
|
+
scrollEnabled?: WithDefault<boolean, true>;
|
|
76
|
+
rotateEnabled?: WithDefault<boolean, true>;
|
|
77
|
+
pitchEnabled?: WithDefault<boolean, true>;
|
|
78
|
+
compassEnabled?: WithDefault<boolean, true>;
|
|
79
|
+
staticMode?: boolean;
|
|
80
|
+
staticKey?: string;
|
|
74
81
|
edgeInsets?: EdgeInsets;
|
|
75
82
|
userLocationEnabled?: boolean;
|
|
76
83
|
userLocationButtonEnabled?: boolean;
|
|
77
|
-
|
|
84
|
+
poiEnabled?: boolean;
|
|
85
|
+
poiFilterMode?: WithDefault<'including' | 'excluding', 'including'>;
|
|
86
|
+
poiFilterCategories?: ReadonlyArray<string>;
|
|
87
|
+
theme?: WithDefault<'system' | 'light' | 'dark', 'system'>;
|
|
88
|
+
insetAdjustment?: WithDefault<'never' | 'automatic', 'never'>;
|
|
78
89
|
onMapPress?: DirectEventHandler<PressEvent>;
|
|
79
90
|
onMapLongPress?: DirectEventHandler<LongPressEvent>;
|
|
80
91
|
onCameraMove?: DirectEventHandler<CameraMoveEvent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { codegenNativeComponent } from 'react-native';
|
|
1
|
+
import { codegenNativeComponent, codegenNativeCommands } from 'react-native';
|
|
2
2
|
import type { ViewProps, HostComponent } from 'react-native';
|
|
3
3
|
import type {
|
|
4
4
|
Double,
|
|
@@ -25,6 +25,7 @@ export interface NativeProps extends ViewProps {
|
|
|
25
25
|
rotate?: WithDefault<Double, 0>;
|
|
26
26
|
scale?: WithDefault<Double, 1>;
|
|
27
27
|
rasterize?: WithDefault<boolean, true>;
|
|
28
|
+
centerOnPress?: WithDefault<boolean, true>;
|
|
28
29
|
draggable?: WithDefault<boolean, false>;
|
|
29
30
|
onMarkerPress?: DirectEventHandler<{
|
|
30
31
|
coordinate: {
|
|
@@ -68,6 +69,17 @@ export interface NativeProps extends ViewProps {
|
|
|
68
69
|
}>;
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
73
|
+
|
|
74
|
+
interface NativeCommands {
|
|
75
|
+
showCallout: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
76
|
+
hideCallout: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
80
|
+
supportedCommands: ['showCallout', 'hideCallout'],
|
|
81
|
+
});
|
|
82
|
+
|
|
71
83
|
export default codegenNativeComponent<NativeProps>(
|
|
72
84
|
'LuggMarkerView'
|
|
73
|
-
) as
|
|
85
|
+
) as ComponentType;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { codegenNativeComponent } from 'react-native';
|
|
2
|
+
import type { ViewProps, HostComponent } from 'react-native';
|
|
3
|
+
import type {
|
|
4
|
+
Double,
|
|
5
|
+
Int32,
|
|
6
|
+
DirectEventHandler,
|
|
7
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
|
+
|
|
9
|
+
export interface Coordinate {
|
|
10
|
+
latitude: Double;
|
|
11
|
+
longitude: Double;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Bounds {
|
|
15
|
+
northeast: Coordinate;
|
|
16
|
+
southwest: Coordinate;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface NativeProps extends ViewProps {
|
|
20
|
+
urlTemplate: string;
|
|
21
|
+
tileSize?: Int32;
|
|
22
|
+
opacity?: Double;
|
|
23
|
+
bounds?: Bounds;
|
|
24
|
+
tappable?: boolean;
|
|
25
|
+
onTileOverlayPress?: DirectEventHandler<null>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default codegenNativeComponent<NativeProps>(
|
|
29
|
+
'LuggTileOverlayView'
|
|
30
|
+
) as HostComponent<NativeProps>;
|
package/src/index.ts
CHANGED
|
@@ -4,12 +4,15 @@ export type { MapProviderProps } from './MapProvider.types';
|
|
|
4
4
|
export { Marker } from './components';
|
|
5
5
|
export type {
|
|
6
6
|
CalloutOptions,
|
|
7
|
+
MarkerRef,
|
|
7
8
|
MarkerProps,
|
|
8
9
|
MarkerPressEvent,
|
|
9
10
|
MarkerDragEvent,
|
|
10
11
|
} from './components';
|
|
11
12
|
export { Polygon } from './components';
|
|
12
13
|
export type { PolygonProps } from './components';
|
|
14
|
+
export { Circle } from './components';
|
|
15
|
+
export type { CircleProps } from './components';
|
|
13
16
|
export { Polyline } from './components';
|
|
14
17
|
export type {
|
|
15
18
|
PolylineProps,
|
|
@@ -18,6 +21,10 @@ export type {
|
|
|
18
21
|
} from './components';
|
|
19
22
|
export { GeoJson } from './components';
|
|
20
23
|
export type { GeoJsonProps } from './components';
|
|
24
|
+
export { GroundOverlay } from './components';
|
|
25
|
+
export type { GroundOverlayProps, GroundOverlayBounds } from './components';
|
|
26
|
+
export { TileOverlay } from './components';
|
|
27
|
+
export type { TileOverlayProps, TileOverlayBounds } from './components';
|
|
21
28
|
export type {
|
|
22
29
|
MapViewProps,
|
|
23
30
|
MapViewRef,
|
|
@@ -27,10 +34,14 @@ export type {
|
|
|
27
34
|
CameraEventPayload,
|
|
28
35
|
MapCameraEvent,
|
|
29
36
|
MapPressEvent,
|
|
37
|
+
MapType,
|
|
38
|
+
MapTheme,
|
|
39
|
+
InsetAdjustment,
|
|
40
|
+
PoiCategory,
|
|
41
|
+
PoiFilter,
|
|
30
42
|
} from './MapView.types';
|
|
31
43
|
export type {
|
|
32
44
|
MapProvider as MapProviderType,
|
|
33
|
-
MapTheme,
|
|
34
45
|
Coordinate,
|
|
35
46
|
Point,
|
|
36
47
|
EdgeInsets,
|
package/src/index.web.ts
CHANGED
|
@@ -5,16 +5,31 @@ export { Marker } from './components/index.web';
|
|
|
5
5
|
export type { CalloutOptions, MarkerProps } from './components/index.web';
|
|
6
6
|
export { Polygon } from './components/index.web';
|
|
7
7
|
export type { PolygonProps } from './components/index.web';
|
|
8
|
+
export { Circle } from './components/index.web';
|
|
9
|
+
export type { CircleProps } from './components/index.web';
|
|
8
10
|
export { Polyline } from './components/index.web';
|
|
9
11
|
export type { PolylineProps } from './components/index.web';
|
|
10
12
|
export { GeoJson } from './components/index.web';
|
|
11
13
|
export type { GeoJsonProps } from './components/index.web';
|
|
14
|
+
export { GroundOverlay } from './components/index.web';
|
|
15
|
+
export type {
|
|
16
|
+
GroundOverlayProps,
|
|
17
|
+
GroundOverlayBounds,
|
|
18
|
+
} from './components/index.web';
|
|
19
|
+
export { TileOverlay } from './components/index.web';
|
|
20
|
+
export type {
|
|
21
|
+
TileOverlayProps,
|
|
22
|
+
TileOverlayBounds,
|
|
23
|
+
} from './components/index.web';
|
|
12
24
|
export type {
|
|
13
25
|
MapViewProps,
|
|
14
26
|
MapViewRef,
|
|
15
27
|
MoveCameraOptions,
|
|
16
28
|
FitCoordinatesOptions,
|
|
17
29
|
CameraEventPayload,
|
|
30
|
+
MapType,
|
|
31
|
+
PoiCategory,
|
|
32
|
+
PoiFilter,
|
|
18
33
|
} from './MapView.types';
|
|
19
34
|
export type {
|
|
20
35
|
MapProvider as MapProviderType,
|
package/src/types.ts
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withLuggMapsAndroid = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
const withLuggMapsAndroid = (config, { apiKey }) => {
|
|
6
|
-
if (!apiKey) {
|
|
7
|
-
return config;
|
|
8
|
-
}
|
|
9
|
-
return (0, config_plugins_1.withAndroidManifest)(config, (c) => {
|
|
10
|
-
const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(c.modResults);
|
|
11
|
-
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, 'com.google.android.geo.API_KEY', apiKey);
|
|
12
|
-
return c;
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
exports.withLuggMapsAndroid = withLuggMapsAndroid;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withLuggMapsIOS = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
const withLuggMapsIOS = (config, { apiKey }) => {
|
|
6
|
-
if (!apiKey) {
|
|
7
|
-
return config;
|
|
8
|
-
}
|
|
9
|
-
config = (0, config_plugins_1.withInfoPlist)(config, (c) => {
|
|
10
|
-
c.modResults.GMSApiKey = apiKey;
|
|
11
|
-
return c;
|
|
12
|
-
});
|
|
13
|
-
config = (0, config_plugins_1.withAppDelegate)(config, (c) => {
|
|
14
|
-
const contents = c.modResults.contents;
|
|
15
|
-
// Add import for GoogleMaps
|
|
16
|
-
if (!contents.includes('import GoogleMaps')) {
|
|
17
|
-
c.modResults.contents = contents.replace(/(import (?:UIKit|Expo))/, '$1\nimport GoogleMaps');
|
|
18
|
-
}
|
|
19
|
-
// Add GMSServices.provideAPIKey call
|
|
20
|
-
if (!c.modResults.contents.includes('GMSServices.provideAPIKey')) {
|
|
21
|
-
c.modResults.contents = c.modResults.contents.replace(/(func application\([^)]+\)[^{]*\{)/, `$1\n GMSServices.provideAPIKey("${apiKey}")\n`);
|
|
22
|
-
}
|
|
23
|
-
return c;
|
|
24
|
-
});
|
|
25
|
-
return config;
|
|
26
|
-
};
|
|
27
|
-
exports.withLuggMapsIOS = withLuggMapsIOS;
|