react-native-steerpath-smart-map 1.29.5 → 2.0.0-alpha.1
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/.eslintrc.js +66 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +35 -0
- package/README.md +7 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.kt +28 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.class +0 -0
- package/android/bin/src/main/java/com/steerpath/rnsmartmap/Utils.class +0 -0
- package/android/build.gradle +22 -33
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartLocationManager.java +22 -14
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapManager.java +9 -31
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapPackage.java +11 -9
- package/android/src/main/java/com/steerpath/rnsmartmap/Utils.java +36 -36
- package/ios/RNSmartLocationManager.m +28 -3
- package/ios/RNSmartMapManager.m +10 -22
- package/lib/commonjs/SmartLocationManager.js +50 -0
- package/lib/commonjs/SmartLocationManager.js.map +1 -0
- package/lib/commonjs/SmartLocationManager.web.js +11 -0
- package/lib/commonjs/SmartLocationManager.web.js.map +1 -0
- package/lib/commonjs/SmartMapManager.js +59 -0
- package/lib/commonjs/SmartMapManager.js.map +1 -0
- package/lib/commonjs/SmartMapManager.web.js +24 -0
- package/lib/commonjs/SmartMapManager.web.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/SmartLocationManager.js +46 -0
- package/lib/module/SmartLocationManager.js.map +1 -0
- package/lib/module/SmartLocationManager.web.js +7 -0
- package/lib/module/SmartLocationManager.web.js.map +1 -0
- package/lib/module/SmartMapManager.js +54 -0
- package/lib/module/SmartMapManager.js.map +1 -0
- package/lib/module/SmartMapManager.web.js +20 -0
- package/lib/module/SmartMapManager.web.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/SmartLocationManager.d.ts +19 -0
- package/lib/typescript/SmartLocationManager.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartLocationManager.web.d.ts +1 -0
- package/lib/typescript/SmartLocationManager.web.d.ts.map +1 -0
- package/{dist → lib/typescript}/SmartMapManager.d.ts +13 -15
- package/lib/typescript/SmartMapManager.d.ts.map +1 -0
- package/lib/typescript/SmartMapManager.web.d.ts +8 -0
- package/lib/typescript/SmartMapManager.web.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +38 -13
- package/react-native-steerpath-smart-map.podspec +15 -12
- package/src/SmartLocationManager.ts +25 -9
- package/src/SmartMapManager.ts +12 -19
- package/src/SmartMapManager.web.ts +3 -24
- package/src/index.ts +3 -4
- package/tsconfig.json +14 -9
- package/.eslintrc.json +0 -81
- package/android/bin/.project +0 -34
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/bin/README.md +0 -14
- package/android/bin/build.gradle +0 -59
- package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/bin/gradlew +0 -172
- package/android/bin/gradlew.bat +0 -84
- package/android/bin/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/steerpath/rnsmartmap/RNEventKeys.java +0 -29
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartGeofenceManager.java +0 -103
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapModule.java +0 -284
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapView.java +0 -470
- package/android/src/main/java/com/steerpath/rnsmartmap/RNSmartMapViewManager.java +0 -307
- package/dist/SmartGeofenceManager.d.ts +0 -17
- package/dist/SmartGeofenceManager.js +0 -61
- package/dist/SmartGeofenceManager.web.d.ts +0 -9
- package/dist/SmartGeofenceManager.web.js +0 -10
- package/dist/SmartLocationManager.d.ts +0 -11
- package/dist/SmartLocationManager.js +0 -22
- package/dist/SmartLocationManager.web.js +0 -4
- package/dist/SmartMapEventManager.web.d.ts +0 -5
- package/dist/SmartMapEventManager.web.js +0 -10
- package/dist/SmartMapManager.js +0 -53
- package/dist/SmartMapManager.web.d.ts +0 -12
- package/dist/SmartMapManager.web.js +0 -33
- package/dist/SmartMapView.d.ts +0 -3
- package/dist/SmartMapView.js +0 -294
- package/dist/SmartMapView.web.d.ts +0 -3
- package/dist/SmartMapView.web.js +0 -270
- package/dist/SmartMapViewProps.d.ts +0 -267
- package/dist/SmartMapViewProps.js +0 -76
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -5
- package/dist/internalUtils.d.ts +0 -1
- package/dist/internalUtils.js +0 -5
- package/ios/RCTConvert+SmartMapView.h +0 -35
- package/ios/RCTConvert+SmartMapView.m +0 -295
- package/ios/RNSmartGeofenceManager.h +0 -24
- package/ios/RNSmartGeofenceManager.m +0 -110
- package/ios/RNSmartMapUserTaskEventManager.h +0 -19
- package/ios/RNSmartMapUserTaskEventManager.m +0 -46
- package/ios/RNSmartMapView.h +0 -37
- package/ios/RNSmartMapView.m +0 -21
- package/ios/RNSmartMapViewManager.h +0 -27
- package/ios/RNSmartMapViewManager.m +0 -608
- package/package-lock.json +0 -6570
- package/src/SmartGeofenceManager.ts +0 -94
- package/src/SmartGeofenceManager.web.ts +0 -11
- package/src/SmartMapEventManager.web.ts +0 -13
- package/src/SmartMapView.tsx +0 -377
- package/src/SmartMapView.web.tsx +0 -342
- package/src/SmartMapViewProps.ts +0 -338
- package/src/internalUtils.ts +0 -5
- package/src/typings/steerpath-smart-sdk.d.ts +0 -5
package/dist/SmartMapView.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
2
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
3
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
4
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
5
|
-
r[k] = a[j];
|
|
6
|
-
return r;
|
|
7
|
-
};
|
|
8
|
-
/* eslint-disable no-redeclare */
|
|
9
|
-
/* eslint-disable prefer-destructuring */
|
|
10
|
-
import React, { useImperativeHandle, forwardRef, useRef } from "react";
|
|
11
|
-
import { requireNativeComponent, NativeModules, findNodeHandle, Platform, View, PixelRatio, } from "react-native";
|
|
12
|
-
import { convertNativePixelToDp } from "./internalUtils";
|
|
13
|
-
var NATIVE_VIEW_NAME = "RNSmartMapView";
|
|
14
|
-
function runCommand(handler, name, args) {
|
|
15
|
-
var _a;
|
|
16
|
-
if (Platform.OS === "ios") {
|
|
17
|
-
return (_a = NativeModules[NATIVE_VIEW_NAME])[name].apply(_a, __spreadArrays([findNodeHandle(handler)], args));
|
|
18
|
-
}
|
|
19
|
-
return NativeModules.UIManager.dispatchViewManagerCommand(findNodeHandle(handler), NativeModules.UIManager.getViewManagerConfig(NATIVE_VIEW_NAME).Commands[name], args);
|
|
20
|
-
}
|
|
21
|
-
export var SmartMapView = forwardRef(function _SmartMapViewFC(props, ref) {
|
|
22
|
-
var smartMapRef = useRef(null);
|
|
23
|
-
useImperativeHandle(ref, function () { return ({
|
|
24
|
-
setMapMode: function (mapMode) {
|
|
25
|
-
runCommand(smartMapRef.current, "setMapMode", [mapMode]);
|
|
26
|
-
},
|
|
27
|
-
addMarker: function (smartMapObj, layout, iconName, textColor, textHaloColor) {
|
|
28
|
-
runCommand(smartMapRef.current, "addMarker", [
|
|
29
|
-
smartMapObj,
|
|
30
|
-
layout,
|
|
31
|
-
iconName || "category_marker",
|
|
32
|
-
textColor,
|
|
33
|
-
textHaloColor,
|
|
34
|
-
]);
|
|
35
|
-
},
|
|
36
|
-
addMarkers: function (mapObjectsArray, layout, iconName, textColor, textHaloColor) {
|
|
37
|
-
runCommand(smartMapRef.current, "addMarkers", [
|
|
38
|
-
mapObjectsArray,
|
|
39
|
-
layout,
|
|
40
|
-
iconName || "category_marker",
|
|
41
|
-
textColor,
|
|
42
|
-
textHaloColor,
|
|
43
|
-
]);
|
|
44
|
-
},
|
|
45
|
-
animateCamera: function (_a) {
|
|
46
|
-
var latitude = _a.latitude, longitude = _a.longitude, zoomLevel = _a.zoomLevel, bearing = _a.bearing, pitch = _a.pitch, floorIndex = _a.floorIndex, buildingRef = _a.buildingRef;
|
|
47
|
-
runCommand(smartMapRef.current, "animateCamera", [
|
|
48
|
-
latitude,
|
|
49
|
-
longitude,
|
|
50
|
-
zoomLevel,
|
|
51
|
-
bearing !== null && bearing !== void 0 ? bearing : 0,
|
|
52
|
-
pitch !== null && pitch !== void 0 ? pitch : 0,
|
|
53
|
-
floorIndex !== null && floorIndex !== void 0 ? floorIndex : 0,
|
|
54
|
-
buildingRef,
|
|
55
|
-
]);
|
|
56
|
-
},
|
|
57
|
-
animateCameraToBuildingRef: function (buildingRef, callback) {
|
|
58
|
-
if (Platform.OS == "android") {
|
|
59
|
-
NativeModules.RNSmartMapModule.animateCameraToBuildingRef(findNodeHandle(smartMapRef.current), [buildingRef], callback);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
runCommand(smartMapRef.current, "animateCameraToBuildingRef", [
|
|
63
|
-
buildingRef,
|
|
64
|
-
callback,
|
|
65
|
-
]);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
animateCameraToObject: function (localRef, buildingRef, zoomLevel, callback) {
|
|
69
|
-
if (Platform.OS == "android") {
|
|
70
|
-
NativeModules.RNSmartMapModule.animateCameraToObject(findNodeHandle(smartMapRef.current), [localRef, buildingRef, zoomLevel], callback);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
runCommand(smartMapRef.current, "animateCameraToObject", [
|
|
74
|
-
localRef,
|
|
75
|
-
buildingRef,
|
|
76
|
-
zoomLevel,
|
|
77
|
-
callback,
|
|
78
|
-
]);
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
cancelCurrentUserTask: function () {
|
|
82
|
-
runCommand(smartMapRef.current, "cancelCurrentUserTask", []);
|
|
83
|
-
},
|
|
84
|
-
getCurrentUserTask: function (callback) {
|
|
85
|
-
if (Platform.OS == "android") {
|
|
86
|
-
NativeModules.RNSmartMapModule.getCurrentUserTask(findNodeHandle(smartMapRef.current), callback);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
runCommand(smartMapRef.current, "getCurrentUserTask", [callback]);
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
getMapObject: function (localRef, buildingRef, source, callback) {
|
|
93
|
-
if (Platform.OS == "android") {
|
|
94
|
-
NativeModules.RNSmartMapModule.getMapObject(findNodeHandle(smartMapRef.current), [localRef, buildingRef, source], callback);
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
runCommand(smartMapRef.current, "getMapObject", [
|
|
98
|
-
localRef,
|
|
99
|
-
buildingRef,
|
|
100
|
-
source,
|
|
101
|
-
callback,
|
|
102
|
-
]);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
getMapObjectByProperties: function (properties, callback) {
|
|
106
|
-
if (Platform.OS == "android") {
|
|
107
|
-
NativeModules.RNSmartMapModule.getMapObjectByProperties(findNodeHandle(smartMapRef.current), properties, callback);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
runCommand(smartMapRef.current, "getMapObjectByProperties", [
|
|
111
|
-
properties,
|
|
112
|
-
callback,
|
|
113
|
-
]);
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
removeAllMarkers: function () {
|
|
117
|
-
runCommand(smartMapRef.current, "removeAllMarkers", []);
|
|
118
|
-
},
|
|
119
|
-
removeMarker: function (smartMapObj) {
|
|
120
|
-
runCommand(smartMapRef.current, "removeMarker", [smartMapObj]);
|
|
121
|
-
},
|
|
122
|
-
removeMarkers: function (mapObjectsArray) {
|
|
123
|
-
runCommand(smartMapRef.current, "removeMarkers", [mapObjectsArray]);
|
|
124
|
-
},
|
|
125
|
-
selectMapObject: function (smartMapObj) {
|
|
126
|
-
runCommand(smartMapRef.current, "selectMapObject", [smartMapObj]);
|
|
127
|
-
},
|
|
128
|
-
setCamera: function (_a) {
|
|
129
|
-
var latitude = _a.latitude, longitude = _a.longitude, zoomLevel = _a.zoomLevel, bearing = _a.bearing, pitch = _a.pitch, floorIndex = _a.floorIndex, buildingRef = _a.buildingRef;
|
|
130
|
-
runCommand(smartMapRef.current, "setCamera", [
|
|
131
|
-
latitude,
|
|
132
|
-
longitude,
|
|
133
|
-
zoomLevel,
|
|
134
|
-
bearing !== null && bearing !== void 0 ? bearing : 0,
|
|
135
|
-
pitch !== null && pitch !== void 0 ? pitch : 0,
|
|
136
|
-
floorIndex !== null && floorIndex !== void 0 ? floorIndex : 0,
|
|
137
|
-
buildingRef,
|
|
138
|
-
]);
|
|
139
|
-
},
|
|
140
|
-
setCameraToBuildingRef: function (buildingRef, callback) {
|
|
141
|
-
if (Platform.OS == "android") {
|
|
142
|
-
NativeModules.RNSmartMapModule.setCameraToBuildingRef(findNodeHandle(smartMapRef.current), [buildingRef], callback);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
runCommand(smartMapRef.current, "setCameraToBuildingRef", [
|
|
146
|
-
buildingRef,
|
|
147
|
-
callback,
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
setCameraToObject: function (localRef, buildingRef, zoomLevel, callback) {
|
|
152
|
-
if (Platform.OS == "android") {
|
|
153
|
-
NativeModules.RNSmartMapModule.setCameraToObject(findNodeHandle(smartMapRef.current), [localRef, buildingRef, zoomLevel], callback);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
runCommand(smartMapRef.current, "setCameraToObject", [
|
|
157
|
-
localRef,
|
|
158
|
-
buildingRef,
|
|
159
|
-
zoomLevel,
|
|
160
|
-
callback,
|
|
161
|
-
]);
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
startUserTask: function (userTask) {
|
|
165
|
-
runCommand(smartMapRef.current, "startUserTask", [userTask]);
|
|
166
|
-
},
|
|
167
|
-
start: function () {
|
|
168
|
-
if (Platform.OS === "android") {
|
|
169
|
-
runCommand(smartMapRef.current, "start", []);
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
stop: function () {
|
|
173
|
-
if (Platform.OS === "android") {
|
|
174
|
-
runCommand(smartMapRef.current, "stop", []);
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
onBackPressed: function (callback) {
|
|
178
|
-
if (Platform.OS === "android") {
|
|
179
|
-
NativeModules.RNSmartMapModule.onBackPressed(findNodeHandle(smartMapRef.current), callback);
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
getWidgetPadding: function (callback) {
|
|
183
|
-
function processedCallback(padding) {
|
|
184
|
-
callback({
|
|
185
|
-
left: Platform.OS === "android"
|
|
186
|
-
? convertNativePixelToDp(padding.left)
|
|
187
|
-
: padding.left,
|
|
188
|
-
top: Platform.OS === "android"
|
|
189
|
-
? convertNativePixelToDp(padding.top)
|
|
190
|
-
: padding.top,
|
|
191
|
-
right: Platform.OS === "android"
|
|
192
|
-
? convertNativePixelToDp(padding.right)
|
|
193
|
-
: padding.right,
|
|
194
|
-
bottom: Platform.OS === "android"
|
|
195
|
-
? convertNativePixelToDp(padding.bottom)
|
|
196
|
-
: padding.bottom,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
if (Platform.OS == "android") {
|
|
200
|
-
NativeModules.RNSmartMapModule.getWidgetPadding(findNodeHandle(smartMapRef.current), processedCallback);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
runCommand(smartMapRef.current, "getWidgetPadding", [
|
|
204
|
-
processedCallback,
|
|
205
|
-
]);
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
setWidgetPadding: function (left, top, right, bottom) {
|
|
209
|
-
runCommand(smartMapRef.current, "setWidgetPadding", Platform.OS === "android"
|
|
210
|
-
? [
|
|
211
|
-
PixelRatio.getPixelSizeForLayoutSize(left || 0),
|
|
212
|
-
PixelRatio.getPixelSizeForLayoutSize(top || 0),
|
|
213
|
-
PixelRatio.getPixelSizeForLayoutSize(right || 0),
|
|
214
|
-
PixelRatio.getPixelSizeForLayoutSize(bottom || 0),
|
|
215
|
-
]
|
|
216
|
-
: [left || 0, top || 0, right || 0, bottom || 0]);
|
|
217
|
-
},
|
|
218
|
-
setGeoJson: function (sourceId, geoJson, callback) {
|
|
219
|
-
if (Platform.OS === "android") {
|
|
220
|
-
NativeModules.RNSmartMapModule.setGeoJson(findNodeHandle(smartMapRef.current), [sourceId, geoJson], callback);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
runCommand(smartMapRef.current, "setGeoJson", [
|
|
224
|
-
sourceId,
|
|
225
|
-
geoJson,
|
|
226
|
-
callback,
|
|
227
|
-
]);
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
getSmartMapCameraOptions: function (callback) {
|
|
231
|
-
if (Platform.OS === 'android') {
|
|
232
|
-
NativeModules.RNSmartMapModule.getSmartMapCameraOptions(findNodeHandle(smartMapRef.current), callback);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
runCommand(smartMapRef.current, "getSmartMapCameraOptions", [callback]);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}); });
|
|
239
|
-
return (React.createElement(View, { style: props.style },
|
|
240
|
-
React.createElement(RNSmartMapView, { ref: smartMapRef, style: { flex: 1 }, onMapLoaded: function () {
|
|
241
|
-
var _a;
|
|
242
|
-
(_a = props.onMapLoaded) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
243
|
-
}, onUserFloorChanged: function (event) {
|
|
244
|
-
var _a;
|
|
245
|
-
(_a = props.onUserFloorChanged) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
246
|
-
}, onViewStatusChanged: function (event) {
|
|
247
|
-
var _a;
|
|
248
|
-
(_a = props.onViewStatusChanged) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
249
|
-
}, onNavigationFailed: function (event) {
|
|
250
|
-
var _a;
|
|
251
|
-
(_a = props.onNavigationFailed) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
252
|
-
}, onNavigationEnded: function () {
|
|
253
|
-
var _a;
|
|
254
|
-
(_a = props.onNavigationEnded) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
255
|
-
}, onNavigationStarted: function () {
|
|
256
|
-
var _a;
|
|
257
|
-
(_a = props.onNavigationStarted) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
258
|
-
}, onNavigationPreviewAppeared: function () {
|
|
259
|
-
var _a;
|
|
260
|
-
(_a = props.onNavigationPreviewAppeared) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
261
|
-
}, onNavigationDestinationReached: function () {
|
|
262
|
-
var _a;
|
|
263
|
-
(_a = props.onNavigationDestinationReached) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
264
|
-
}, onVisibleFloorChanged: function (event) {
|
|
265
|
-
var _a;
|
|
266
|
-
(_a = props.onVisibleFloorChanged) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
267
|
-
}, onMapClicked: function (event) {
|
|
268
|
-
var _a, _b;
|
|
269
|
-
if (Platform.OS === "ios") {
|
|
270
|
-
// iOS Mapbox SDK return a reversed order of map object compared to web and android sdk, so we reverse to match the behavior
|
|
271
|
-
(_a = props.onMapClicked) === null || _a === void 0 ? void 0 : _a.call(props, {
|
|
272
|
-
mapObjects: __spreadArrays(event.nativeEvent.mapObjects).reverse(),
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
(_b = props.onMapClicked) === null || _b === void 0 ? void 0 : _b.call(props, event.nativeEvent);
|
|
277
|
-
}
|
|
278
|
-
}, onUserTaskResponse: function (event) {
|
|
279
|
-
var _a;
|
|
280
|
-
(_a = props.onUserTaskResponse) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
281
|
-
}, onSearchResultSelected: function (event) {
|
|
282
|
-
var _a;
|
|
283
|
-
(_a = props.onSearchResultSelected) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
284
|
-
}, onBottomSheetStateChanged: function (event) {
|
|
285
|
-
var _a;
|
|
286
|
-
(_a = props.onBottomSheetStateChanged) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
287
|
-
}, onSearchCategorySelected: function (event) {
|
|
288
|
-
var _a;
|
|
289
|
-
(_a = props.onSearchCategorySelected) === null || _a === void 0 ? void 0 : _a.call(props, event.nativeEvent);
|
|
290
|
-
} })));
|
|
291
|
-
});
|
|
292
|
-
// It's tedious to type native props, so we can defer it later
|
|
293
|
-
// Hacky escape from requireNativeComponent as it is quite outdated
|
|
294
|
-
var RNSmartMapView = requireNativeComponent(NATIVE_VIEW_NAME);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SmartMapViewProps, SmartMapViewMethods } from "./SmartMapViewProps";
|
|
3
|
-
export declare const SmartMapView: React.ForwardRefExoticComponent<Pick<SmartMapViewProps, "onMapLoaded" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "apiKey" | "onBottomSheetStateChanged" | "onMapClicked" | "onNavigationDestinationReached" | "onNavigationEnded" | "onNavigationFailed" | "onNavigationPreviewAppeared" | "onNavigationStarted" | "onSearchCategorySelected" | "onSearchResultSelected" | "onUserFloorChanged" | "onUserTaskResponse" | "onViewStatusChanged" | "onVisibleFloorChanged"> & React.RefAttributes<SmartMapViewMethods>>;
|
package/dist/SmartMapView.web.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/destructuring-assignment */
|
|
2
|
-
import React, { useEffect, useImperativeHandle, useRef, forwardRef, } from "react";
|
|
3
|
-
import { PixelRatio } from "react-native";
|
|
4
|
-
import { steerpath } from "steerpath-smart-sdk";
|
|
5
|
-
//no longer needed as the steerpath is imported from node modules
|
|
6
|
-
//instead of the window namespace
|
|
7
|
-
//declare let window: any;
|
|
8
|
-
var COMPONENT_ID_PREFIX = "map_container_id";
|
|
9
|
-
function runCommand(handler, name, args) {
|
|
10
|
-
handler === null || handler === void 0 ? void 0 : handler[name].apply(handler, args);
|
|
11
|
-
}
|
|
12
|
-
function convertToWebSDKSmartMapObj(smartMapObj) {
|
|
13
|
-
return new steerpath.SmartMapObject(smartMapObj.latitude, smartMapObj.longitude, smartMapObj.floorIndex, smartMapObj.buildingRef, smartMapObj.localRef, smartMapObj.title, smartMapObj.properties);
|
|
14
|
-
}
|
|
15
|
-
function convertToWebUserTaskObj(userTask) {
|
|
16
|
-
var addMarker = userTask.payload
|
|
17
|
-
.shouldAddMarker;
|
|
18
|
-
var actionButtonText = userTask.payload
|
|
19
|
-
.actionButtonText;
|
|
20
|
-
var actionButtonIcon = userTask.payload
|
|
21
|
-
.actionButtonIcon;
|
|
22
|
-
var smartMapObject = userTask.payload
|
|
23
|
-
.smartMapObject;
|
|
24
|
-
return new steerpath.POISelectionUserTask(smartMapObject, addMarker, actionButtonText, actionButtonIcon);
|
|
25
|
-
}
|
|
26
|
-
function parseJwtToken(token) {
|
|
27
|
-
try {
|
|
28
|
-
var base64Url = token.split(".")[1];
|
|
29
|
-
var base64 = base64Url.replace("-", "+").replace("_", "/");
|
|
30
|
-
return JSON.parse(window.atob(base64));
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export var SmartMapView = forwardRef(function (props, ref) {
|
|
39
|
-
var smartMapRef = useRef(null);
|
|
40
|
-
useEffect(function () {
|
|
41
|
-
var smartSDK = {};
|
|
42
|
-
if (parseJwtToken(props.apiKey).hasOwnProperty("client_token")) {
|
|
43
|
-
smartSDK = steerpath.sdk[parseJwtToken(props.apiKey).client_token];
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
if (props.apiKey) {
|
|
47
|
-
smartSDK = steerpath.sdk[props.apiKey];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Allow setting the ref
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
smartMapRef.current = new steerpath.SmartMapView(COMPONENT_ID_PREFIX, smartSDK);
|
|
53
|
-
var events = [
|
|
54
|
-
{
|
|
55
|
-
sdk: "onMapClick",
|
|
56
|
-
binding: "onMapClicked",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
sdk: "onSearchResultSelected",
|
|
60
|
-
binding: "onSearchResultSelected",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
sdk: "steerpathLayerIndexChanged",
|
|
64
|
-
binding: "onVisibleFloorChanged",
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
sdk: "steerpathMapLoaded",
|
|
68
|
-
binding: "onMapLoaded",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
sdk: "onSearchCategorySelected",
|
|
72
|
-
binding: "onSearchCategorySelected",
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
//add map event listeners ("on")
|
|
76
|
-
events.forEach(function (event) {
|
|
77
|
-
if (props[event.binding]) {
|
|
78
|
-
steerpath.MapEventListener.on(event.sdk, props[event.binding]);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
//also add user task listener
|
|
82
|
-
steerpath.UserTaskListener.on("onUserTaskResponse", props.onUserTaskResponse);
|
|
83
|
-
return function () {
|
|
84
|
-
var _a;
|
|
85
|
-
//remove map event listeners ("off")
|
|
86
|
-
events.forEach(function (event) {
|
|
87
|
-
if (props[event.binding]) {
|
|
88
|
-
steerpath.MapEventListener.off(event.sdk, props[event.binding]);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
//also remove user task listener
|
|
92
|
-
steerpath.UserTaskListener.off("onUserTaskResponse", props.onUserTaskResponse);
|
|
93
|
-
//When screen size changes and this component unmounted
|
|
94
|
-
//remove the old instance of smartMapRef.current
|
|
95
|
-
if (smartMapRef.current) {
|
|
96
|
-
(_a = smartMapRef.current) === null || _a === void 0 ? void 0 : _a.removeMap();
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}, [props.apiKey]);
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
101
|
-
useImperativeHandle(ref, function () { return ({
|
|
102
|
-
setCamera: function (_a) {
|
|
103
|
-
var latitude = _a.latitude, longitude = _a.longitude, zoomLevel = _a.zoomLevel, bearing = _a.bearing, pitch = _a.pitch, floorIndex = _a.floorIndex, buildingRef = _a.buildingRef;
|
|
104
|
-
runCommand(smartMapRef.current, "setCamera", [
|
|
105
|
-
latitude,
|
|
106
|
-
longitude,
|
|
107
|
-
zoomLevel,
|
|
108
|
-
bearing,
|
|
109
|
-
pitch,
|
|
110
|
-
floorIndex,
|
|
111
|
-
buildingRef,
|
|
112
|
-
]);
|
|
113
|
-
},
|
|
114
|
-
setCameraToBuildingRef: function (buildingRef, callback) {
|
|
115
|
-
runCommand(smartMapRef.current, "setCameraToBuilding", [
|
|
116
|
-
buildingRef,
|
|
117
|
-
18,
|
|
118
|
-
callback,
|
|
119
|
-
]);
|
|
120
|
-
},
|
|
121
|
-
setCameraToObject: function (localRef, buildingRef, zoomLevel, callback) {
|
|
122
|
-
runCommand(smartMapRef.current, "setCameraToObject", [
|
|
123
|
-
localRef,
|
|
124
|
-
buildingRef,
|
|
125
|
-
zoomLevel,
|
|
126
|
-
callback,
|
|
127
|
-
]);
|
|
128
|
-
},
|
|
129
|
-
addMarker: function (smartMapObj, layout, iconName, textColor, textHaloColor) {
|
|
130
|
-
runCommand(smartMapRef.current, "addMarker", [
|
|
131
|
-
convertToWebSDKSmartMapObj(smartMapObj),
|
|
132
|
-
layout,
|
|
133
|
-
iconName || "category_marker",
|
|
134
|
-
textColor,
|
|
135
|
-
textHaloColor,
|
|
136
|
-
]);
|
|
137
|
-
},
|
|
138
|
-
addMarkers: function (mapObjectsArray, layout, iconName, textColor, textHaloColor) {
|
|
139
|
-
mapObjectsArray = mapObjectsArray.map(function (smartMapObject) {
|
|
140
|
-
return convertToWebSDKSmartMapObj(smartMapObject);
|
|
141
|
-
});
|
|
142
|
-
runCommand(smartMapRef.current, "addMarkers", [
|
|
143
|
-
mapObjectsArray,
|
|
144
|
-
layout,
|
|
145
|
-
iconName || "category_marker",
|
|
146
|
-
textColor,
|
|
147
|
-
textHaloColor,
|
|
148
|
-
]);
|
|
149
|
-
},
|
|
150
|
-
removeMarker: function (smartMapObj) {
|
|
151
|
-
runCommand(smartMapRef.current, "removeMarker", [
|
|
152
|
-
convertToWebSDKSmartMapObj(smartMapObj),
|
|
153
|
-
]);
|
|
154
|
-
},
|
|
155
|
-
removeMarkers: function (mapObjectsArray) {
|
|
156
|
-
mapObjectsArray = mapObjectsArray.map(function (smartMapObject) {
|
|
157
|
-
return convertToWebSDKSmartMapObj(smartMapObject);
|
|
158
|
-
});
|
|
159
|
-
runCommand(smartMapRef.current, "removeMarkers", [mapObjectsArray]);
|
|
160
|
-
},
|
|
161
|
-
removeAllMarkers: function () {
|
|
162
|
-
runCommand(smartMapRef.current, "removeAllMarkers", []);
|
|
163
|
-
},
|
|
164
|
-
animateCamera: function (_a) {
|
|
165
|
-
var latitude = _a.latitude, longitude = _a.longitude, zoomLevel = _a.zoomLevel, bearing = _a.bearing, pitch = _a.pitch, floorIndex = _a.floorIndex, buildingRef = _a.buildingRef;
|
|
166
|
-
runCommand(smartMapRef.current, "animateCamera", [
|
|
167
|
-
latitude,
|
|
168
|
-
longitude,
|
|
169
|
-
zoomLevel,
|
|
170
|
-
bearing,
|
|
171
|
-
pitch,
|
|
172
|
-
floorIndex,
|
|
173
|
-
buildingRef,
|
|
174
|
-
]);
|
|
175
|
-
},
|
|
176
|
-
animateCameraToBuildingRef: function (buildingRef, callback) {
|
|
177
|
-
runCommand(smartMapRef.current, "animateCameraToBuilding", [
|
|
178
|
-
buildingRef,
|
|
179
|
-
18,
|
|
180
|
-
callback,
|
|
181
|
-
]);
|
|
182
|
-
},
|
|
183
|
-
animateCameraToObject: function (localRef, buildingRef, zoomLevel, callback) {
|
|
184
|
-
runCommand(smartMapRef.current, "animateCameraToObject", [
|
|
185
|
-
localRef,
|
|
186
|
-
buildingRef,
|
|
187
|
-
zoomLevel,
|
|
188
|
-
callback,
|
|
189
|
-
]);
|
|
190
|
-
},
|
|
191
|
-
setMapMode: function (mapMode) {
|
|
192
|
-
runCommand(smartMapRef.current, "setMapMode", [mapMode]);
|
|
193
|
-
},
|
|
194
|
-
startUserTask: function (userTask) {
|
|
195
|
-
// TODO: roope fixes
|
|
196
|
-
runCommand(smartMapRef.current, "startUserTask", [
|
|
197
|
-
convertToWebUserTaskObj(userTask),
|
|
198
|
-
]);
|
|
199
|
-
},
|
|
200
|
-
getCurrentUserTask: function () {
|
|
201
|
-
//TODO: does not return current task
|
|
202
|
-
return runCommand(smartMapRef.current, "getCurrentUserTask", []);
|
|
203
|
-
},
|
|
204
|
-
cancelCurrentUserTask: function () {
|
|
205
|
-
runCommand(smartMapRef.current, "cancelCurrentUserTask", []);
|
|
206
|
-
},
|
|
207
|
-
selectMapObject: function (smartMapObj) {
|
|
208
|
-
var localRef = smartMapObj.localRef;
|
|
209
|
-
var buildingRef = smartMapObj.buildingRef;
|
|
210
|
-
runCommand(smartMapRef.current, "selectMapObject", [
|
|
211
|
-
localRef,
|
|
212
|
-
buildingRef,
|
|
213
|
-
]);
|
|
214
|
-
},
|
|
215
|
-
getMapObject: function (localRef, buildingRef, source, callback) {
|
|
216
|
-
runCommand(smartMapRef.current, "getMapObject", [
|
|
217
|
-
localRef,
|
|
218
|
-
buildingRef,
|
|
219
|
-
source,
|
|
220
|
-
callback,
|
|
221
|
-
]);
|
|
222
|
-
},
|
|
223
|
-
getMapObjectByProperties: function (properties, callback) {
|
|
224
|
-
runCommand(smartMapRef.current, "getMapObjectByProperties", [
|
|
225
|
-
properties,
|
|
226
|
-
callback,
|
|
227
|
-
]);
|
|
228
|
-
},
|
|
229
|
-
onBackPressed: function () {
|
|
230
|
-
// Web doesn't have this implementation
|
|
231
|
-
},
|
|
232
|
-
start: function () {
|
|
233
|
-
// No web implementation
|
|
234
|
-
},
|
|
235
|
-
stop: function () {
|
|
236
|
-
// No web implementation
|
|
237
|
-
},
|
|
238
|
-
getWidgetPadding: function () {
|
|
239
|
-
// TODO: add correct callback to getWidgetPadding on web
|
|
240
|
-
return runCommand(smartMapRef.current, "getWidgetPadding", []);
|
|
241
|
-
},
|
|
242
|
-
resetWidgetPadding: function () {
|
|
243
|
-
runCommand(smartMapRef.current, "resetWidgetPadding", []);
|
|
244
|
-
},
|
|
245
|
-
setWidgetPadding: function (left, top, right, bottom) {
|
|
246
|
-
runCommand(smartMapRef.current, "setWidgetPadding", [
|
|
247
|
-
PixelRatio.getPixelSizeForLayoutSize(left || 0),
|
|
248
|
-
PixelRatio.getPixelSizeForLayoutSize(top || 0),
|
|
249
|
-
PixelRatio.getPixelSizeForLayoutSize(right || 0),
|
|
250
|
-
PixelRatio.getPixelSizeForLayoutSize(bottom || 0),
|
|
251
|
-
]);
|
|
252
|
-
},
|
|
253
|
-
setGeoJson: function (sourceId, geoJson, callback) {
|
|
254
|
-
runCommand(smartMapRef.current, "setGeoJson", [
|
|
255
|
-
sourceId,
|
|
256
|
-
geoJson,
|
|
257
|
-
callback,
|
|
258
|
-
]);
|
|
259
|
-
},
|
|
260
|
-
getSmartMapCameraOptions: function (callback) {
|
|
261
|
-
var smartMapCameraOptions = smartMapRef.current ? smartMapRef.current.getSmartMapCameraOptions() : null;
|
|
262
|
-
if (smartMapCameraOptions)
|
|
263
|
-
callback(smartMapCameraOptions);
|
|
264
|
-
},
|
|
265
|
-
stopLive: function () {
|
|
266
|
-
runCommand(smartMapRef.current, "stopLive", []);
|
|
267
|
-
},
|
|
268
|
-
}); });
|
|
269
|
-
return React.createElement("div", { id: COMPONENT_ID_PREFIX, style: { flex: 1, height: "100%" } });
|
|
270
|
-
});
|