react-native-maps 1.12.0 → 1.13.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/android/src/main/java/com/rnmaps/maps/MapManager.java +447 -420
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +294 -292
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +1 -27
- package/android/src/main/java/com/rnmaps/maps/MapView.java +33 -44
- package/lib/MapView.d.ts +8 -1
- package/lib/MapView.js +3 -8
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -2
- package/package.json +1 -1
|
@@ -22,6 +22,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
|
22
22
|
import com.google.android.gms.location.Priority;
|
|
23
23
|
import com.google.android.gms.maps.GoogleMap;
|
|
24
24
|
import com.google.android.gms.maps.GoogleMapOptions;
|
|
25
|
+
import com.google.android.gms.maps.MapsInitializer;
|
|
26
|
+
import com.google.android.gms.maps.model.CameraPosition;
|
|
25
27
|
import com.google.android.gms.maps.model.LatLng;
|
|
26
28
|
import com.google.android.gms.maps.model.LatLngBounds;
|
|
27
29
|
|
|
@@ -29,437 +31,462 @@ import java.util.Map;
|
|
|
29
31
|
|
|
30
32
|
public class MapManager extends ViewGroupManager<MapView> {
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
private final Map<String, Integer> MAP_TYPES = MapBuilder.of(
|
|
35
|
-
"standard", GoogleMap.MAP_TYPE_NORMAL,
|
|
36
|
-
"satellite", GoogleMap.MAP_TYPE_SATELLITE,
|
|
37
|
-
"hybrid", GoogleMap.MAP_TYPE_HYBRID,
|
|
38
|
-
"terrain", GoogleMap.MAP_TYPE_TERRAIN,
|
|
39
|
-
"none", GoogleMap.MAP_TYPE_NONE
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
private final Map<String, Integer> MY_LOCATION_PRIORITY = MapBuilder.of(
|
|
43
|
-
"balanced", Priority.PRIORITY_BALANCED_POWER_ACCURACY,
|
|
44
|
-
"high", Priority.PRIORITY_HIGH_ACCURACY,
|
|
45
|
-
"low", Priority.PRIORITY_LOW_POWER,
|
|
46
|
-
"passive", Priority.PRIORITY_PASSIVE
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
private final ReactApplicationContext appContext;
|
|
50
|
-
private MapMarkerManager markerManager;
|
|
51
|
-
|
|
52
|
-
protected GoogleMapOptions googleMapOptions;
|
|
53
|
-
|
|
54
|
-
public MapManager(ReactApplicationContext context) {
|
|
55
|
-
this.appContext = context;
|
|
56
|
-
this.googleMapOptions = new GoogleMapOptions();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public MapMarkerManager getMarkerManager() {
|
|
60
|
-
return this.markerManager;
|
|
61
|
-
}
|
|
62
|
-
public void setMarkerManager(MapMarkerManager markerManager) {
|
|
63
|
-
this.markerManager = markerManager;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@Override
|
|
67
|
-
public String getName() {
|
|
68
|
-
return REACT_CLASS;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@Override
|
|
72
|
-
protected MapView createViewInstance(@NonNull ThemedReactContext context) {
|
|
73
|
-
return new MapView(context, this.appContext, this, googleMapOptions);
|
|
74
|
-
}
|
|
75
|
-
@Override
|
|
76
|
-
protected MapView createViewInstance(int reactTag, @NonNull ThemedReactContext reactContext, @Nullable ReactStylesDiffMap initialProps, @Nullable StateWrapper stateWrapper) {
|
|
77
|
-
if (initialProps != null){
|
|
78
|
-
if (initialProps.getString("googleMapId") != null) {
|
|
79
|
-
googleMapOptions.mapId(initialProps.getString("googleMapId"));
|
|
80
|
-
}
|
|
81
|
-
if (initialProps.hasKey("liteMode")) {
|
|
82
|
-
googleMapOptions.liteMode(initialProps.getBoolean("liteMode", false));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private void emitMapError(ThemedReactContext context, String message, String type) {
|
|
89
|
-
WritableMap error = Arguments.createMap();
|
|
90
|
-
error.putString("message", message);
|
|
91
|
-
error.putString("type", type);
|
|
92
|
-
|
|
93
|
-
context
|
|
94
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
95
|
-
.emit("onError", error);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@ReactProp(name = "region")
|
|
99
|
-
public void setRegion(MapView view, ReadableMap region) {
|
|
100
|
-
view.setRegion(region);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
@ReactProp(name = "liteMode", defaultBoolean = false)
|
|
104
|
-
public void setLiteMode(MapView view, boolean liteMode) {
|
|
105
|
-
googleMapOptions.liteMode(liteMode);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
@ReactProp(name = "googleMapId")
|
|
109
|
-
public void setGoogleMapId(MapView view, @Nullable String googleMapId) {
|
|
110
|
-
if (googleMapId != null) {
|
|
111
|
-
googleMapOptions.mapId(googleMapId);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@ReactProp(name = "initialRegion")
|
|
116
|
-
public void setInitialRegion(MapView view, ReadableMap initialRegion) {
|
|
117
|
-
view.setInitialRegion(initialRegion);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@ReactProp(name = "camera")
|
|
121
|
-
public void setCamera(MapView view, ReadableMap camera) {
|
|
122
|
-
view.setCamera(camera);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@ReactProp(name = "initialCamera")
|
|
126
|
-
public void setInitialCamera(MapView view, ReadableMap initialCamera) {
|
|
127
|
-
view.setInitialCamera(initialCamera);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
@ReactProp(name = "mapType")
|
|
131
|
-
public void setMapType(MapView view, @Nullable String mapType) {
|
|
132
|
-
int typeId = MAP_TYPES.get(mapType);
|
|
133
|
-
view.map.setMapType(typeId);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@ReactProp(name = "customMapStyleString")
|
|
137
|
-
public void setMapStyle(MapView view, @Nullable String customMapStyleString) {
|
|
138
|
-
view.setMapStyle(customMapStyleString);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@ReactProp(name = "mapPadding")
|
|
142
|
-
public void setMapPadding(MapView view, @Nullable ReadableMap padding) {
|
|
143
|
-
int left = 0;
|
|
144
|
-
int top = 0;
|
|
145
|
-
int right = 0;
|
|
146
|
-
int bottom = 0;
|
|
147
|
-
double density = (double) view.getResources().getDisplayMetrics().density;
|
|
148
|
-
|
|
149
|
-
if (padding != null) {
|
|
150
|
-
if (padding.hasKey("left")) {
|
|
151
|
-
left = (int) (padding.getDouble("left") * density);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (padding.hasKey("top")) {
|
|
155
|
-
top = (int) (padding.getDouble("top") * density);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (padding.hasKey("right")) {
|
|
159
|
-
right = (int) (padding.getDouble("right") * density);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (padding.hasKey("bottom")) {
|
|
163
|
-
bottom = (int) (padding.getDouble("bottom") * density);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
view.applyBaseMapPadding(left, top, right, bottom);
|
|
168
|
-
view.map.setPadding(left, top, right, bottom);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@ReactProp(name = "showsUserLocation", defaultBoolean = false)
|
|
172
|
-
public void setShowsUserLocation(MapView view, boolean showUserLocation) {
|
|
173
|
-
view.setShowsUserLocation(showUserLocation);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@ReactProp(name = "userLocationPriority")
|
|
177
|
-
public void setUserLocationPriority(MapView view, @Nullable String accuracy) {
|
|
178
|
-
view.setUserLocationPriority(MY_LOCATION_PRIORITY.get(accuracy));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@ReactProp(name = "userLocationUpdateInterval", defaultInt = 5000)
|
|
182
|
-
public void setUserLocationUpdateInterval(MapView view, int updateInterval) {
|
|
183
|
-
view.setUserLocationUpdateInterval(updateInterval);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
@ReactProp(name = "userLocationFastestInterval", defaultInt = 5000)
|
|
187
|
-
public void setUserLocationFastestInterval(MapView view, int fastestInterval) {
|
|
188
|
-
view.setUserLocationFastestInterval(fastestInterval);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
@ReactProp(name = "showsMyLocationButton", defaultBoolean = true)
|
|
192
|
-
public void setShowsMyLocationButton(MapView view, boolean showMyLocationButton) {
|
|
193
|
-
view.setShowsMyLocationButton(showMyLocationButton);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@ReactProp(name = "toolbarEnabled", defaultBoolean = true)
|
|
197
|
-
public void setToolbarEnabled(MapView view, boolean toolbarEnabled) {
|
|
198
|
-
view.setToolbarEnabled(toolbarEnabled);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// This is a private prop to improve performance of panDrag by disabling it when the callback
|
|
202
|
-
// is not set
|
|
203
|
-
@ReactProp(name = "handlePanDrag", defaultBoolean = false)
|
|
204
|
-
public void setHandlePanDrag(MapView view, boolean handlePanDrag) {
|
|
205
|
-
view.setHandlePanDrag(handlePanDrag);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
@ReactProp(name = "showsTraffic", defaultBoolean = false)
|
|
209
|
-
public void setShowTraffic(MapView view, boolean showTraffic) {
|
|
210
|
-
view.map.setTrafficEnabled(showTraffic);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
@ReactProp(name = "showsBuildings", defaultBoolean = false)
|
|
214
|
-
public void setShowBuildings(MapView view, boolean showBuildings) {
|
|
215
|
-
view.map.setBuildingsEnabled(showBuildings);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
@ReactProp(name = "showsIndoors", defaultBoolean = false)
|
|
219
|
-
public void setShowIndoors(MapView view, boolean showIndoors) {
|
|
220
|
-
view.map.setIndoorEnabled(showIndoors);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
@ReactProp(name = "showsIndoorLevelPicker", defaultBoolean = false)
|
|
224
|
-
public void setShowsIndoorLevelPicker(MapView view, boolean showsIndoorLevelPicker) {
|
|
225
|
-
view.map.getUiSettings().setIndoorLevelPickerEnabled(showsIndoorLevelPicker);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
@ReactProp(name = "showsCompass", defaultBoolean = false)
|
|
229
|
-
public void setShowsCompass(MapView view, boolean showsCompass) {
|
|
230
|
-
view.map.getUiSettings().setCompassEnabled(showsCompass);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
@ReactProp(name = "scrollEnabled", defaultBoolean = false)
|
|
234
|
-
public void setScrollEnabled(MapView view, boolean scrollEnabled) {
|
|
235
|
-
view.map.getUiSettings().setScrollGesturesEnabled(scrollEnabled);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
@ReactProp(name = "zoomEnabled", defaultBoolean = false)
|
|
239
|
-
public void setZoomEnabled(MapView view, boolean zoomEnabled) {
|
|
240
|
-
view.map.getUiSettings().setZoomGesturesEnabled(zoomEnabled);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@ReactProp(name = "zoomControlEnabled", defaultBoolean = true)
|
|
244
|
-
public void setZoomControlEnabled(MapView view, boolean zoomControlEnabled) {
|
|
245
|
-
view.map.getUiSettings().setZoomControlsEnabled(zoomControlEnabled);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
@ReactProp(name = "rotateEnabled", defaultBoolean = false)
|
|
249
|
-
public void setRotateEnabled(MapView view, boolean rotateEnabled) {
|
|
250
|
-
view.map.getUiSettings().setRotateGesturesEnabled(rotateEnabled);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
@ReactProp(name = "scrollDuringRotateOrZoomEnabled", defaultBoolean = true)
|
|
254
|
-
public void setScrollDuringRotateOrZoomEnabled(MapView view, boolean scrollDuringRotateOrZoomEnabled) {
|
|
255
|
-
view.map.getUiSettings().setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringRotateOrZoomEnabled);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
@ReactProp(name = "cacheEnabled", defaultBoolean = false)
|
|
259
|
-
public void setCacheEnabled(MapView view, boolean cacheEnabled) {
|
|
260
|
-
view.setCacheEnabled(cacheEnabled);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
@ReactProp(name = "loadingEnabled", defaultBoolean = false)
|
|
264
|
-
public void setLoadingEnabled(MapView view, boolean loadingEnabled) {
|
|
265
|
-
view.enableMapLoading(loadingEnabled);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
@ReactProp(name = "moveOnMarkerPress", defaultBoolean = true)
|
|
269
|
-
public void setMoveOnMarkerPress(MapView view, boolean moveOnPress) {
|
|
270
|
-
view.setMoveOnMarkerPress(moveOnPress);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
@ReactProp(name = "loadingBackgroundColor", customType = "Color")
|
|
274
|
-
public void setLoadingBackgroundColor(MapView view, @Nullable Integer loadingBackgroundColor) {
|
|
275
|
-
view.setLoadingBackgroundColor(loadingBackgroundColor);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@ReactProp(name = "loadingIndicatorColor", customType = "Color")
|
|
279
|
-
public void setLoadingIndicatorColor(MapView view, @Nullable Integer loadingIndicatorColor) {
|
|
280
|
-
view.setLoadingIndicatorColor(loadingIndicatorColor);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
@ReactProp(name = "pitchEnabled", defaultBoolean = false)
|
|
284
|
-
public void setPitchEnabled(MapView view, boolean pitchEnabled) {
|
|
285
|
-
view.map.getUiSettings().setTiltGesturesEnabled(pitchEnabled);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
@ReactProp(name = "minZoomLevel")
|
|
289
|
-
public void setMinZoomLevel(MapView view, float minZoomLevel) {
|
|
290
|
-
view.map.setMinZoomPreference(minZoomLevel);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
@ReactProp(name = "maxZoomLevel")
|
|
294
|
-
public void setMaxZoomLevel(MapView view, float maxZoomLevel) {
|
|
295
|
-
view.map.setMaxZoomPreference(maxZoomLevel);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
@ReactProp(name = "kmlSrc")
|
|
299
|
-
public void setKmlSrc(MapView view, String kmlUrl) {
|
|
300
|
-
if (kmlUrl != null) {
|
|
301
|
-
view.setKmlSrc(kmlUrl);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
@Override
|
|
306
|
-
public void receiveCommand(@NonNull MapView view, String commandId, @Nullable ReadableArray args) {
|
|
307
|
-
int duration;
|
|
308
|
-
double lat;
|
|
309
|
-
double lng;
|
|
310
|
-
double lngDelta;
|
|
311
|
-
double latDelta;
|
|
312
|
-
ReadableMap region;
|
|
313
|
-
ReadableMap camera;
|
|
314
|
-
|
|
315
|
-
switch (commandId) {
|
|
316
|
-
case "setCamera":
|
|
317
|
-
if(args == null) {
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
camera = args.getMap(0);
|
|
321
|
-
view.animateToCamera(camera, 0);
|
|
322
|
-
break;
|
|
34
|
+
private static final String REACT_CLASS = "AIRMap";
|
|
323
35
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
lngDelta = region.getDouble("longitudeDelta");
|
|
342
|
-
latDelta = region.getDouble("latitudeDelta");
|
|
343
|
-
LatLngBounds bounds = new LatLngBounds(
|
|
344
|
-
new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
|
|
345
|
-
new LatLng(lat + latDelta / 2, lng + lngDelta / 2) // northeast
|
|
346
|
-
);
|
|
347
|
-
view.animateToRegion(bounds, duration);
|
|
348
|
-
break;
|
|
36
|
+
private final Map<String, Integer> MAP_TYPES = MapBuilder.of(
|
|
37
|
+
"standard", GoogleMap.MAP_TYPE_NORMAL,
|
|
38
|
+
"satellite", GoogleMap.MAP_TYPE_SATELLITE,
|
|
39
|
+
"hybrid", GoogleMap.MAP_TYPE_HYBRID,
|
|
40
|
+
"terrain", GoogleMap.MAP_TYPE_TERRAIN,
|
|
41
|
+
"none", GoogleMap.MAP_TYPE_NONE
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
private final Map<String, Integer> MY_LOCATION_PRIORITY = MapBuilder.of(
|
|
45
|
+
"balanced", Priority.PRIORITY_BALANCED_POWER_ACCURACY,
|
|
46
|
+
"high", Priority.PRIORITY_HIGH_ACCURACY,
|
|
47
|
+
"low", Priority.PRIORITY_LOW_POWER,
|
|
48
|
+
"passive", Priority.PRIORITY_PASSIVE
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
private final ReactApplicationContext appContext;
|
|
52
|
+
private MapMarkerManager markerManager;
|
|
349
53
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
54
|
+
protected GoogleMapOptions googleMapOptions;
|
|
55
|
+
|
|
56
|
+
protected MapsInitializer.Renderer renderer;
|
|
57
|
+
|
|
58
|
+
public MapManager(ReactApplicationContext context) {
|
|
59
|
+
this.appContext = context;
|
|
60
|
+
this.googleMapOptions = new GoogleMapOptions();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public MapMarkerManager getMarkerManager() {
|
|
64
|
+
return this.markerManager;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public void setMarkerManager(MapMarkerManager markerManager) {
|
|
68
|
+
this.markerManager = markerManager;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@Override
|
|
72
|
+
public String getName() {
|
|
73
|
+
return REACT_CLASS;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Override
|
|
77
|
+
protected MapView createViewInstance(@NonNull ThemedReactContext context) {
|
|
78
|
+
return new MapView(context, this.appContext, this, googleMapOptions);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Override
|
|
82
|
+
protected MapView createViewInstance(int reactTag, @NonNull ThemedReactContext reactContext, @Nullable ReactStylesDiffMap initialProps, @Nullable StateWrapper stateWrapper) {
|
|
83
|
+
if (initialProps != null) {
|
|
84
|
+
if (initialProps.getString("googleMapId") != null) {
|
|
85
|
+
googleMapOptions.mapId(initialProps.getString("googleMapId"));
|
|
86
|
+
}
|
|
87
|
+
if (initialProps.hasKey("liteMode")) {
|
|
88
|
+
googleMapOptions.liteMode(initialProps.getBoolean("liteMode", false));
|
|
89
|
+
}
|
|
90
|
+
if (initialProps.hasKey("initialCamera")) {
|
|
91
|
+
CameraPosition position = MapView.cameraPositionFromMap(initialProps.getMap("initialCamera"));
|
|
92
|
+
if (position != null) {
|
|
93
|
+
googleMapOptions.camera(position);
|
|
94
|
+
}
|
|
95
|
+
} else if (initialProps.hasKey("camera")) {
|
|
96
|
+
CameraPosition position = MapView.cameraPositionFromMap(initialProps.getMap("camera"));
|
|
97
|
+
if (position != null) {
|
|
98
|
+
googleMapOptions.camera(position);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (initialProps.hasKey("googleRenderer") && "LEGACY".equals(initialProps.getString("googleRenderer"))) {
|
|
102
|
+
renderer = MapsInitializer.Renderer.LEGACY;
|
|
103
|
+
} else {
|
|
104
|
+
renderer = MapsInitializer.Renderer.LATEST;
|
|
105
|
+
}
|
|
353
106
|
}
|
|
354
|
-
|
|
355
|
-
|
|
107
|
+
return super.createViewInstance(reactTag, reactContext, initialProps, stateWrapper);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private void emitMapError(ThemedReactContext context, String message, String type) {
|
|
111
|
+
WritableMap error = Arguments.createMap();
|
|
112
|
+
error.putString("message", message);
|
|
113
|
+
error.putString("type", type);
|
|
114
|
+
|
|
115
|
+
context
|
|
116
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
117
|
+
.emit("onError", error);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@ReactProp(name = "region")
|
|
121
|
+
public void setRegion(MapView view, ReadableMap region) {
|
|
122
|
+
view.setRegion(region);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@ReactProp(name = "googleRenderer")
|
|
126
|
+
public void setGoogleRenderer(MapView view, @Nullable String googleRenderer) {
|
|
127
|
+
// do nothing, passed as part of the InitialProps
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@ReactProp(name = "liteMode", defaultBoolean = false)
|
|
131
|
+
public void setLiteMode(MapView view, boolean liteMode) {
|
|
132
|
+
googleMapOptions.liteMode(liteMode);
|
|
133
|
+
}
|
|
356
134
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
135
|
+
@ReactProp(name = "googleMapId")
|
|
136
|
+
public void setGoogleMapId(MapView view, @Nullable String googleMapId) {
|
|
137
|
+
if (googleMapId != null) {
|
|
138
|
+
googleMapOptions.mapId(googleMapId);
|
|
360
139
|
}
|
|
361
|
-
|
|
362
|
-
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@ReactProp(name = "initialRegion")
|
|
143
|
+
public void setInitialRegion(MapView view, ReadableMap initialRegion) {
|
|
144
|
+
view.setInitialRegion(initialRegion);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@ReactProp(name = "camera")
|
|
148
|
+
public void setCamera(MapView view, ReadableMap camera) {
|
|
149
|
+
view.setCamera(camera);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@ReactProp(name = "initialCamera")
|
|
153
|
+
public void setInitialCamera(MapView view, ReadableMap initialCamera) {
|
|
154
|
+
// do nothing, passed as part of the InitialProps
|
|
155
|
+
}
|
|
363
156
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
157
|
+
@ReactProp(name = "mapType")
|
|
158
|
+
public void setMapType(MapView view, @Nullable String mapType) {
|
|
159
|
+
int typeId = MAP_TYPES.get(mapType);
|
|
160
|
+
view.map.setMapType(typeId);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@ReactProp(name = "customMapStyleString")
|
|
164
|
+
public void setMapStyle(MapView view, @Nullable String customMapStyleString) {
|
|
165
|
+
view.setMapStyle(customMapStyleString);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@ReactProp(name = "mapPadding")
|
|
169
|
+
public void setMapPadding(MapView view, @Nullable ReadableMap padding) {
|
|
170
|
+
int left = 0;
|
|
171
|
+
int top = 0;
|
|
172
|
+
int right = 0;
|
|
173
|
+
int bottom = 0;
|
|
174
|
+
double density = (double) view.getResources().getDisplayMetrics().density;
|
|
175
|
+
|
|
176
|
+
if (padding != null) {
|
|
177
|
+
if (padding.hasKey("left")) {
|
|
178
|
+
left = (int) (padding.getDouble("left") * density);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (padding.hasKey("top")) {
|
|
182
|
+
top = (int) (padding.getDouble("top") * density);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (padding.hasKey("right")) {
|
|
186
|
+
right = (int) (padding.getDouble("right") * density);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (padding.hasKey("bottom")) {
|
|
190
|
+
bottom = (int) (padding.getDouble("bottom") * density);
|
|
191
|
+
}
|
|
367
192
|
}
|
|
368
|
-
view.fitToCoordinates(args.getArray(0), args.getMap(1), args.getBoolean(2));
|
|
369
|
-
break;
|
|
370
193
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
194
|
+
view.applyBaseMapPadding(left, top, right, bottom);
|
|
195
|
+
view.map.setPadding(left, top, right, bottom);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@ReactProp(name = "showsUserLocation", defaultBoolean = false)
|
|
199
|
+
public void setShowsUserLocation(MapView view, boolean showUserLocation) {
|
|
200
|
+
view.setShowsUserLocation(showUserLocation);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@ReactProp(name = "userLocationPriority")
|
|
204
|
+
public void setUserLocationPriority(MapView view, @Nullable String accuracy) {
|
|
205
|
+
view.setUserLocationPriority(MY_LOCATION_PRIORITY.get(accuracy));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@ReactProp(name = "userLocationUpdateInterval", defaultInt = 5000)
|
|
209
|
+
public void setUserLocationUpdateInterval(MapView view, int updateInterval) {
|
|
210
|
+
view.setUserLocationUpdateInterval(updateInterval);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@ReactProp(name = "userLocationFastestInterval", defaultInt = 5000)
|
|
214
|
+
public void setUserLocationFastestInterval(MapView view, int fastestInterval) {
|
|
215
|
+
view.setUserLocationFastestInterval(fastestInterval);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@ReactProp(name = "showsMyLocationButton", defaultBoolean = true)
|
|
219
|
+
public void setShowsMyLocationButton(MapView view, boolean showMyLocationButton) {
|
|
220
|
+
view.setShowsMyLocationButton(showMyLocationButton);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@ReactProp(name = "toolbarEnabled", defaultBoolean = true)
|
|
224
|
+
public void setToolbarEnabled(MapView view, boolean toolbarEnabled) {
|
|
225
|
+
view.setToolbarEnabled(toolbarEnabled);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// This is a private prop to improve performance of panDrag by disabling it when the callback
|
|
229
|
+
// is not set
|
|
230
|
+
@ReactProp(name = "handlePanDrag", defaultBoolean = false)
|
|
231
|
+
public void setHandlePanDrag(MapView view, boolean handlePanDrag) {
|
|
232
|
+
view.setHandlePanDrag(handlePanDrag);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@ReactProp(name = "showsTraffic", defaultBoolean = false)
|
|
236
|
+
public void setShowTraffic(MapView view, boolean showTraffic) {
|
|
237
|
+
view.map.setTrafficEnabled(showTraffic);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@ReactProp(name = "showsBuildings", defaultBoolean = false)
|
|
241
|
+
public void setShowBuildings(MapView view, boolean showBuildings) {
|
|
242
|
+
view.map.setBuildingsEnabled(showBuildings);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@ReactProp(name = "showsIndoors", defaultBoolean = false)
|
|
246
|
+
public void setShowIndoors(MapView view, boolean showIndoors) {
|
|
247
|
+
view.map.setIndoorEnabled(showIndoors);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
@ReactProp(name = "showsIndoorLevelPicker", defaultBoolean = false)
|
|
251
|
+
public void setShowsIndoorLevelPicker(MapView view, boolean showsIndoorLevelPicker) {
|
|
252
|
+
view.map.getUiSettings().setIndoorLevelPickerEnabled(showsIndoorLevelPicker);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@ReactProp(name = "showsCompass", defaultBoolean = false)
|
|
256
|
+
public void setShowsCompass(MapView view, boolean showsCompass) {
|
|
257
|
+
view.map.getUiSettings().setCompassEnabled(showsCompass);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@ReactProp(name = "scrollEnabled", defaultBoolean = false)
|
|
261
|
+
public void setScrollEnabled(MapView view, boolean scrollEnabled) {
|
|
262
|
+
view.map.getUiSettings().setScrollGesturesEnabled(scrollEnabled);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@ReactProp(name = "zoomEnabled", defaultBoolean = false)
|
|
266
|
+
public void setZoomEnabled(MapView view, boolean zoomEnabled) {
|
|
267
|
+
view.map.getUiSettings().setZoomGesturesEnabled(zoomEnabled);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@ReactProp(name = "zoomControlEnabled", defaultBoolean = true)
|
|
271
|
+
public void setZoomControlEnabled(MapView view, boolean zoomControlEnabled) {
|
|
272
|
+
view.map.getUiSettings().setZoomControlsEnabled(zoomControlEnabled);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@ReactProp(name = "rotateEnabled", defaultBoolean = false)
|
|
276
|
+
public void setRotateEnabled(MapView view, boolean rotateEnabled) {
|
|
277
|
+
view.map.getUiSettings().setRotateGesturesEnabled(rotateEnabled);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@ReactProp(name = "scrollDuringRotateOrZoomEnabled", defaultBoolean = true)
|
|
281
|
+
public void setScrollDuringRotateOrZoomEnabled(MapView view, boolean scrollDuringRotateOrZoomEnabled) {
|
|
282
|
+
view.map.getUiSettings().setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringRotateOrZoomEnabled);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@ReactProp(name = "cacheEnabled", defaultBoolean = false)
|
|
286
|
+
public void setCacheEnabled(MapView view, boolean cacheEnabled) {
|
|
287
|
+
view.setCacheEnabled(cacheEnabled);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@ReactProp(name = "loadingEnabled", defaultBoolean = false)
|
|
291
|
+
public void setLoadingEnabled(MapView view, boolean loadingEnabled) {
|
|
292
|
+
view.enableMapLoading(loadingEnabled);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
@ReactProp(name = "moveOnMarkerPress", defaultBoolean = true)
|
|
296
|
+
public void setMoveOnMarkerPress(MapView view, boolean moveOnPress) {
|
|
297
|
+
view.setMoveOnMarkerPress(moveOnPress);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@ReactProp(name = "loadingBackgroundColor", customType = "Color")
|
|
301
|
+
public void setLoadingBackgroundColor(MapView view, @Nullable Integer loadingBackgroundColor) {
|
|
302
|
+
view.setLoadingBackgroundColor(loadingBackgroundColor);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@ReactProp(name = "loadingIndicatorColor", customType = "Color")
|
|
306
|
+
public void setLoadingIndicatorColor(MapView view, @Nullable Integer loadingIndicatorColor) {
|
|
307
|
+
view.setLoadingIndicatorColor(loadingIndicatorColor);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@ReactProp(name = "pitchEnabled", defaultBoolean = false)
|
|
311
|
+
public void setPitchEnabled(MapView view, boolean pitchEnabled) {
|
|
312
|
+
view.map.getUiSettings().setTiltGesturesEnabled(pitchEnabled);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
@ReactProp(name = "minZoomLevel")
|
|
316
|
+
public void setMinZoomLevel(MapView view, float minZoomLevel) {
|
|
317
|
+
view.map.setMinZoomPreference(minZoomLevel);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@ReactProp(name = "maxZoomLevel")
|
|
321
|
+
public void setMaxZoomLevel(MapView view, float maxZoomLevel) {
|
|
322
|
+
view.map.setMaxZoomPreference(maxZoomLevel);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@ReactProp(name = "kmlSrc")
|
|
326
|
+
public void setKmlSrc(MapView view, String kmlUrl) {
|
|
327
|
+
if (kmlUrl != null) {
|
|
328
|
+
view.setKmlSrc(kmlUrl);
|
|
374
329
|
}
|
|
375
|
-
|
|
376
|
-
break;
|
|
330
|
+
}
|
|
377
331
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
332
|
+
@Override
|
|
333
|
+
public void receiveCommand(@NonNull MapView view, String commandId, @Nullable ReadableArray args) {
|
|
334
|
+
int duration;
|
|
335
|
+
double lat;
|
|
336
|
+
double lng;
|
|
337
|
+
double lngDelta;
|
|
338
|
+
double latDelta;
|
|
339
|
+
ReadableMap region;
|
|
340
|
+
ReadableMap camera;
|
|
341
|
+
|
|
342
|
+
switch (commandId) {
|
|
343
|
+
case "setCamera":
|
|
344
|
+
if (args == null) {
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
camera = args.getMap(0);
|
|
348
|
+
view.animateToCamera(camera, 0);
|
|
349
|
+
break;
|
|
350
|
+
|
|
351
|
+
case "animateCamera":
|
|
352
|
+
if (args == null) {
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
camera = args.getMap(0);
|
|
356
|
+
duration = args.getInt(1);
|
|
357
|
+
view.animateToCamera(camera, duration);
|
|
358
|
+
break;
|
|
359
|
+
|
|
360
|
+
case "animateToRegion":
|
|
361
|
+
if (args == null) {
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
region = args.getMap(0);
|
|
365
|
+
duration = args.getInt(1);
|
|
366
|
+
lng = region.getDouble("longitude");
|
|
367
|
+
lat = region.getDouble("latitude");
|
|
368
|
+
lngDelta = region.getDouble("longitudeDelta");
|
|
369
|
+
latDelta = region.getDouble("latitudeDelta");
|
|
370
|
+
LatLngBounds bounds = new LatLngBounds(
|
|
371
|
+
new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
|
|
372
|
+
new LatLng(lat + latDelta / 2, lng + lngDelta / 2) // northeast
|
|
373
|
+
);
|
|
374
|
+
view.animateToRegion(bounds, duration);
|
|
375
|
+
break;
|
|
376
|
+
|
|
377
|
+
case "fitToElements":
|
|
378
|
+
if (args == null) {
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
view.fitToElements(args.getMap(0), args.getBoolean(1));
|
|
382
|
+
break;
|
|
383
|
+
|
|
384
|
+
case "fitToSuppliedMarkers":
|
|
385
|
+
if (args == null) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
view.fitToSuppliedMarkers(args.getArray(0), args.getMap(1), args.getBoolean(2));
|
|
389
|
+
break;
|
|
390
|
+
|
|
391
|
+
case "fitToCoordinates":
|
|
392
|
+
if (args == null) {
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
view.fitToCoordinates(args.getArray(0), args.getMap(1), args.getBoolean(2));
|
|
396
|
+
break;
|
|
397
|
+
|
|
398
|
+
case "setMapBoundaries":
|
|
399
|
+
if (args == null) {
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
view.setMapBoundaries(args.getMap(0), args.getMap(1));
|
|
403
|
+
break;
|
|
404
|
+
|
|
405
|
+
case "setIndoorActiveLevelIndex":
|
|
406
|
+
if (args == null) {
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
view.setIndoorActiveLevelIndex(args.getInt(0));
|
|
410
|
+
break;
|
|
381
411
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@Override
|
|
415
|
+
@Nullable
|
|
416
|
+
public Map getExportedCustomDirectEventTypeConstants() {
|
|
417
|
+
Map<String, Map<String, String>> map = MapBuilder.of(
|
|
418
|
+
"onMapReady", MapBuilder.of("registrationName", "onMapReady"),
|
|
419
|
+
"onPress", MapBuilder.of("registrationName", "onPress"),
|
|
420
|
+
"onLongPress", MapBuilder.of("registrationName", "onLongPress"),
|
|
421
|
+
"onMarkerPress", MapBuilder.of("registrationName", "onMarkerPress"),
|
|
422
|
+
"onCalloutPress", MapBuilder.of("registrationName", "onCalloutPress")
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
map.putAll(MapBuilder.of(
|
|
426
|
+
"onUserLocationChange", MapBuilder.of("registrationName", "onUserLocationChange"),
|
|
427
|
+
"onMarkerDragStart", MapBuilder.of("registrationName", "onMarkerDragStart"),
|
|
428
|
+
"onMarkerDrag", MapBuilder.of("registrationName", "onMarkerDrag"),
|
|
429
|
+
"onMarkerDragEnd", MapBuilder.of("registrationName", "onMarkerDragEnd"),
|
|
430
|
+
"onPanDrag", MapBuilder.of("registrationName", "onPanDrag"),
|
|
431
|
+
"onKmlReady", MapBuilder.of("registrationName", "onKmlReady"),
|
|
432
|
+
"onPoiClick", MapBuilder.of("registrationName", "onPoiClick")
|
|
433
|
+
));
|
|
434
|
+
|
|
435
|
+
map.putAll(MapBuilder.of(
|
|
436
|
+
"onIndoorLevelActivated", MapBuilder.of("registrationName", "onIndoorLevelActivated"),
|
|
437
|
+
"onIndoorBuildingFocused", MapBuilder.of("registrationName", "onIndoorBuildingFocused"),
|
|
438
|
+
"onDoublePress", MapBuilder.of("registrationName", "onDoublePress"),
|
|
439
|
+
"onMapLoaded", MapBuilder.of("registrationName", "onMapLoaded"),
|
|
440
|
+
"onMarkerSelect", MapBuilder.of("registrationName", "onMarkerSelect"),
|
|
441
|
+
"onMarkerDeselect", MapBuilder.of("registrationName", "onMarkerDeselect")
|
|
442
|
+
));
|
|
443
|
+
|
|
444
|
+
return map;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
@Override
|
|
448
|
+
public LayoutShadowNode createShadowNodeInstance() {
|
|
449
|
+
// A custom shadow node is needed in order to pass back the width/height of the map to the
|
|
450
|
+
// view manager so that it can start applying camera moves with bounds.
|
|
451
|
+
return new SizeReportingShadowNode();
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
@Override
|
|
455
|
+
public void addView(MapView parent, View child, int index) {
|
|
456
|
+
parent.addFeature(child, index);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
@Override
|
|
460
|
+
public int getChildCount(MapView view) {
|
|
461
|
+
return view.getFeatureCount();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
@Override
|
|
465
|
+
public View getChildAt(MapView view, int index) {
|
|
466
|
+
return view.getFeatureAt(index);
|
|
467
|
+
}
|
|
397
468
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
@Override
|
|
421
|
-
public LayoutShadowNode createShadowNodeInstance() {
|
|
422
|
-
// A custom shadow node is needed in order to pass back the width/height of the map to the
|
|
423
|
-
// view manager so that it can start applying camera moves with bounds.
|
|
424
|
-
return new SizeReportingShadowNode();
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
@Override
|
|
428
|
-
public void addView(MapView parent, View child, int index) {
|
|
429
|
-
parent.addFeature(child, index);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
@Override
|
|
433
|
-
public int getChildCount(MapView view) {
|
|
434
|
-
return view.getFeatureCount();
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
@Override
|
|
438
|
-
public View getChildAt(MapView view, int index) {
|
|
439
|
-
return view.getFeatureAt(index);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
@Override
|
|
443
|
-
public void removeViewAt(MapView parent, int index) {
|
|
444
|
-
parent.removeFeatureAt(index);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
@Override
|
|
448
|
-
public void updateExtraData(MapView view, Object extraData) {
|
|
449
|
-
view.updateExtraData(extraData);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
void pushEvent(ThemedReactContext context, View view, String name, WritableMap data) {
|
|
453
|
-
context
|
|
454
|
-
.getReactApplicationContext()
|
|
455
|
-
.getJSModule(RCTEventEmitter.class)
|
|
456
|
-
.receiveEvent(view.getId(), name, data);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
@Override
|
|
460
|
-
public void onDropViewInstance(MapView view) {
|
|
461
|
-
view.doDestroy();
|
|
462
|
-
super.onDropViewInstance(view);
|
|
463
|
-
}
|
|
469
|
+
@Override
|
|
470
|
+
public void removeViewAt(MapView parent, int index) {
|
|
471
|
+
parent.removeFeatureAt(index);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
@Override
|
|
475
|
+
public void updateExtraData(MapView view, Object extraData) {
|
|
476
|
+
view.updateExtraData(extraData);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
void pushEvent(ThemedReactContext context, View view, String name, WritableMap data) {
|
|
480
|
+
context
|
|
481
|
+
.getReactApplicationContext()
|
|
482
|
+
.getJSModule(RCTEventEmitter.class)
|
|
483
|
+
.receiveEvent(view.getId(), name, data);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
@Override
|
|
487
|
+
public void onDropViewInstance(MapView view) {
|
|
488
|
+
view.doDestroy();
|
|
489
|
+
super.onDropViewInstance(view);
|
|
490
|
+
}
|
|
464
491
|
|
|
465
492
|
}
|