react-native-maps 1.21.0-alpha.73 → 1.21.0-alpha.75
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/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +6 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +2 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +9 -9
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +2 -2
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +1 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +11 -1
- package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/maps/MapView.java +87 -64
- package/ios/AirGoogleMaps/AIRGoogleMap.m +2 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +44 -0
- package/ios/AirMaps/RNMapsMapView.mm +5 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +9 -9
- package/ios/generated/RNMapsSpecs/EventEmitters.h +2 -2
- package/ios/generated/RNMapsSpecs/Props.cpp +1 -0
- package/ios/generated/RNMapsSpecs/Props.h +1 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +42 -0
- package/lib/MapView.d.ts +6 -4
- package/lib/MapView.js +16 -2
- package/lib/MapView.types.d.ts +1 -1
- package/lib/createFabricMap.d.ts +1 -0
- package/lib/createFabricMap.js +14 -1
- package/lib/specs/NativeComponentGoogleMapView.d.ts +3 -3
- package/lib/specs/NativeComponentGoogleMapView.js +1 -0
- package/lib/specs/NativeComponentMapView.d.ts +9 -0
- package/lib/specs/NativeComponentMapView.js +1 -0
- package/package.json +1 -1
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java
CHANGED
|
@@ -163,6 +163,9 @@ public class RNMapsMapViewManagerDelegate<T extends View, U extends BaseViewMana
|
|
|
163
163
|
case "zoomEnabled":
|
|
164
164
|
mViewManager.setZoomEnabled(view, value == null ? true : (boolean) value);
|
|
165
165
|
break;
|
|
166
|
+
case "showsTraffic":
|
|
167
|
+
mViewManager.setShowsTraffic(view, value == null ? false : (boolean) value);
|
|
168
|
+
break;
|
|
166
169
|
case "zoomTapEnabled":
|
|
167
170
|
mViewManager.setZoomTapEnabled(view, value == null ? true : (boolean) value);
|
|
168
171
|
break;
|
|
@@ -195,6 +198,9 @@ public class RNMapsMapViewManagerDelegate<T extends View, U extends BaseViewMana
|
|
|
195
198
|
case "fitToCoordinates":
|
|
196
199
|
mViewManager.fitToCoordinates(view, args.getString(0), args.getString(1), args.getBoolean(2));
|
|
197
200
|
break;
|
|
201
|
+
case "setIndoorActiveLevelIndex":
|
|
202
|
+
mViewManager.setIndoorActiveLevelIndex(view, args.getInt(0));
|
|
203
|
+
break;
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
}
|
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java
CHANGED
|
@@ -60,6 +60,7 @@ public interface RNMapsMapViewManagerInterface<T extends View> {
|
|
|
60
60
|
void setUserLocationUpdateInterval(T view, int value);
|
|
61
61
|
void setZoomControlEnabled(T view, boolean value);
|
|
62
62
|
void setZoomEnabled(T view, boolean value);
|
|
63
|
+
void setShowsTraffic(T view, boolean value);
|
|
63
64
|
void setZoomTapEnabled(T view, boolean value);
|
|
64
65
|
void setCameraZoomRange(T view, @Nullable ReadableMap value);
|
|
65
66
|
void animateToRegion(T view, String regionJSON, int duration);
|
|
@@ -68,4 +69,5 @@ public interface RNMapsMapViewManagerInterface<T extends View> {
|
|
|
68
69
|
void fitToElements(T view, String edgePaddingJSON, boolean animated);
|
|
69
70
|
void fitToSuppliedMarkers(T view, String markersJSON, String edgePaddingJSON, boolean animated);
|
|
70
71
|
void fitToCoordinates(T view, String coordinatesJSON, String edgePaddingJSON, boolean animated);
|
|
72
|
+
void setIndoorActiveLevelIndex(T view, int activeLevelIndex);
|
|
71
73
|
}
|
|
@@ -39,10 +39,10 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFo
|
|
|
39
39
|
dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
40
40
|
auto $payload = jsi::Object(runtime);
|
|
41
41
|
{
|
|
42
|
-
auto
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$payload.setProperty(runtime, "
|
|
42
|
+
auto indoorBuilding = jsi::Object(runtime);
|
|
43
|
+
indoorBuilding.setProperty(runtime, "underground", $event.indoorBuilding.underground);
|
|
44
|
+
indoorBuilding.setProperty(runtime, "activeLevelIndex", $event.indoorBuilding.activeLevelIndex);
|
|
45
|
+
$payload.setProperty(runtime, "indoorBuilding", indoorBuilding);
|
|
46
46
|
}
|
|
47
47
|
return $payload;
|
|
48
48
|
});
|
|
@@ -53,11 +53,11 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorLevelActivated(OnIndoorLevelActiva
|
|
|
53
53
|
dispatchEvent("indoorLevelActivated", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
54
54
|
auto $payload = jsi::Object(runtime);
|
|
55
55
|
{
|
|
56
|
-
auto
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$payload.setProperty(runtime, "
|
|
56
|
+
auto indoorLevel = jsi::Object(runtime);
|
|
57
|
+
indoorLevel.setProperty(runtime, "activeLevelIndex", $event.indoorLevel.activeLevelIndex);
|
|
58
|
+
indoorLevel.setProperty(runtime, "name", $event.indoorLevel.name);
|
|
59
|
+
indoorLevel.setProperty(runtime, "shortName", $event.indoorLevel.shortName);
|
|
60
|
+
$payload.setProperty(runtime, "indoorLevel", indoorLevel);
|
|
61
61
|
}
|
|
62
62
|
return $payload;
|
|
63
63
|
});
|
|
@@ -45,7 +45,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
struct OnIndoorBuildingFocused {
|
|
48
|
-
OnIndoorBuildingFocusedIndoorBuilding
|
|
48
|
+
OnIndoorBuildingFocusedIndoorBuilding indoorBuilding;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
struct OnIndoorLevelActivatedIndoorLevel {
|
|
@@ -55,7 +55,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
struct OnIndoorLevelActivated {
|
|
58
|
-
OnIndoorLevelActivatedIndoorLevel
|
|
58
|
+
OnIndoorLevelActivatedIndoorLevel indoorLevel;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
struct OnKmlReady {
|
|
@@ -125,6 +125,7 @@ RNMapsMapViewProps::RNMapsMapViewProps(
|
|
|
125
125
|
userLocationUpdateInterval(convertRawProp(context, rawProps, "userLocationUpdateInterval", sourceProps.userLocationUpdateInterval, {5000})),
|
|
126
126
|
zoomControlEnabled(convertRawProp(context, rawProps, "zoomControlEnabled", sourceProps.zoomControlEnabled, {true})),
|
|
127
127
|
zoomEnabled(convertRawProp(context, rawProps, "zoomEnabled", sourceProps.zoomEnabled, {true})),
|
|
128
|
+
showsTraffic(convertRawProp(context, rawProps, "showsTraffic", sourceProps.showsTraffic, {false})),
|
|
128
129
|
zoomTapEnabled(convertRawProp(context, rawProps, "zoomTapEnabled", sourceProps.zoomTapEnabled, {true})),
|
|
129
130
|
cameraZoomRange(convertRawProp(context, rawProps, "cameraZoomRange", sourceProps.cameraZoomRange, {}))
|
|
130
131
|
{}
|
|
@@ -888,6 +888,7 @@ class RNMapsMapViewProps final : public ViewProps {
|
|
|
888
888
|
int userLocationUpdateInterval{5000};
|
|
889
889
|
bool zoomControlEnabled{true};
|
|
890
890
|
bool zoomEnabled{true};
|
|
891
|
+
bool showsTraffic{false};
|
|
891
892
|
bool zoomTapEnabled{true};
|
|
892
893
|
RNMapsMapViewCameraZoomRangeStruct cameraZoomRange{};
|
|
893
894
|
};
|
|
@@ -105,7 +105,7 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
105
105
|
options.maxZoomPreference(initialProps.getInt("maxZoom", 0));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
if (initialProps.hasKey("userInterfaceStyle")){
|
|
108
|
+
if (initialProps.hasKey("userInterfaceStyle") && !initialProps.hasKey("liteMode")){
|
|
109
109
|
String style = initialProps.getString("userInterfaceStyle");
|
|
110
110
|
if ("system".equals(style)) {
|
|
111
111
|
options.mapColorScheme(MapColorScheme.FOLLOW_SYSTEM);
|
|
@@ -480,6 +480,11 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
480
480
|
view.setZoomEnabled(value);
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
+
@Override
|
|
484
|
+
public void setShowsTraffic(MapView view, boolean value) {
|
|
485
|
+
view.setShowsTraffic(value);
|
|
486
|
+
}
|
|
487
|
+
|
|
483
488
|
@Override
|
|
484
489
|
public void setZoomTapEnabled(MapView view, boolean value) {
|
|
485
490
|
// not supported
|
|
@@ -585,6 +590,11 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
585
590
|
}
|
|
586
591
|
}
|
|
587
592
|
|
|
593
|
+
@Override
|
|
594
|
+
public void setIndoorActiveLevelIndex(MapView view, int activeLevelIndex) {
|
|
595
|
+
view.setIndoorActiveLevelIndex(activeLevelIndex);
|
|
596
|
+
}
|
|
597
|
+
|
|
588
598
|
@Override
|
|
589
599
|
public void onDropViewInstance(MapView view) {
|
|
590
600
|
super.onDropViewInstance(view);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
public class OnDoublePressEvent extends Event<OnDoublePressEvent> {
|
|
9
|
+
public static final String EVENT_NAME = "topDoublePress";
|
|
10
|
+
private final WritableMap payload;
|
|
11
|
+
|
|
12
|
+
public OnDoublePressEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
13
|
+
super(surfaceId, viewId);
|
|
14
|
+
this.payload = payload;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@NonNull
|
|
18
|
+
@Override
|
|
19
|
+
public String getEventName() {
|
|
20
|
+
return EVENT_NAME;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Override
|
|
24
|
+
public WritableMap getEventData() {
|
|
25
|
+
return payload;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
public class OnIndoorBuildingFocusedEvent extends Event<OnIndoorBuildingFocusedEvent> {
|
|
9
|
+
public static final String EVENT_NAME = "topIndoorBuildingFocused";
|
|
10
|
+
|
|
11
|
+
private final WritableMap payload;
|
|
12
|
+
|
|
13
|
+
public OnIndoorBuildingFocusedEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
14
|
+
super(surfaceId, viewId);
|
|
15
|
+
this.payload = payload;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@NonNull
|
|
19
|
+
@Override
|
|
20
|
+
public String getEventName() {
|
|
21
|
+
return EVENT_NAME;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public WritableMap getEventData() {
|
|
26
|
+
return payload;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
public class OnIndoorLevelActivatedEvent extends Event<OnIndoorLevelActivatedEvent> {
|
|
9
|
+
public static final String EVENT_NAME = "topIndoorLevelActivated";
|
|
10
|
+
|
|
11
|
+
private final WritableMap payload;
|
|
12
|
+
|
|
13
|
+
public OnIndoorLevelActivatedEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
14
|
+
super(surfaceId, viewId);
|
|
15
|
+
this.payload = payload;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@NonNull
|
|
19
|
+
@Override
|
|
20
|
+
public String getEventName() {
|
|
21
|
+
return EVENT_NAME;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public WritableMap getEventData() {
|
|
26
|
+
return payload;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -2,13 +2,16 @@ package com.rnmaps.maps;
|
|
|
2
2
|
|
|
3
3
|
import static androidx.core.content.PermissionChecker.checkSelfPermission;
|
|
4
4
|
|
|
5
|
+
import android.app.Activity;
|
|
5
6
|
import android.content.Context;
|
|
6
7
|
import android.content.res.ColorStateList;
|
|
7
8
|
import android.graphics.Bitmap;
|
|
8
9
|
import android.graphics.Color;
|
|
9
10
|
import android.graphics.Point;
|
|
10
11
|
import android.location.Location;
|
|
11
|
-
import
|
|
12
|
+
import androidx.lifecycle.DefaultLifecycleObserver;
|
|
13
|
+
import androidx.lifecycle.LifecycleOwner;
|
|
14
|
+
|
|
12
15
|
import android.view.GestureDetector;
|
|
13
16
|
import android.view.MotionEvent;
|
|
14
17
|
import android.view.View;
|
|
@@ -26,7 +29,6 @@ import androidx.core.view.MotionEventCompat;
|
|
|
26
29
|
import com.facebook.react.common.MapBuilder;
|
|
27
30
|
|
|
28
31
|
import com.facebook.react.bridge.Arguments;
|
|
29
|
-
import com.facebook.react.bridge.LifecycleEventListener;
|
|
30
32
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
31
33
|
import com.facebook.react.bridge.ReactContext;
|
|
32
34
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -84,7 +86,7 @@ import java.util.concurrent.ExecutionException;
|
|
|
84
86
|
import com.rnmaps.fabric.event.*;
|
|
85
87
|
|
|
86
88
|
public class MapView extends com.google.android.gms.maps.MapView implements GoogleMap.InfoWindowAdapter,
|
|
87
|
-
GoogleMap.OnMarkerDragListener, OnMapReadyCallback, GoogleMap.OnPoiClickListener, GoogleMap.OnIndoorStateChangeListener {
|
|
89
|
+
GoogleMap.OnMarkerDragListener, OnMapReadyCallback, GoogleMap.OnPoiClickListener, GoogleMap.OnIndoorStateChangeListener, DefaultLifecycleObserver {
|
|
88
90
|
public GoogleMap map;
|
|
89
91
|
private MarkerManager markerManager;
|
|
90
92
|
private MarkerManager.Collection markerCollection;
|
|
@@ -109,6 +111,9 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
109
111
|
private CameraUpdate cameraToSet;
|
|
110
112
|
private boolean setPaddingDeferred = false;
|
|
111
113
|
private boolean showUserLocation = false;
|
|
114
|
+
|
|
115
|
+
private boolean showsTraffic = false;
|
|
116
|
+
|
|
112
117
|
private boolean handlePanDrag = false;
|
|
113
118
|
private boolean moveOnMarkerPress = true;
|
|
114
119
|
private boolean cacheEnabled = false;
|
|
@@ -136,7 +141,6 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
136
141
|
private final Map<TileOverlay, MapHeatmap> heatmapMap = new HashMap<>();
|
|
137
142
|
private final Map<TileOverlay, MapGradientPolyline> gradientPolylineMap = new HashMap<>();
|
|
138
143
|
private final GestureDetectorCompat gestureDetector;
|
|
139
|
-
private LifecycleEventListener lifecycleListener;
|
|
140
144
|
private boolean paused = false;
|
|
141
145
|
private boolean destroyed = false;
|
|
142
146
|
private final ThemedReactContext context;
|
|
@@ -188,13 +192,65 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
188
192
|
return superContext;
|
|
189
193
|
}
|
|
190
194
|
|
|
195
|
+
|
|
196
|
+
@Override
|
|
197
|
+
public void onCreate(LifecycleOwner owner) {
|
|
198
|
+
super.onCreate(null);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@Override
|
|
202
|
+
public void onStart(LifecycleOwner owner) {
|
|
203
|
+
super.onStart();
|
|
204
|
+
}
|
|
205
|
+
@Override
|
|
206
|
+
public void onResume(LifecycleOwner owner) {
|
|
207
|
+
if (hasPermissions() && map != null) {
|
|
208
|
+
//noinspection MissingPermission
|
|
209
|
+
map.setMyLocationEnabled(showUserLocation);
|
|
210
|
+
map.setLocationSource(fusedLocationSource);
|
|
211
|
+
}
|
|
212
|
+
synchronized (MapView.this) {
|
|
213
|
+
if (!destroyed) {
|
|
214
|
+
MapView.this.onResume();
|
|
215
|
+
}
|
|
216
|
+
paused = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
@Override
|
|
222
|
+
public void onPause(LifecycleOwner owner){
|
|
223
|
+
super.onPause();
|
|
224
|
+
if (hasPermissions() && map != null) {
|
|
225
|
+
//noinspection MissingPermission
|
|
226
|
+
map.setMyLocationEnabled(false);
|
|
227
|
+
}
|
|
228
|
+
synchronized (MapView.this) {
|
|
229
|
+
if (!destroyed) {
|
|
230
|
+
MapView.this.onPause();
|
|
231
|
+
}
|
|
232
|
+
paused = true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@Override
|
|
237
|
+
public void onStop(LifecycleOwner owner) {
|
|
238
|
+
super.onStop();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@Override
|
|
242
|
+
public void onDestroy(LifecycleOwner owner){
|
|
243
|
+
MapView.this.doDestroy();
|
|
244
|
+
}
|
|
245
|
+
|
|
191
246
|
public MapView(ThemedReactContext context,
|
|
192
247
|
GoogleMapOptions googleMapOptions) {
|
|
193
248
|
super(context, googleMapOptions);
|
|
194
|
-
// todo add support for legacy renderer
|
|
195
249
|
this.context = context;
|
|
196
|
-
|
|
197
|
-
|
|
250
|
+
Activity activity = context.getCurrentActivity();
|
|
251
|
+
if (activity instanceof LifecycleOwner) {
|
|
252
|
+
((LifecycleOwner) activity).getLifecycle().addObserver(this);
|
|
253
|
+
}
|
|
198
254
|
super.getMapAsync(this);
|
|
199
255
|
|
|
200
256
|
final MapView view = this;
|
|
@@ -279,6 +335,13 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
279
335
|
return null;
|
|
280
336
|
}
|
|
281
337
|
|
|
338
|
+
public void setShowsTraffic(boolean value) {
|
|
339
|
+
showsTraffic = value;
|
|
340
|
+
if (map != null){
|
|
341
|
+
map.setTrafficEnabled(value);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
282
345
|
|
|
283
346
|
@FunctionalInterface
|
|
284
347
|
public interface EventCreator<T extends Event> {
|
|
@@ -522,50 +585,10 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
522
585
|
MapView.this.cacheView();
|
|
523
586
|
});
|
|
524
587
|
|
|
525
|
-
// We need to be sure to disable location-tracking when app enters background, in-case some
|
|
526
|
-
// other module
|
|
527
|
-
// has acquired a wake-lock and is controlling location-updates, otherwise, location-manager
|
|
528
|
-
// will be left
|
|
529
|
-
// updating location constantly, killing the battery, even though some other location-mgmt
|
|
530
|
-
// module may
|
|
531
|
-
// desire to shut-down location-services.
|
|
532
|
-
lifecycleListener = new LifecycleEventListener() {
|
|
533
|
-
@Override
|
|
534
|
-
public void onHostResume() {
|
|
535
|
-
if (hasPermissions() && map != null) {
|
|
536
|
-
//noinspection MissingPermission
|
|
537
|
-
map.setMyLocationEnabled(showUserLocation);
|
|
538
|
-
map.setLocationSource(fusedLocationSource);
|
|
539
|
-
}
|
|
540
|
-
synchronized (MapView.this) {
|
|
541
|
-
if (!destroyed) {
|
|
542
|
-
MapView.this.onResume();
|
|
543
|
-
}
|
|
544
|
-
paused = false;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
588
|
|
|
548
|
-
|
|
549
|
-
public void onHostPause() {
|
|
550
|
-
if (hasPermissions() && map != null) {
|
|
551
|
-
//noinspection MissingPermission
|
|
552
|
-
map.setMyLocationEnabled(false);
|
|
553
|
-
}
|
|
554
|
-
synchronized (MapView.this) {
|
|
555
|
-
if (!destroyed) {
|
|
556
|
-
MapView.this.onPause();
|
|
557
|
-
}
|
|
558
|
-
paused = true;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
589
|
+
map.setTrafficEnabled(showsTraffic);
|
|
561
590
|
|
|
562
|
-
@Override
|
|
563
|
-
public void onHostDestroy() {
|
|
564
|
-
MapView.this.doDestroy();
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
591
|
|
|
568
|
-
context.addLifecycleEventListener(lifecycleListener);
|
|
569
592
|
isMapReady = true;
|
|
570
593
|
if (kmlSrc != null){
|
|
571
594
|
setKmlSrc(kmlSrc);
|
|
@@ -624,8 +647,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
624
647
|
builder.put(OnMarkerDragEndEvent.EVENT_NAME, MapBuilder.of("registrationName", OnMarkerDragEndEvent.EVENT_NAME));
|
|
625
648
|
builder.put(OnPoiClickEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPoiClickEvent.EVENT_NAME));
|
|
626
649
|
builder.put(OnLongPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnLongPressEvent.EVENT_NAME));
|
|
627
|
-
builder.put(
|
|
628
|
-
builder.put(
|
|
650
|
+
builder.put(OnRegionChangeStartEvent.EVENT_NAME, MapBuilder.of("registrationName", OnRegionChangeStartEvent.EVENT_NAME));
|
|
651
|
+
builder.put(OnDoublePressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnDoublePressEvent.EVENT_NAME));
|
|
629
652
|
return builder.build();
|
|
630
653
|
}
|
|
631
654
|
|
|
@@ -633,7 +656,9 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
633
656
|
return MapBuilder.of(
|
|
634
657
|
OnMapReadyEvent.EVENT_NAME, MapBuilder.of("registrationName", OnMapReadyEvent.EVENT_NAME),
|
|
635
658
|
OnUserLocationChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", OnUserLocationChangeEvent.EVENT_NAME),
|
|
636
|
-
OnRegionChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", OnRegionChangeEvent.EVENT_NAME)
|
|
659
|
+
OnRegionChangeEvent.EVENT_NAME, MapBuilder.of("registrationName", OnRegionChangeEvent.EVENT_NAME),
|
|
660
|
+
OnIndoorBuildingFocusedEvent.EVENT_NAME, MapBuilder.of("registrationName", OnIndoorBuildingFocusedEvent.EVENT_NAME),
|
|
661
|
+
OnIndoorLevelActivatedEvent.EVENT_NAME, MapBuilder.of("registrationName", OnIndoorLevelActivatedEvent.EVENT_NAME)
|
|
637
662
|
);
|
|
638
663
|
}
|
|
639
664
|
|
|
@@ -647,9 +672,9 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
647
672
|
}
|
|
648
673
|
destroyed = true;
|
|
649
674
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
675
|
+
Activity activity = context.getCurrentActivity();
|
|
676
|
+
if (activity instanceof LifecycleOwner) {
|
|
677
|
+
((LifecycleOwner) activity).getLifecycle().removeObserver(this);
|
|
653
678
|
}
|
|
654
679
|
if (!paused) {
|
|
655
680
|
onPause();
|
|
@@ -1592,7 +1617,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1592
1617
|
LatLng coords = this.map.getProjection().fromScreenLocation(point);
|
|
1593
1618
|
WritableMap event = makeClickEventData(coords);
|
|
1594
1619
|
// todo: use Fabric events
|
|
1595
|
-
|
|
1620
|
+
dispatchEvent(event, OnDoublePressEvent::new);
|
|
1621
|
+
|
|
1596
1622
|
}
|
|
1597
1623
|
|
|
1598
1624
|
public void setKmlSrc(String kmlSrc) {
|
|
@@ -1717,9 +1743,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1717
1743
|
indoorBuilding.putInt("activeLevelIndex", building.getActiveLevelIndex());
|
|
1718
1744
|
indoorBuilding.putBoolean("underground", building.isUnderground());
|
|
1719
1745
|
|
|
1720
|
-
event.putMap("
|
|
1721
|
-
|
|
1722
|
-
// manager.pushEvent(context, this, "onIndoorBuildingFocused", event);
|
|
1746
|
+
event.putMap("indoorBuilding", indoorBuilding);
|
|
1747
|
+
dispatchEvent(event, OnIndoorBuildingFocusedEvent::new);
|
|
1723
1748
|
} else {
|
|
1724
1749
|
WritableMap event = Arguments.createMap();
|
|
1725
1750
|
WritableArray levelsArray = Arguments.createArray();
|
|
@@ -1728,9 +1753,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1728
1753
|
indoorBuilding.putInt("activeLevelIndex", 0);
|
|
1729
1754
|
indoorBuilding.putBoolean("underground", false);
|
|
1730
1755
|
|
|
1731
|
-
event.putMap("
|
|
1732
|
-
|
|
1733
|
-
// manager.pushEvent(context, this, "onIndoorBuildingFocused", event);
|
|
1756
|
+
event.putMap("indoorBuilding", indoorBuilding);
|
|
1757
|
+
dispatchEvent(event, OnIndoorBuildingFocusedEvent::new);
|
|
1734
1758
|
}
|
|
1735
1759
|
}
|
|
1736
1760
|
|
|
@@ -1752,9 +1776,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
1752
1776
|
indoorlevel.putString("name", level.getName());
|
|
1753
1777
|
indoorlevel.putString("shortName", level.getShortName());
|
|
1754
1778
|
|
|
1755
|
-
event.putMap("
|
|
1756
|
-
|
|
1757
|
-
// manager.pushEvent(context, this, "onIndoorLevelActivated", event);
|
|
1779
|
+
event.putMap("indoorLevel", indoorlevel);
|
|
1780
|
+
dispatchEvent(event, OnIndoorLevelActivatedEvent::new);
|
|
1758
1781
|
}
|
|
1759
1782
|
|
|
1760
1783
|
public void setIndoorActiveLevelIndex(int activeLevelIndex) {
|
|
@@ -1193,7 +1193,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1193
1193
|
return;
|
|
1194
1194
|
}
|
|
1195
1195
|
self.onIndoorBuildingFocused(@{
|
|
1196
|
-
@"
|
|
1196
|
+
@"indoorBuilding": @{
|
|
1197
1197
|
@"activeLevelIndex": @(building.defaultLevelIndex),
|
|
1198
1198
|
@"underground": @(building.underground),
|
|
1199
1199
|
@"levels": arrayLevels
|
|
@@ -1213,7 +1213,7 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1213
1213
|
i++;
|
|
1214
1214
|
}
|
|
1215
1215
|
self.onIndoorLevelActivated(@{
|
|
1216
|
-
@"
|
|
1216
|
+
@"indoorLevel": @{
|
|
1217
1217
|
@"activeLevelIndex": @(i),
|
|
1218
1218
|
@"name": level.name,
|
|
1219
1219
|
@"shortName": level.shortName
|
|
@@ -86,6 +86,16 @@ using namespace facebook::react;
|
|
|
86
86
|
|
|
87
87
|
[_view fitToCoordinates:coordinatesArray withEdgePadding:edgePadding animated:animated];
|
|
88
88
|
}
|
|
89
|
+
- (void) setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex
|
|
90
|
+
{
|
|
91
|
+
if (!_view.indoorDisplay) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if ( activeLevelIndex < [_view.indoorDisplay.activeBuilding.levels count]) {
|
|
95
|
+
_view.indoorDisplay.activeLevel = _view.indoorDisplay.activeBuilding.levels[activeLevelIndex];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
89
99
|
|
|
90
100
|
#pragma mark - Native commands
|
|
91
101
|
|
|
@@ -184,6 +194,40 @@ using namespace facebook::react;
|
|
|
184
194
|
mapViewEventEmitter->onMapReady(data);
|
|
185
195
|
}
|
|
186
196
|
};
|
|
197
|
+
|
|
198
|
+
_view.onIndoorLevelActivated = [self](NSDictionary* dictionary) {
|
|
199
|
+
if (_eventEmitter) {
|
|
200
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
201
|
+
|
|
202
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorLevelActivatedIndoorLevel level = {
|
|
203
|
+
.activeLevelIndex= (int) [dictionary[@"activeLevelIndex"] integerValue],
|
|
204
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
205
|
+
.shortName = [dictionary[@"shortName"] UTF8String],
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorLevelActivated data = {
|
|
209
|
+
.indoorLevel = level,
|
|
210
|
+
};
|
|
211
|
+
mapViewEventEmitter->onIndoorLevelActivated(data);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
_view.onIndoorBuildingFocused = [self](NSDictionary* dictionary) {
|
|
216
|
+
if (_eventEmitter) {
|
|
217
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
218
|
+
|
|
219
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorBuildingFocused building = {
|
|
220
|
+
.activeLevelIndex= (int) [dictionary[@"activeLevelIndex"] integerValue],
|
|
221
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
222
|
+
.shortName = [dictionary[@"shortName"] UTF8String],
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorBuildingFocused data = {
|
|
226
|
+
.indoorLevel = level,
|
|
227
|
+
};
|
|
228
|
+
mapViewEventEmitter->onIndoorLevelActivated(data);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
187
231
|
|
|
188
232
|
_view.onMapLoaded = [self](NSDictionary* dictionary) {
|
|
189
233
|
if (_eventEmitter) {
|
|
@@ -92,6 +92,11 @@ using namespace facebook::react;
|
|
|
92
92
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
- (void) setIndoorActiveLevelIndex:(NSInteger) activeLevelIndex
|
|
96
|
+
{
|
|
97
|
+
// do nothing (google only)
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
#pragma mark - Native commands
|
|
96
101
|
|
|
97
102
|
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
@@ -39,10 +39,10 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFo
|
|
|
39
39
|
dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
40
40
|
auto $payload = jsi::Object(runtime);
|
|
41
41
|
{
|
|
42
|
-
auto
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$payload.setProperty(runtime, "
|
|
42
|
+
auto indoorBuilding = jsi::Object(runtime);
|
|
43
|
+
indoorBuilding.setProperty(runtime, "underground", $event.indoorBuilding.underground);
|
|
44
|
+
indoorBuilding.setProperty(runtime, "activeLevelIndex", $event.indoorBuilding.activeLevelIndex);
|
|
45
|
+
$payload.setProperty(runtime, "indoorBuilding", indoorBuilding);
|
|
46
46
|
}
|
|
47
47
|
return $payload;
|
|
48
48
|
});
|
|
@@ -53,11 +53,11 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorLevelActivated(OnIndoorLevelActiva
|
|
|
53
53
|
dispatchEvent("indoorLevelActivated", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
54
54
|
auto $payload = jsi::Object(runtime);
|
|
55
55
|
{
|
|
56
|
-
auto
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$payload.setProperty(runtime, "
|
|
56
|
+
auto indoorLevel = jsi::Object(runtime);
|
|
57
|
+
indoorLevel.setProperty(runtime, "activeLevelIndex", $event.indoorLevel.activeLevelIndex);
|
|
58
|
+
indoorLevel.setProperty(runtime, "name", $event.indoorLevel.name);
|
|
59
|
+
indoorLevel.setProperty(runtime, "shortName", $event.indoorLevel.shortName);
|
|
60
|
+
$payload.setProperty(runtime, "indoorLevel", indoorLevel);
|
|
61
61
|
}
|
|
62
62
|
return $payload;
|
|
63
63
|
});
|
|
@@ -45,7 +45,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
struct OnIndoorBuildingFocused {
|
|
48
|
-
OnIndoorBuildingFocusedIndoorBuilding
|
|
48
|
+
OnIndoorBuildingFocusedIndoorBuilding indoorBuilding;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
struct OnIndoorLevelActivatedIndoorLevel {
|
|
@@ -55,7 +55,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
struct OnIndoorLevelActivated {
|
|
58
|
-
OnIndoorLevelActivatedIndoorLevel
|
|
58
|
+
OnIndoorLevelActivatedIndoorLevel indoorLevel;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
struct OnKmlReady {
|
|
@@ -125,6 +125,7 @@ RNMapsMapViewProps::RNMapsMapViewProps(
|
|
|
125
125
|
userLocationUpdateInterval(convertRawProp(context, rawProps, "userLocationUpdateInterval", sourceProps.userLocationUpdateInterval, {5000})),
|
|
126
126
|
zoomControlEnabled(convertRawProp(context, rawProps, "zoomControlEnabled", sourceProps.zoomControlEnabled, {true})),
|
|
127
127
|
zoomEnabled(convertRawProp(context, rawProps, "zoomEnabled", sourceProps.zoomEnabled, {true})),
|
|
128
|
+
showsTraffic(convertRawProp(context, rawProps, "showsTraffic", sourceProps.showsTraffic, {false})),
|
|
128
129
|
zoomTapEnabled(convertRawProp(context, rawProps, "zoomTapEnabled", sourceProps.zoomTapEnabled, {true})),
|
|
129
130
|
cameraZoomRange(convertRawProp(context, rawProps, "cameraZoomRange", sourceProps.cameraZoomRange, {}))
|
|
130
131
|
{}
|
|
@@ -888,6 +888,7 @@ class RNMapsMapViewProps final : public ViewProps {
|
|
|
888
888
|
int userLocationUpdateInterval{5000};
|
|
889
889
|
bool zoomControlEnabled{true};
|
|
890
890
|
bool zoomEnabled{true};
|
|
891
|
+
bool showsTraffic{false};
|
|
891
892
|
bool zoomTapEnabled{true};
|
|
892
893
|
RNMapsMapViewCameraZoomRangeStruct cameraZoomRange{};
|
|
893
894
|
};
|
|
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
20
20
|
- (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
21
21
|
- (void)fitToSuppliedMarkers:(NSString *)markersJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
22
22
|
- (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
23
|
+
- (void)setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex;
|
|
23
24
|
@end
|
|
24
25
|
|
|
25
26
|
RCT_EXTERN inline void RCTRNMapsGoogleMapViewHandleCommand(
|
|
@@ -203,6 +204,26 @@ NSObject *arg2 = args[2];
|
|
|
203
204
|
return;
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
if ([commandName isEqualToString:@"setIndoorActiveLevelIndex"]) {
|
|
208
|
+
#if RCT_DEBUG
|
|
209
|
+
if ([args count] != 1) {
|
|
210
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMapView", commandName, (int)[args count], 1);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
#endif
|
|
214
|
+
|
|
215
|
+
NSObject *arg0 = args[0];
|
|
216
|
+
#if RCT_DEBUG
|
|
217
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"RNMapsGoogleMapView", commandName, @"1st")) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
#endif
|
|
221
|
+
NSInteger activeLevelIndex = [(NSNumber *)arg0 intValue];
|
|
222
|
+
|
|
223
|
+
[componentView setIndoorActiveLevelIndex:activeLevelIndex];
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
206
227
|
#if RCT_DEBUG
|
|
207
228
|
RCTLogError(@"%@ received command %@, which is not a supported command.", @"RNMapsGoogleMapView", commandName);
|
|
208
229
|
#endif
|
|
@@ -219,6 +240,7 @@ NSObject *arg2 = args[2];
|
|
|
219
240
|
- (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
220
241
|
- (void)fitToSuppliedMarkers:(NSString *)markersJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
221
242
|
- (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
|
|
243
|
+
- (void)setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex;
|
|
222
244
|
@end
|
|
223
245
|
|
|
224
246
|
RCT_EXTERN inline void RCTRNMapsMapViewHandleCommand(
|
|
@@ -402,6 +424,26 @@ NSObject *arg2 = args[2];
|
|
|
402
424
|
return;
|
|
403
425
|
}
|
|
404
426
|
|
|
427
|
+
if ([commandName isEqualToString:@"setIndoorActiveLevelIndex"]) {
|
|
428
|
+
#if RCT_DEBUG
|
|
429
|
+
if ([args count] != 1) {
|
|
430
|
+
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsMapView", commandName, (int)[args count], 1);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
#endif
|
|
434
|
+
|
|
435
|
+
NSObject *arg0 = args[0];
|
|
436
|
+
#if RCT_DEBUG
|
|
437
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"RNMapsMapView", commandName, @"1st")) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
#endif
|
|
441
|
+
NSInteger activeLevelIndex = [(NSNumber *)arg0 intValue];
|
|
442
|
+
|
|
443
|
+
[componentView setIndoorActiveLevelIndex:activeLevelIndex];
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
|
|
405
447
|
#if RCT_DEBUG
|
|
406
448
|
RCTLogError(@"%@ received command %@, which is not a supported command.", @"RNMapsMapView", commandName);
|
|
407
449
|
#endif
|
package/lib/MapView.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Animated as RNAnimated, Animated, NativeSyntheticEvent, ViewProps } from 'react-native';
|
|
3
3
|
import { CalloutPressEvent, ClickEvent, Frame, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Point, Provider, Region } from './sharedTypes';
|
|
4
|
-
import { Address, BoundingBox, Camera, CameraZoomRange, ChangeEvent, Details, EdgePadding, FitToOptions,
|
|
4
|
+
import { ActiveIndoorLevel, Address, BoundingBox, Camera, CameraZoomRange, ChangeEvent, Details, EdgePadding, FitToOptions, IndoorBuilding, KmlMapEvent, LongPressEvent, MapPressEvent, MapStyleElement, MapType, MapTypes, PanDragEvent, PoiClickEvent, SnapshotOptions, UserLocationChangeEvent } from './MapView.types';
|
|
5
5
|
import { Modify } from './sharedTypesInternal';
|
|
6
6
|
import { MapViewNativeComponentType } from './MapViewNativeComponent';
|
|
7
7
|
import AnimatedRegion from './AnimatedRegion';
|
|
@@ -217,14 +217,14 @@ export type MapViewProps = ViewProps & {
|
|
|
217
217
|
* @platform iOS: Google Maps only
|
|
218
218
|
* @platform Android: Supported
|
|
219
219
|
*/
|
|
220
|
-
onIndoorBuildingFocused?: (
|
|
220
|
+
onIndoorBuildingFocused?: (indoorBuilding: IndoorBuilding) => void;
|
|
221
221
|
/**
|
|
222
222
|
* Callback that is called when a level on indoor building is activated
|
|
223
223
|
*
|
|
224
224
|
* @platform iOS: Google Maps only
|
|
225
225
|
* @platform Android: Supported
|
|
226
226
|
*/
|
|
227
|
-
onIndoorLevelActivated?: (
|
|
227
|
+
onIndoorLevelActivated?: (indoorLevel: ActiveIndoorLevel) => void;
|
|
228
228
|
/**
|
|
229
229
|
* Callback that is called once the kml is fully loaded.
|
|
230
230
|
*
|
|
@@ -619,7 +619,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
619
619
|
*/
|
|
620
620
|
getMapBoundaries(): Promise<BoundingBox>;
|
|
621
621
|
setMapBoundaries(northEast: LatLng, southWest: LatLng): void;
|
|
622
|
-
setIndoorActiveLevelIndex(activeLevelIndex: number): void
|
|
622
|
+
setIndoorActiveLevelIndex(activeLevelIndex: number): void | Promise<never>;
|
|
623
623
|
/**
|
|
624
624
|
* Takes a snapshot of the map and saves it to a picture
|
|
625
625
|
* file or returns the image as a base64 encoded string.
|
|
@@ -693,6 +693,8 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
693
693
|
private handleMarkerDeselect;
|
|
694
694
|
private handleRegionChange;
|
|
695
695
|
private handleRegionChangeStarted;
|
|
696
|
+
private handleIndoorBuildingFocused;
|
|
697
|
+
private handleIndoorLevelActivated;
|
|
696
698
|
private handleRegionChangeComplete;
|
|
697
699
|
render(): React.JSX.Element;
|
|
698
700
|
}
|
package/lib/MapView.js
CHANGED
|
@@ -167,9 +167,10 @@ class MapView extends React.Component {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
170
|
-
if (this.
|
|
171
|
-
|
|
170
|
+
if (this.fabricMap.current) {
|
|
171
|
+
return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
|
|
172
172
|
}
|
|
173
|
+
return Promise.reject('getMapBoundaries not supported on this platform');
|
|
173
174
|
}
|
|
174
175
|
/**
|
|
175
176
|
* Takes a snapshot of the map and saves it to a picture
|
|
@@ -340,6 +341,16 @@ class MapView extends React.Component {
|
|
|
340
341
|
this.props.onRegionChangeStart(event);
|
|
341
342
|
}
|
|
342
343
|
};
|
|
344
|
+
handleIndoorBuildingFocused = (event) => {
|
|
345
|
+
if (this.props.onIndoorBuildingFocused) {
|
|
346
|
+
this.props.onIndoorBuildingFocused(event);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
handleIndoorLevelActivated = (event) => {
|
|
350
|
+
if (this.props.onIndoorLevelActivated) {
|
|
351
|
+
this.props.onIndoorLevelActivated(event);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
343
354
|
handleRegionChangeComplete = (event) => {
|
|
344
355
|
const isGesture = event.nativeEvent.isGesture;
|
|
345
356
|
const details = { isGesture };
|
|
@@ -368,6 +379,9 @@ class MapView extends React.Component {
|
|
|
368
379
|
onRegionChange: this.handleRegionChange,
|
|
369
380
|
onRegionChangeStart: this.handleRegionChangeStarted,
|
|
370
381
|
onRegionChangeComplete: this.handleRegionChangeComplete,
|
|
382
|
+
onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
|
|
383
|
+
// @ts-ignore
|
|
384
|
+
onIndoorLevelActivated: this.handleIndoorLevelActivated,
|
|
371
385
|
...restProps,
|
|
372
386
|
};
|
|
373
387
|
if (this.props.region) {
|
package/lib/MapView.types.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type ActiveIndoorLevel = {
|
|
|
46
46
|
shortName: string;
|
|
47
47
|
};
|
|
48
48
|
export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
|
|
49
|
-
|
|
49
|
+
indoorLevel: ActiveIndoorLevel;
|
|
50
50
|
}>;
|
|
51
51
|
export type IndoorBuilding = {
|
|
52
52
|
underground: boolean;
|
package/lib/createFabricMap.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface FabricMapHandle {
|
|
|
18
18
|
getAddressFromCoordinates: (coordinate: LatLng) => Promise<Address>;
|
|
19
19
|
getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
|
|
20
20
|
getCoordinateForPoint: (point: Point) => Promise<LatLng>;
|
|
21
|
+
setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
|
|
21
22
|
}
|
|
22
23
|
declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
|
|
23
24
|
export default createFabricMap;
|
package/lib/createFabricMap.js
CHANGED
|
@@ -154,6 +154,19 @@ const createFabricMap = (ViewComponent, Commands) => {
|
|
|
154
154
|
throw new Error('fitToCoordinates is only supported on iOS with Fabric.');
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
|
+
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
158
|
+
if (fabricRef.current) {
|
|
159
|
+
try {
|
|
160
|
+
Commands.setIndoorActiveLevelIndex(fabricRef.current, activeLevelIndex);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error('Failed to set camera:', error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.warn('setIndoorActiveLevelIndex is not supported.');
|
|
168
|
+
}
|
|
169
|
+
},
|
|
157
170
|
setCamera(camera) {
|
|
158
171
|
if (fabricRef.current) {
|
|
159
172
|
try {
|
|
@@ -164,7 +177,7 @@ const createFabricMap = (ViewComponent, Commands) => {
|
|
|
164
177
|
}
|
|
165
178
|
}
|
|
166
179
|
else {
|
|
167
|
-
console.warn('setCamera is
|
|
180
|
+
console.warn('setCamera is not supported');
|
|
168
181
|
}
|
|
169
182
|
},
|
|
170
183
|
}));
|
|
@@ -133,7 +133,7 @@ export type IndoorLevel = Readonly<{
|
|
|
133
133
|
shortName: string;
|
|
134
134
|
}>;
|
|
135
135
|
export type IndoorLevelActivatedEventHandler = DirectEventHandler<Readonly<{
|
|
136
|
-
|
|
136
|
+
indoorLevel: {
|
|
137
137
|
activeLevelIndex: Int32;
|
|
138
138
|
name: string;
|
|
139
139
|
shortName: string;
|
|
@@ -145,7 +145,7 @@ export type IndoorBuilding = Readonly<{
|
|
|
145
145
|
levels: ReadonlyArray<IndoorLevel>;
|
|
146
146
|
}>;
|
|
147
147
|
export type IndoorBuildingEventHandler = DirectEventHandler<Readonly<{
|
|
148
|
-
|
|
148
|
+
indoorBuilding: {
|
|
149
149
|
underground: boolean;
|
|
150
150
|
activeLevelIndex: Int32;
|
|
151
151
|
};
|
|
@@ -609,7 +609,6 @@ export interface MapFabricNativeProps extends ViewProps {
|
|
|
609
609
|
showsScale?: boolean;
|
|
610
610
|
/**
|
|
611
611
|
* A Boolean value indicating whether the map displays traffic information.
|
|
612
|
-
* TODO: Look into android support
|
|
613
612
|
*
|
|
614
613
|
* @default false
|
|
615
614
|
* @platform iOS: Supported
|
|
@@ -707,6 +706,7 @@ export interface NativeCommands {
|
|
|
707
706
|
fitToElements: (viewRef: React.ElementRef<React.ComponentType>, edgePaddingJSON: string, animated: boolean) => void;
|
|
708
707
|
fitToSuppliedMarkers: (viewRef: React.ElementRef<React.ComponentType>, markersJSON: string, edgePaddingJSON: string, animated: boolean) => void;
|
|
709
708
|
fitToCoordinates: (viewRef: React.ElementRef<React.ComponentType>, coordinatesJSON: string, edgePaddingJSON: string, animated: boolean) => void;
|
|
709
|
+
setIndoorActiveLevelIndex: (viewRef: React.ElementRef<React.ComponentType>, activeLevelIndex: Int32) => void;
|
|
710
710
|
}
|
|
711
711
|
export declare const Commands: NativeCommands;
|
|
712
712
|
declare const _default: HostComponent<MapFabricNativeProps>;
|
|
@@ -806,6 +806,14 @@ export interface MapFabricNativeProps extends ViewProps {
|
|
|
806
806
|
* @platform Android: Supported
|
|
807
807
|
*/
|
|
808
808
|
zoomEnabled?: WithDefault<boolean, true>;
|
|
809
|
+
/**
|
|
810
|
+
* A Boolean value indicating whether the map displays traffic information.
|
|
811
|
+
*
|
|
812
|
+
* @default false
|
|
813
|
+
* @platform iOS: Google Maps only
|
|
814
|
+
* @platform Android: Supported
|
|
815
|
+
*/
|
|
816
|
+
showsTraffic?: boolean;
|
|
809
817
|
/**
|
|
810
818
|
* If `false` the user won't be able to double tap to zoom the map.
|
|
811
819
|
* **Note:** But it will greatly decrease delay of tap gesture recognition.
|
|
@@ -832,6 +840,7 @@ export interface NativeCommands {
|
|
|
832
840
|
fitToElements: (viewRef: React.ElementRef<React.ComponentType>, edgePaddingJSON: string, animated: boolean) => void;
|
|
833
841
|
fitToSuppliedMarkers: (viewRef: React.ElementRef<React.ComponentType>, markersJSON: string, edgePaddingJSON: string, animated: boolean) => void;
|
|
834
842
|
fitToCoordinates: (viewRef: React.ElementRef<React.ComponentType>, coordinatesJSON: string, edgePaddingJSON: string, animated: boolean) => void;
|
|
843
|
+
setIndoorActiveLevelIndex: (viewRef: React.ElementRef<React.ComponentType>, activeLevelIndex: Int32) => void;
|
|
835
844
|
}
|
|
836
845
|
export declare const Commands: NativeCommands;
|
|
837
846
|
declare const _default: HostComponent<MapFabricNativeProps>;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.75",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|