@lugg/maps 1.0.0-beta.9 → 1.1.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/README.md +15 -100
- package/android/src/main/java/com/luggmaps/LuggCalloutView.kt +5 -0
- package/android/src/main/java/com/luggmaps/LuggMapView.kt +56 -2
- package/android/src/main/java/com/luggmaps/LuggMapViewManager.kt +18 -0
- package/android/src/main/java/com/luggmaps/LuggMapWrapperView.kt +36 -2
- package/android/src/main/java/com/luggmaps/LuggMarkerView.kt +7 -2
- package/android/src/main/java/com/luggmaps/LuggPolylineView.kt +2 -1
- package/android/src/main/java/com/luggmaps/core/GoogleMapProvider.kt +332 -42
- package/android/src/main/java/com/luggmaps/core/MapProviderDelegate.kt +6 -0
- package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +61 -10
- package/ios/LuggMapView.mm +240 -10
- package/ios/LuggMapWrapperView.h +5 -0
- package/ios/LuggMapWrapperView.mm +18 -0
- package/ios/LuggMarkerView.mm +2 -0
- package/ios/core/AppleMapProvider.h +8 -0
- package/ios/core/AppleMapProvider.mm +63 -47
- package/ios/core/AppleStaticMapProvider.h +14 -0
- package/ios/core/AppleStaticMapProvider.mm +233 -0
- package/ios/core/GMSPolylineAnimator.m +40 -15
- package/ios/core/GoogleMapProvider.h +10 -0
- package/ios/core/GoogleMapProvider.mm +67 -54
- package/ios/core/GoogleStaticMapProvider.h +21 -0
- package/ios/core/GoogleStaticMapProvider.mm +217 -0
- package/ios/core/MKPolylineAnimator.m +67 -43
- package/ios/core/MapEdgeInsets.h +18 -0
- package/ios/core/MapProviderDelegate.h +11 -0
- package/ios/core/StaticMapProviderBase.h +80 -0
- package/ios/core/StaticMapProviderBase.mm +847 -0
- package/ios/events/CameraIdleEvent.h +4 -2
- package/ios/events/CameraMoveEvent.h +4 -2
- package/ios/events/CirclePressEvent.h +4 -2
- package/ios/events/GroundOverlayPressEvent.h +4 -2
- 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 +4 -2
- 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/MapView.js +12 -0
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +29 -10
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/module/fabric/LuggMapViewNativeComponent.ts +10 -1
- package/lib/typescript/src/MapView.d.ts +1 -0
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +32 -0
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts +4 -0
- package/lib/typescript/src/fabric/LuggMapViewNativeComponent.d.ts.map +1 -1
- package/package.json +24 -14
- package/src/MapView.tsx +14 -0
- package/src/MapView.types.ts +32 -0
- package/src/MapView.web.tsx +39 -14
- package/src/fabric/LuggMapViewNativeComponent.ts +10 -1
- 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
|
@@ -40,6 +40,13 @@ export interface MapViewRef {
|
|
|
40
40
|
moveCamera(coordinate: Coordinate, options?: MoveCameraOptions): void;
|
|
41
41
|
fitCoordinates(coordinates: Coordinate[], options?: FitCoordinatesOptions): void;
|
|
42
42
|
setEdgeInsets(edgeInsets: EdgeInsets, options?: SetEdgeInsetsOptions): void;
|
|
43
|
+
/**
|
|
44
|
+
* Loads the map again, e.g. to recover from missing tiles. A static map
|
|
45
|
+
* re-renders its base map, discarding the cached snapshot. A live map is
|
|
46
|
+
* recreated at its current coordinate and zoom (heading and pitch reset)
|
|
47
|
+
* and fires onReady again.
|
|
48
|
+
*/
|
|
49
|
+
reload(): void;
|
|
43
50
|
}
|
|
44
51
|
/**
|
|
45
52
|
* Camera event payload
|
|
@@ -106,6 +113,31 @@ export interface MapViewProps extends ViewProps {
|
|
|
106
113
|
* @default true
|
|
107
114
|
*/
|
|
108
115
|
pitchEnabled?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Show compass on the map.
|
|
118
|
+
* On web (Google Maps) this toggles the rotate/compass control.
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
121
|
+
compassEnabled?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Render the map as a non-interactive, static map.
|
|
124
|
+
* Uses Google Maps lite mode on Android. On iOS, the map is replaced
|
|
125
|
+
* with a rendered snapshot once tiles finish loading, releasing the
|
|
126
|
+
* live map resources. Ideal for maps inside list views.
|
|
127
|
+
* Cannot be changed after the map is created.
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
staticMode?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Stable identity for the static snapshot cache (iOS). When set, a map
|
|
133
|
+
* remounted with the same key (and same size, provider, and map settings)
|
|
134
|
+
* reuses its cached snapshot instead of rendering a live map again -
|
|
135
|
+
* e.g. set it to your list item's id. The key must uniquely identify the
|
|
136
|
+
* map's content, including markers and other children. Only fully loaded
|
|
137
|
+
* renders are cached.
|
|
138
|
+
* Only used with staticMode.
|
|
139
|
+
*/
|
|
140
|
+
staticKey?: string;
|
|
109
141
|
/**
|
|
110
142
|
* Map content edge insets
|
|
111
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.types.d.ts","sourceRoot":"","sources":["../../../src/MapView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;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,OAAO,
|
|
1
|
+
{"version":3,"file":"MapView.web.d.ts","sourceRoot":"","sources":["../../../src/MapView.web.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAKX,MAAM,iBAAiB,CAAC;AAoEzB,eAAO,MAAM,OAAO,gGA8anB,CAAC"}
|
|
@@ -60,6 +60,9 @@ export interface NativeProps extends ViewProps {
|
|
|
60
60
|
scrollEnabled?: WithDefault<boolean, true>;
|
|
61
61
|
rotateEnabled?: WithDefault<boolean, true>;
|
|
62
62
|
pitchEnabled?: WithDefault<boolean, true>;
|
|
63
|
+
compassEnabled?: WithDefault<boolean, true>;
|
|
64
|
+
staticMode?: boolean;
|
|
65
|
+
staticKey?: string;
|
|
63
66
|
edgeInsets?: EdgeInsets;
|
|
64
67
|
userLocationEnabled?: boolean;
|
|
65
68
|
userLocationButtonEnabled?: boolean;
|
|
@@ -79,6 +82,7 @@ interface NativeCommands {
|
|
|
79
82
|
moveCamera: (viewRef: React.ElementRef<ComponentType>, latitude: Double, longitude: Double, zoom: Double, duration: Double) => void;
|
|
80
83
|
fitCoordinates: (viewRef: React.ElementRef<ComponentType>, coordinates: Coordinate[], edgeInsetsTop: Double, edgeInsetsLeft: Double, edgeInsetsBottom: Double, edgeInsetsRight: Double, duration: Double) => void;
|
|
81
84
|
setEdgeInsets: (viewRef: React.ElementRef<ComponentType>, top: Double, left: Double, bottom: Double, right: Double, duration: Double) => void;
|
|
85
|
+
reload: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
82
86
|
}
|
|
83
87
|
export declare const Commands: NativeCommands;
|
|
84
88
|
declare const _default: ComponentType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LuggMapViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggMapViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAA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CAAC;IACnD,OAAO,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED,KAAK,aAAa,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhD,UAAU,cAAc;IACtB,UAAU,EAAE,CACV,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV,cAAc,EAAE,CACd,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,WAAW,EAAE,UAAU,EAAE,EACzB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV,aAAa,EAAE,CACb,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"LuggMapViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggMapViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAA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hD,UAAU,cAAc;IACtB,UAAU,EAAE,CACV,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV,cAAc,EAAE,CACd,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,WAAW,EAAE,UAAU,EAAE,EACzB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,EACxB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV,aAAa,EAAE,CACb,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EACxC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC;IACV,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,QAAQ,gBAOnB,CAAC;wBAIE,aAAa;AAFlB,wBAEmB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lugg/maps",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Universal maps for React Native.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"bare": "yarn workspace @lugg/bare-example",
|
|
44
44
|
"expo": "yarn workspace @lugg/expo-example",
|
|
45
|
+
"docs": "yarn workspace @lugg/docs",
|
|
45
46
|
"test": "jest",
|
|
46
47
|
"typecheck": "tsc",
|
|
47
48
|
"lint": "eslint --fix \"**/*.{ts,tsx}\"",
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"clean": "scripts/clean.sh",
|
|
51
52
|
"prepare": "bob build && yarn build:plugin",
|
|
52
53
|
"build:plugin": "tsc --project plugin",
|
|
53
|
-
"release": "release-it
|
|
54
|
+
"release": "release-it",
|
|
55
|
+
"release:beta": "yarn release --preRelease=beta --no-github.release"
|
|
54
56
|
},
|
|
55
57
|
"keywords": [
|
|
56
58
|
"react-native",
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"bugs": {
|
|
67
69
|
"url": "https://github.com/lugg/maps/issues"
|
|
68
70
|
},
|
|
69
|
-
"homepage": "https://
|
|
71
|
+
"homepage": "https://maps.lodev09.com",
|
|
70
72
|
"publishConfig": {
|
|
71
73
|
"registry": "https://registry.npmjs.org/"
|
|
72
74
|
},
|
|
@@ -75,8 +77,10 @@
|
|
|
75
77
|
"@eslint/compat": "^1.3.2",
|
|
76
78
|
"@eslint/eslintrc": "^3.3.1",
|
|
77
79
|
"@eslint/js": "^9.35.0",
|
|
78
|
-
"@
|
|
79
|
-
"@react-native/
|
|
80
|
+
"@expo/config-plugins": "^56.0.8",
|
|
81
|
+
"@react-native/babel-preset": "0.85.3",
|
|
82
|
+
"@react-native/eslint-config": "0.85.3",
|
|
83
|
+
"@react-native/jest-preset": "0.85.3",
|
|
80
84
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
81
85
|
"@types/jest": "^29.5.14",
|
|
82
86
|
"@types/react": "^19.2.0",
|
|
@@ -89,33 +93,35 @@
|
|
|
89
93
|
"jest": "^29.7.0",
|
|
90
94
|
"lefthook": "^2.0.3",
|
|
91
95
|
"prettier": "^2.8.8",
|
|
92
|
-
"react": "19.2.
|
|
93
|
-
"react-native": "0.
|
|
96
|
+
"react": "19.2.3",
|
|
97
|
+
"react-native": "0.85.3",
|
|
94
98
|
"react-native-builder-bob": "^0.40.13",
|
|
95
99
|
"release-it": "^19.0.4",
|
|
96
100
|
"turbo": "^2.5.6",
|
|
97
101
|
"typescript": "^5.9.2"
|
|
98
102
|
},
|
|
99
103
|
"resolutions": {
|
|
100
|
-
"@lodev09/react-native-true-sheet": "3.
|
|
104
|
+
"@lodev09/react-native-true-sheet": "3.11.0-beta.10"
|
|
101
105
|
},
|
|
102
106
|
"peerDependencies": {
|
|
103
107
|
"@vis.gl/react-google-maps": ">=1.0.0",
|
|
108
|
+
"expo": "*",
|
|
104
109
|
"react": "*",
|
|
105
110
|
"react-native": "*"
|
|
106
111
|
},
|
|
107
112
|
"peerDependenciesMeta": {
|
|
108
113
|
"@vis.gl/react-google-maps": {
|
|
109
114
|
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"expo": {
|
|
117
|
+
"optional": true
|
|
110
118
|
}
|
|
111
119
|
},
|
|
112
|
-
"dependencies": {
|
|
113
|
-
"@expo/config-plugins": "^9.0.0"
|
|
114
|
-
},
|
|
115
120
|
"workspaces": [
|
|
116
121
|
"example/bare",
|
|
117
122
|
"example/expo",
|
|
118
|
-
"example/shared"
|
|
123
|
+
"example/shared",
|
|
124
|
+
"docs"
|
|
119
125
|
],
|
|
120
126
|
"packageManager": "yarn@4.11.0",
|
|
121
127
|
"react-native-builder-bob": {
|
|
@@ -158,9 +164,10 @@
|
|
|
158
164
|
}
|
|
159
165
|
},
|
|
160
166
|
"jest": {
|
|
161
|
-
"preset": "react-native",
|
|
167
|
+
"preset": "@react-native/jest-preset",
|
|
162
168
|
"modulePathIgnorePatterns": [
|
|
163
169
|
"<rootDir>/example/bare/node_modules",
|
|
170
|
+
"<rootDir>/docs/",
|
|
164
171
|
"<rootDir>/lib/"
|
|
165
172
|
]
|
|
166
173
|
},
|
|
@@ -187,7 +194,10 @@
|
|
|
187
194
|
},
|
|
188
195
|
"hooks": {
|
|
189
196
|
"before:init": "yarn test",
|
|
190
|
-
"after:bump":
|
|
197
|
+
"after:bump": [
|
|
198
|
+
"yarn tidy",
|
|
199
|
+
"yarn bare pods"
|
|
200
|
+
]
|
|
191
201
|
},
|
|
192
202
|
"plugins": {
|
|
193
203
|
"@release-it/conventional-changelog": {
|
package/src/MapView.tsx
CHANGED
|
@@ -25,6 +25,7 @@ export class MapView
|
|
|
25
25
|
scrollEnabled: true,
|
|
26
26
|
rotateEnabled: true,
|
|
27
27
|
pitchEnabled: true,
|
|
28
|
+
compassEnabled: true,
|
|
28
29
|
poiEnabled: true,
|
|
29
30
|
theme: 'system',
|
|
30
31
|
};
|
|
@@ -79,6 +80,13 @@ export class MapView
|
|
|
79
80
|
Commands.setEdgeInsets(ref, top, left, bottom, right, duration);
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
reload() {
|
|
84
|
+
const ref = this.nativeRef.current;
|
|
85
|
+
if (!ref) return;
|
|
86
|
+
|
|
87
|
+
Commands.reload(ref);
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
render() {
|
|
83
91
|
const {
|
|
84
92
|
provider,
|
|
@@ -92,6 +100,9 @@ export class MapView
|
|
|
92
100
|
scrollEnabled,
|
|
93
101
|
rotateEnabled,
|
|
94
102
|
pitchEnabled,
|
|
103
|
+
compassEnabled,
|
|
104
|
+
staticMode,
|
|
105
|
+
staticKey,
|
|
95
106
|
edgeInsets,
|
|
96
107
|
userLocationEnabled,
|
|
97
108
|
userLocationButtonEnabled,
|
|
@@ -123,6 +134,9 @@ export class MapView
|
|
|
123
134
|
scrollEnabled={scrollEnabled}
|
|
124
135
|
rotateEnabled={rotateEnabled}
|
|
125
136
|
pitchEnabled={pitchEnabled}
|
|
137
|
+
compassEnabled={compassEnabled}
|
|
138
|
+
staticMode={staticMode}
|
|
139
|
+
staticKey={staticKey}
|
|
126
140
|
edgeInsets={edgeInsets}
|
|
127
141
|
userLocationEnabled={userLocationEnabled}
|
|
128
142
|
userLocationButtonEnabled={userLocationButtonEnabled}
|
package/src/MapView.types.ts
CHANGED
|
@@ -135,6 +135,13 @@ export interface MapViewRef {
|
|
|
135
135
|
options?: FitCoordinatesOptions
|
|
136
136
|
): void;
|
|
137
137
|
setEdgeInsets(edgeInsets: EdgeInsets, options?: SetEdgeInsetsOptions): void;
|
|
138
|
+
/**
|
|
139
|
+
* Loads the map again, e.g. to recover from missing tiles. A static map
|
|
140
|
+
* re-renders its base map, discarding the cached snapshot. A live map is
|
|
141
|
+
* recreated at its current coordinate and zoom (heading and pitch reset)
|
|
142
|
+
* and fires onReady again.
|
|
143
|
+
*/
|
|
144
|
+
reload(): void;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
/**
|
|
@@ -204,6 +211,31 @@ export interface MapViewProps extends ViewProps {
|
|
|
204
211
|
* @default true
|
|
205
212
|
*/
|
|
206
213
|
pitchEnabled?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Show compass on the map.
|
|
216
|
+
* On web (Google Maps) this toggles the rotate/compass control.
|
|
217
|
+
* @default true
|
|
218
|
+
*/
|
|
219
|
+
compassEnabled?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Render the map as a non-interactive, static map.
|
|
222
|
+
* Uses Google Maps lite mode on Android. On iOS, the map is replaced
|
|
223
|
+
* with a rendered snapshot once tiles finish loading, releasing the
|
|
224
|
+
* live map resources. Ideal for maps inside list views.
|
|
225
|
+
* Cannot be changed after the map is created.
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
staticMode?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Stable identity for the static snapshot cache (iOS). When set, a map
|
|
231
|
+
* remounted with the same key (and same size, provider, and map settings)
|
|
232
|
+
* reuses its cached snapshot instead of rendering a live map again -
|
|
233
|
+
* e.g. set it to your list item's id. The key must uniquely identify the
|
|
234
|
+
* map's content, including markers and other children. Only fully loaded
|
|
235
|
+
* renders are cached.
|
|
236
|
+
* Only used with staticMode.
|
|
237
|
+
*/
|
|
238
|
+
staticKey?: string;
|
|
207
239
|
/**
|
|
208
240
|
* Map content edge insets
|
|
209
241
|
*/
|
package/src/MapView.web.tsx
CHANGED
|
@@ -110,6 +110,8 @@ export const MapView = memo(
|
|
|
110
110
|
zoomEnabled = true,
|
|
111
111
|
scrollEnabled = true,
|
|
112
112
|
pitchEnabled = true,
|
|
113
|
+
compassEnabled = true,
|
|
114
|
+
staticMode = false,
|
|
113
115
|
edgeInsets,
|
|
114
116
|
userLocationEnabled,
|
|
115
117
|
theme = 'system',
|
|
@@ -125,10 +127,16 @@ export const MapView = memo(
|
|
|
125
127
|
const id = useId();
|
|
126
128
|
const map = useMap(id);
|
|
127
129
|
const containerRef = useRef<View>(null);
|
|
128
|
-
const
|
|
130
|
+
const readyMap = useRef<google.maps.Map | null>(null);
|
|
129
131
|
const isDraggingRef = useRef(false);
|
|
130
132
|
const wasGesture = useRef(false);
|
|
131
133
|
const prevEdgeInsets = useRef(edgeInsets);
|
|
134
|
+
// Bumped by reload() to remount the map at the camera captured then
|
|
135
|
+
const [reloadState, setReloadState] = useState<{
|
|
136
|
+
key: number;
|
|
137
|
+
center?: google.maps.LatLngLiteral;
|
|
138
|
+
zoom?: number;
|
|
139
|
+
}>({ key: 0 });
|
|
132
140
|
|
|
133
141
|
const offsetCenter = useCallback(
|
|
134
142
|
(
|
|
@@ -266,13 +274,25 @@ export const MapView = memo(
|
|
|
266
274
|
) {
|
|
267
275
|
applyEdgeInsets(newEdgeInsets, options?.duration);
|
|
268
276
|
},
|
|
277
|
+
|
|
278
|
+
// The JS SDK can't reload tiles in place; remount the map at the
|
|
279
|
+
// current camera
|
|
280
|
+
reload() {
|
|
281
|
+
if (!map) return;
|
|
282
|
+
|
|
283
|
+
setReloadState((state) => ({
|
|
284
|
+
key: state.key + 1,
|
|
285
|
+
center: map.getCenter()?.toJSON(),
|
|
286
|
+
zoom: map.getZoom(),
|
|
287
|
+
}));
|
|
288
|
+
},
|
|
269
289
|
}),
|
|
270
290
|
[map, initialZoom, offsetCenter, applyEdgeInsets]
|
|
271
291
|
);
|
|
272
292
|
|
|
273
293
|
useEffect(() => {
|
|
274
|
-
if (map &&
|
|
275
|
-
|
|
294
|
+
if (map && readyMap.current !== map) {
|
|
295
|
+
readyMap.current = map;
|
|
276
296
|
onReady?.();
|
|
277
297
|
}
|
|
278
298
|
}, [map, onReady]);
|
|
@@ -367,7 +387,7 @@ export const MapView = memo(
|
|
|
367
387
|
}, []);
|
|
368
388
|
|
|
369
389
|
useEffect(() => {
|
|
370
|
-
if (!map || !onLongPress) return;
|
|
390
|
+
if (!map || !onLongPress || staticMode) return;
|
|
371
391
|
const listeners = [
|
|
372
392
|
map.addListener('mousedown', handleMouseDown),
|
|
373
393
|
map.addListener('mouseup', handleMouseUp),
|
|
@@ -376,7 +396,7 @@ export const MapView = memo(
|
|
|
376
396
|
listeners.forEach((l) => google.maps.event.removeListener(l));
|
|
377
397
|
handleMouseUp();
|
|
378
398
|
};
|
|
379
|
-
}, [map, onLongPress, handleMouseDown, handleMouseUp]);
|
|
399
|
+
}, [map, onLongPress, staticMode, handleMouseDown, handleMouseUp]);
|
|
380
400
|
|
|
381
401
|
const handleDragStart = useCallback(() => {
|
|
382
402
|
handleMouseUp();
|
|
@@ -445,12 +465,13 @@ export const MapView = memo(
|
|
|
445
465
|
? 'hybrid'
|
|
446
466
|
: 'roadmap';
|
|
447
467
|
|
|
448
|
-
const gestureHandling =
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
468
|
+
const gestureHandling = staticMode
|
|
469
|
+
? 'none'
|
|
470
|
+
: scrollEnabled === false && zoomEnabled === false
|
|
471
|
+
? 'none'
|
|
472
|
+
: scrollEnabled === false
|
|
473
|
+
? 'cooperative'
|
|
474
|
+
: 'auto';
|
|
454
475
|
|
|
455
476
|
const colorScheme =
|
|
456
477
|
theme === 'dark'
|
|
@@ -478,19 +499,23 @@ export const MapView = memo(
|
|
|
478
499
|
>
|
|
479
500
|
<View ref={containerRef} style={style}>
|
|
480
501
|
<Map
|
|
502
|
+
key={reloadState.key}
|
|
481
503
|
id={id}
|
|
482
504
|
mapId={mapId}
|
|
483
|
-
defaultCenter={defaultCenter}
|
|
484
|
-
defaultZoom={initialZoom}
|
|
505
|
+
defaultCenter={reloadState.center ?? defaultCenter}
|
|
506
|
+
defaultZoom={reloadState.zoom ?? initialZoom}
|
|
485
507
|
minZoom={minZoom}
|
|
486
508
|
maxZoom={maxZoom}
|
|
487
509
|
mapTypeId={mapTypeId}
|
|
488
510
|
gestureHandling={gestureHandling}
|
|
489
511
|
colorScheme={colorScheme}
|
|
490
512
|
disableDefaultUI
|
|
513
|
+
rotateControl={staticMode ? false : compassEnabled}
|
|
514
|
+
clickableIcons={!staticMode}
|
|
515
|
+
keyboardShortcuts={!staticMode}
|
|
491
516
|
isFractionalZoomEnabled
|
|
492
517
|
tilt={pitchEnabled === false ? 0 : undefined}
|
|
493
|
-
onClick={handleClick}
|
|
518
|
+
onClick={staticMode ? undefined : handleClick}
|
|
494
519
|
onDragstart={handleDragStart}
|
|
495
520
|
onDragend={handleDragEnd}
|
|
496
521
|
onCameraChanged={handleCameraChanged}
|
|
@@ -75,6 +75,9 @@ export interface NativeProps extends ViewProps {
|
|
|
75
75
|
scrollEnabled?: WithDefault<boolean, true>;
|
|
76
76
|
rotateEnabled?: WithDefault<boolean, true>;
|
|
77
77
|
pitchEnabled?: WithDefault<boolean, true>;
|
|
78
|
+
compassEnabled?: WithDefault<boolean, true>;
|
|
79
|
+
staticMode?: boolean;
|
|
80
|
+
staticKey?: string;
|
|
78
81
|
edgeInsets?: EdgeInsets;
|
|
79
82
|
userLocationEnabled?: boolean;
|
|
80
83
|
userLocationButtonEnabled?: boolean;
|
|
@@ -117,10 +120,16 @@ interface NativeCommands {
|
|
|
117
120
|
right: Double,
|
|
118
121
|
duration: Double
|
|
119
122
|
) => void;
|
|
123
|
+
reload: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
export const Commands = codegenNativeCommands<NativeCommands>({
|
|
123
|
-
supportedCommands: [
|
|
127
|
+
supportedCommands: [
|
|
128
|
+
'moveCamera',
|
|
129
|
+
'fitCoordinates',
|
|
130
|
+
'setEdgeInsets',
|
|
131
|
+
'reload',
|
|
132
|
+
],
|
|
124
133
|
});
|
|
125
134
|
|
|
126
135
|
export default codegenNativeComponent<NativeProps>(
|
|
@@ -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;
|