react-native-maps 1.21.0-alpha.52 → 1.21.0-alpha.54
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/RNMapsMarkerManagerDelegate.java +103 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +77 -47
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +176 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +25 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +5 -2
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +53 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +122 -3
- package/lib/MapMarker.js +1 -1
- package/lib/decorateMapComponent.js +1 -2
- package/lib/specs/NativeComponentMarker.js +1 -3
- package/package.json +1 -1
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ColorPropConverter;
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
16
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
17
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
18
|
+
import com.facebook.react.uimanager.BaseViewManagerInterface;
|
|
19
|
+
|
|
20
|
+
public class RNMapsMarkerManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNMapsMarkerManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
21
|
+
public RNMapsMarkerManagerDelegate(U viewManager) {
|
|
22
|
+
super(viewManager);
|
|
23
|
+
}
|
|
24
|
+
@Override
|
|
25
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
26
|
+
switch (propName) {
|
|
27
|
+
case "anchor":
|
|
28
|
+
mViewManager.setAnchor(view, (ReadableMap) value);
|
|
29
|
+
break;
|
|
30
|
+
case "calloutAnchor":
|
|
31
|
+
mViewManager.setCalloutAnchor(view, (ReadableMap) value);
|
|
32
|
+
break;
|
|
33
|
+
case "image":
|
|
34
|
+
mViewManager.setImage(view, (ReadableMap) value);
|
|
35
|
+
break;
|
|
36
|
+
case "calloutOffset":
|
|
37
|
+
mViewManager.setCalloutOffset(view, (ReadableMap) value);
|
|
38
|
+
break;
|
|
39
|
+
case "displayPriority":
|
|
40
|
+
mViewManager.setDisplayPriority(view, (String) value);
|
|
41
|
+
break;
|
|
42
|
+
case "coordinate":
|
|
43
|
+
mViewManager.setCoordinate(view, (ReadableMap) value);
|
|
44
|
+
break;
|
|
45
|
+
case "description":
|
|
46
|
+
mViewManager.setDescription(view, value == null ? null : (String) value);
|
|
47
|
+
break;
|
|
48
|
+
case "draggable":
|
|
49
|
+
mViewManager.setDraggable(view, value == null ? false : (boolean) value);
|
|
50
|
+
break;
|
|
51
|
+
case "title":
|
|
52
|
+
mViewManager.setTitle(view, value == null ? null : (String) value);
|
|
53
|
+
break;
|
|
54
|
+
case "identifier":
|
|
55
|
+
mViewManager.setIdentifier(view, value == null ? null : (String) value);
|
|
56
|
+
break;
|
|
57
|
+
case "isPreselected":
|
|
58
|
+
mViewManager.setIsPreselected(view, value == null ? false : (boolean) value);
|
|
59
|
+
break;
|
|
60
|
+
case "opacity":
|
|
61
|
+
mViewManager.setOpacity(view, value == null ? 1f : ((Double) value).doubleValue());
|
|
62
|
+
break;
|
|
63
|
+
case "pinColor":
|
|
64
|
+
mViewManager.setPinColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
65
|
+
break;
|
|
66
|
+
case "titleVisibility":
|
|
67
|
+
mViewManager.setTitleVisibility(view, (String) value);
|
|
68
|
+
break;
|
|
69
|
+
case "subtitleVisibility":
|
|
70
|
+
mViewManager.setSubtitleVisibility(view, (String) value);
|
|
71
|
+
break;
|
|
72
|
+
case "useLegacyPinView":
|
|
73
|
+
mViewManager.setUseLegacyPinView(view, value == null ? false : (boolean) value);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
super.setProperty(view, propName, value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
|
82
|
+
switch (commandName) {
|
|
83
|
+
case "animateToCoordinates":
|
|
84
|
+
mViewManager.animateToCoordinates(view, args.getDouble(0), args.getDouble(1), args.getInt(2));
|
|
85
|
+
break;
|
|
86
|
+
case "setCoordinates":
|
|
87
|
+
mViewManager.setCoordinates(view, args.getDouble(0), args.getDouble(1));
|
|
88
|
+
break;
|
|
89
|
+
case "showCallout":
|
|
90
|
+
mViewManager.showCallout(view);
|
|
91
|
+
break;
|
|
92
|
+
case "hideCallout":
|
|
93
|
+
mViewManager.hideCallout(view);
|
|
94
|
+
break;
|
|
95
|
+
case "redrawCallout":
|
|
96
|
+
mViewManager.redrawCallout(view);
|
|
97
|
+
break;
|
|
98
|
+
case "redraw":
|
|
99
|
+
mViewManager.redraw(view);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
15
|
+
|
|
16
|
+
public interface RNMapsMarkerManagerInterface<T extends View> {
|
|
17
|
+
void setAnchor(T view, @Nullable ReadableMap value);
|
|
18
|
+
void setCalloutAnchor(T view, @Nullable ReadableMap value);
|
|
19
|
+
void setImage(T view, @Nullable ReadableMap value);
|
|
20
|
+
void setCalloutOffset(T view, @Nullable ReadableMap value);
|
|
21
|
+
void setDisplayPriority(T view, @Nullable String value);
|
|
22
|
+
void setCoordinate(T view, @Nullable ReadableMap value);
|
|
23
|
+
void setDescription(T view, @Nullable String value);
|
|
24
|
+
void setDraggable(T view, boolean value);
|
|
25
|
+
void setTitle(T view, @Nullable String value);
|
|
26
|
+
void setIdentifier(T view, @Nullable String value);
|
|
27
|
+
void setIsPreselected(T view, boolean value);
|
|
28
|
+
void setOpacity(T view, double value);
|
|
29
|
+
void setPinColor(T view, @Nullable Integer value);
|
|
30
|
+
void setTitleVisibility(T view, @Nullable String value);
|
|
31
|
+
void setSubtitleVisibility(T view, @Nullable String value);
|
|
32
|
+
void setUseLegacyPinView(T view, boolean value);
|
|
33
|
+
void animateToCoordinates(T view, double latitude, double longitude, int duration);
|
|
34
|
+
void setCoordinates(T view, double latitude, double longitude);
|
|
35
|
+
void showCallout(T view);
|
|
36
|
+
void hideCallout(T view);
|
|
37
|
+
void redrawCallout(T view);
|
|
38
|
+
void redraw(T view);
|
|
39
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
package com.rnmaps.fabric;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import static com.rnmaps.maps.MapManager.MY_LOCATION_PRIORITY;
|
|
5
|
+
|
|
6
|
+
import android.view.View;
|
|
7
|
+
|
|
4
8
|
import androidx.annotation.Nullable;
|
|
5
9
|
|
|
6
10
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.bridge.ReactContext;
|
|
8
11
|
import com.facebook.react.bridge.ReadableMap;
|
|
9
12
|
import com.facebook.react.module.annotations.ReactModule;
|
|
10
|
-
import com.facebook.react.uimanager.SimpleViewManager;
|
|
11
13
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
12
14
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
13
15
|
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
14
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
15
16
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerInterface;
|
|
16
17
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerDelegate;
|
|
17
18
|
import com.google.android.gms.maps.GoogleMap;
|
|
18
19
|
import com.google.android.gms.maps.GoogleMapOptions;
|
|
19
20
|
import com.rnmaps.maps.MapView;
|
|
20
21
|
|
|
21
|
-
import java.util.HashMap;
|
|
22
22
|
import java.util.Map;
|
|
23
23
|
|
|
24
24
|
@ReactModule(name = MapViewManager.REACT_CLASS)
|
|
25
25
|
public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsMapViewManagerInterface<MapView> {
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
public MapViewManager(ReactApplicationContext context){
|
|
28
|
+
public MapViewManager(ReactApplicationContext context) {
|
|
29
29
|
super(context);
|
|
30
30
|
}
|
|
31
31
|
private GoogleMapOptions options;
|
|
@@ -74,12 +74,12 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
74
74
|
|
|
75
75
|
@Override
|
|
76
76
|
public void setCompassOffset(MapView view, @Nullable ReadableMap value) {
|
|
77
|
-
|
|
77
|
+
// not supported
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
@Override
|
|
81
81
|
public void setFollowsUserLocation(MapView view, boolean value) {
|
|
82
|
-
|
|
82
|
+
// not supported
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
@Override
|
|
@@ -104,7 +104,7 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
104
104
|
|
|
105
105
|
@Override
|
|
106
106
|
public void setLegalLabelInsets(MapView view, @Nullable ReadableMap value) {
|
|
107
|
-
|
|
107
|
+
// not supported
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
@Override
|
|
@@ -124,68 +124,98 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
124
124
|
|
|
125
125
|
@Override
|
|
126
126
|
public void setLoadingBackgroundColor(MapView view, @Nullable Integer value) {
|
|
127
|
-
|
|
127
|
+
view.setLoadingBackgroundColor(value);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
@Override
|
|
131
131
|
public void setLoadingEnabled(MapView view, boolean value) {
|
|
132
|
-
|
|
132
|
+
view.setLoadingEnabled(value);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
@Override
|
|
136
136
|
public void setLoadingIndicatorColor(MapView view, @Nullable Integer value) {
|
|
137
|
-
|
|
137
|
+
view.setLoadingIndicatorColor(value);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
@Override
|
|
141
|
-
public void setMapPadding(MapView view, @Nullable ReadableMap
|
|
141
|
+
public void setMapPadding(MapView view, @Nullable ReadableMap padding) {
|
|
142
|
+
int left = 0;
|
|
143
|
+
int top = 0;
|
|
144
|
+
int right = 0;
|
|
145
|
+
int bottom = 0;
|
|
146
|
+
double density = (double) view.getResources().getDisplayMetrics().density;
|
|
147
|
+
|
|
148
|
+
if (padding != null) {
|
|
149
|
+
if (padding.hasKey("left")) {
|
|
150
|
+
left = (int) (padding.getDouble("left") * density);
|
|
151
|
+
}
|
|
142
152
|
|
|
153
|
+
if (padding.hasKey("top")) {
|
|
154
|
+
top = (int) (padding.getDouble("top") * density);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (padding.hasKey("right")) {
|
|
158
|
+
right = (int) (padding.getDouble("right") * density);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (padding.hasKey("bottom")) {
|
|
162
|
+
bottom = (int) (padding.getDouble("bottom") * density);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
view.applyBaseMapPadding(left, top, right, bottom);
|
|
167
|
+
view.map.setPadding(left, top, right, bottom);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@Override
|
|
171
|
+
public void addView(MapView parent, View child, int index) {
|
|
172
|
+
parent.addFeature(child, index);
|
|
143
173
|
}
|
|
144
174
|
|
|
145
175
|
@Override
|
|
146
176
|
public void setMapType(MapView view, @Nullable String value) {
|
|
147
177
|
//hybrid | none | satellite | standard | terrain
|
|
148
|
-
if ("hybrid".equals(value)){
|
|
178
|
+
if ("hybrid".equals(value)) {
|
|
149
179
|
view.setMapType(GoogleMap.MAP_TYPE_HYBRID);
|
|
150
|
-
} else if ("none".equals(value)){
|
|
180
|
+
} else if ("none".equals(value)) {
|
|
151
181
|
view.setMapType(GoogleMap.MAP_TYPE_NONE);
|
|
152
|
-
} else if ("satellite".equals(value)){
|
|
182
|
+
} else if ("satellite".equals(value)) {
|
|
153
183
|
view.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
|
|
154
|
-
} else if ("standard".equals(value)){
|
|
184
|
+
} else if ("standard".equals(value)) {
|
|
155
185
|
view.setMapType(GoogleMap.MAP_TYPE_NORMAL);
|
|
156
|
-
} else if ("terrain".equals(value)){
|
|
186
|
+
} else if ("terrain".equals(value)) {
|
|
157
187
|
view.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
|
|
158
188
|
}
|
|
159
189
|
}
|
|
160
190
|
|
|
161
191
|
@Override
|
|
162
192
|
public void setMaxDelta(MapView view, double value) {
|
|
163
|
-
|
|
193
|
+
// not supported
|
|
164
194
|
}
|
|
165
195
|
|
|
166
196
|
@Override
|
|
167
197
|
public void setMaxZoom(MapView view, float value) {
|
|
168
|
-
|
|
198
|
+
view.setMaxZoomLevel(value);
|
|
169
199
|
}
|
|
170
200
|
|
|
171
201
|
@Override
|
|
172
202
|
public void setMinDelta(MapView view, double value) {
|
|
173
|
-
|
|
203
|
+
// not supported
|
|
174
204
|
}
|
|
175
205
|
|
|
176
206
|
@Override
|
|
177
207
|
public void setMinZoom(MapView view, float value) {
|
|
178
|
-
|
|
208
|
+
view.setMinZoomLevel(value);
|
|
179
209
|
}
|
|
180
210
|
|
|
181
211
|
@Override
|
|
182
212
|
public void setMoveOnMarkerPress(MapView view, boolean value) {
|
|
183
|
-
|
|
213
|
+
view.setMoveOnMarkerPress(value);
|
|
184
214
|
}
|
|
185
215
|
|
|
186
216
|
@Override
|
|
187
217
|
public void setHandlePanDrag(MapView view, boolean value) {
|
|
188
|
-
|
|
218
|
+
view.setHandlePanDrag(value);
|
|
189
219
|
}
|
|
190
220
|
|
|
191
221
|
@Override
|
|
@@ -195,27 +225,27 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
195
225
|
|
|
196
226
|
@Override
|
|
197
227
|
public void setPitchEnabled(MapView view, boolean value) {
|
|
198
|
-
|
|
228
|
+
view.setPitchEnabled(value);
|
|
199
229
|
}
|
|
200
230
|
|
|
201
231
|
@Override
|
|
202
232
|
public void setRegion(MapView view, @Nullable ReadableMap value) {
|
|
203
|
-
|
|
233
|
+
view.setRegion(value);
|
|
204
234
|
}
|
|
205
235
|
|
|
206
236
|
@Override
|
|
207
237
|
public void setRotateEnabled(MapView view, boolean value) {
|
|
208
|
-
|
|
238
|
+
view.setRotateEnabled(value);
|
|
209
239
|
}
|
|
210
240
|
|
|
211
241
|
@Override
|
|
212
242
|
public void setScrollDuringRotateOrZoomEnabled(MapView view, boolean value) {
|
|
213
|
-
|
|
243
|
+
view.setScrollDuringRotateOrZoomEnabled(value);
|
|
214
244
|
}
|
|
215
245
|
|
|
216
246
|
@Override
|
|
217
247
|
public void setScrollEnabled(MapView view, boolean value) {
|
|
218
|
-
|
|
248
|
+
view.setScrollEnabled(value);
|
|
219
249
|
}
|
|
220
250
|
|
|
221
251
|
@Override
|
|
@@ -225,92 +255,92 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
225
255
|
|
|
226
256
|
@Override
|
|
227
257
|
public void setShowsCompass(MapView view, boolean value) {
|
|
228
|
-
|
|
258
|
+
view.setShowsCompass(value);
|
|
229
259
|
}
|
|
230
260
|
|
|
231
261
|
@Override
|
|
232
262
|
public void setShowsIndoorLevelPicker(MapView view, boolean value) {
|
|
233
|
-
|
|
263
|
+
view.setShowsIndoorLevelPicker(value);
|
|
234
264
|
}
|
|
235
265
|
|
|
236
266
|
@Override
|
|
237
267
|
public void setShowsIndoors(MapView view, boolean value) {
|
|
238
|
-
|
|
268
|
+
view.setShowIndoors(value);
|
|
239
269
|
}
|
|
240
270
|
|
|
241
271
|
@Override
|
|
242
272
|
public void setShowsMyLocationButton(MapView view, boolean value) {
|
|
243
|
-
|
|
273
|
+
view.setShowsMyLocationButton(value);
|
|
244
274
|
}
|
|
245
275
|
|
|
246
276
|
@Override
|
|
247
277
|
public void setShowsScale(MapView view, boolean value) {
|
|
248
|
-
|
|
278
|
+
// not supported
|
|
249
279
|
}
|
|
250
280
|
|
|
251
281
|
@Override
|
|
252
282
|
public void setShowsUserLocation(MapView view, boolean value) {
|
|
253
|
-
|
|
283
|
+
view.setShowsUserLocation(value);
|
|
254
284
|
}
|
|
255
285
|
|
|
256
286
|
@Override
|
|
257
287
|
public void setTintColor(MapView view, @Nullable Integer value) {
|
|
258
|
-
|
|
288
|
+
// not supported
|
|
259
289
|
}
|
|
260
290
|
|
|
261
291
|
@Override
|
|
262
292
|
public void setToolbarEnabled(MapView view, boolean value) {
|
|
263
|
-
|
|
293
|
+
view.setToolbarEnabled(value);
|
|
264
294
|
}
|
|
265
295
|
|
|
266
296
|
@Override
|
|
267
297
|
public void setUserInterfaceStyle(MapView view, @Nullable String value) {
|
|
268
|
-
|
|
298
|
+
// not supported
|
|
269
299
|
}
|
|
270
300
|
|
|
271
301
|
@Override
|
|
272
302
|
public void setUserLocationAnnotationTitle(MapView view, @Nullable String value) {
|
|
273
|
-
|
|
303
|
+
// not supported
|
|
274
304
|
}
|
|
275
305
|
|
|
276
306
|
@Override
|
|
277
307
|
public void setUserLocationCalloutEnabled(MapView view, boolean value) {
|
|
278
|
-
|
|
308
|
+
// not supported
|
|
279
309
|
}
|
|
280
310
|
|
|
281
311
|
@Override
|
|
282
312
|
public void setUserLocationFastestInterval(MapView view, int value) {
|
|
283
|
-
|
|
313
|
+
view.setUserLocationFastestInterval(value);
|
|
284
314
|
}
|
|
285
315
|
|
|
286
316
|
@Override
|
|
287
317
|
public void setUserLocationPriority(MapView view, @Nullable String value) {
|
|
288
|
-
|
|
318
|
+
view.setUserLocationPriority(MY_LOCATION_PRIORITY.get(value));
|
|
289
319
|
}
|
|
290
320
|
|
|
291
321
|
@Override
|
|
292
322
|
public void setUserLocationUpdateInterval(MapView view, int value) {
|
|
293
|
-
|
|
323
|
+
view.setUserLocationUpdateInterval(value);
|
|
294
324
|
}
|
|
295
325
|
|
|
296
326
|
@Override
|
|
297
327
|
public void setZoomControlEnabled(MapView view, boolean value) {
|
|
298
|
-
|
|
328
|
+
view.setZoomControlEnabled(value);
|
|
299
329
|
}
|
|
300
330
|
|
|
301
331
|
@Override
|
|
302
332
|
public void setZoomEnabled(MapView view, boolean value) {
|
|
303
|
-
|
|
333
|
+
view.setZoomEnabled(value);
|
|
304
334
|
}
|
|
305
335
|
|
|
306
336
|
@Override
|
|
307
337
|
public void setZoomTapEnabled(MapView view, boolean value) {
|
|
308
|
-
|
|
338
|
+
// not supported
|
|
309
339
|
}
|
|
310
340
|
|
|
311
341
|
@Override
|
|
312
342
|
public void setCameraZoomRange(MapView view, @Nullable ReadableMap value) {
|
|
313
|
-
|
|
343
|
+
// not supported
|
|
314
344
|
}
|
|
315
345
|
|
|
316
346
|
@Override
|
|
@@ -342,4 +372,4 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
342
372
|
public void fitToCoordinates(MapView view, String coordinatesJSON, String edgePaddingJSON, boolean animated) {
|
|
343
373
|
|
|
344
374
|
}
|
|
345
|
-
}
|
|
375
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
package com.rnmaps.fabric;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
10
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
11
|
+
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
12
|
+
import com.facebook.react.viewmanagers.RNMapsMapViewManagerDelegate;
|
|
13
|
+
import com.facebook.react.viewmanagers.RNMapsMapViewManagerInterface;
|
|
14
|
+
import com.facebook.react.viewmanagers.RNMapsMarkerManagerDelegate;
|
|
15
|
+
import com.facebook.react.viewmanagers.RNMapsMarkerManagerInterface;
|
|
16
|
+
import com.google.android.gms.maps.GoogleMap;
|
|
17
|
+
import com.google.android.gms.maps.GoogleMapOptions;
|
|
18
|
+
import com.google.android.gms.maps.model.LatLng;
|
|
19
|
+
import com.rnmaps.maps.MapMarker;
|
|
20
|
+
import com.rnmaps.maps.MapView;
|
|
21
|
+
|
|
22
|
+
import java.util.Map;
|
|
23
|
+
|
|
24
|
+
@ReactModule(name = MarkerManager.REACT_CLASS)
|
|
25
|
+
public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMapsMarkerManagerInterface<MapMarker> {
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
public MarkerManager(ReactApplicationContext context){
|
|
29
|
+
super(context);
|
|
30
|
+
}
|
|
31
|
+
private GoogleMapOptions options;
|
|
32
|
+
private final RNMapsMarkerManagerDelegate<MapMarker, MarkerManager> delegate =
|
|
33
|
+
new RNMapsMarkerManagerDelegate<>(this);
|
|
34
|
+
|
|
35
|
+
@Override
|
|
36
|
+
public ViewManagerDelegate<MapMarker> getDelegate() {
|
|
37
|
+
return delegate;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
public String getName() {
|
|
42
|
+
return REACT_CLASS;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Override
|
|
46
|
+
public MapMarker createViewInstance(ThemedReactContext context) {
|
|
47
|
+
return new MapMarker(context, null);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
public static final String REACT_CLASS = "RNMapsMarker";
|
|
52
|
+
|
|
53
|
+
@Nullable
|
|
54
|
+
@Override
|
|
55
|
+
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
56
|
+
return MapMarker.getExportedCustomBubblingEventTypeConstants();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Nullable
|
|
60
|
+
@Override
|
|
61
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
62
|
+
return MapMarker.getExportedCustomDirectEventTypeConstants();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public void setAnchor(MapMarker view, @Nullable ReadableMap map) {
|
|
67
|
+
double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
|
|
68
|
+
double y = map != null && map.hasKey("y") ? map.getDouble("y") : 1.0;
|
|
69
|
+
view.setAnchor(x, y);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Override
|
|
73
|
+
public void setCalloutAnchor(MapMarker view, @Nullable ReadableMap value) {
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Override
|
|
78
|
+
public void setImage(MapMarker view, @Nullable ReadableMap value) {
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Override
|
|
83
|
+
public void setCalloutOffset(MapMarker view, @Nullable ReadableMap value) {
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@Override
|
|
88
|
+
public void setDisplayPriority(MapMarker view, @Nullable String value) {
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@Override
|
|
93
|
+
public void setCoordinate(MapMarker view, @Nullable ReadableMap value) {
|
|
94
|
+
view.setCoordinate(value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Override
|
|
98
|
+
public void setDescription(MapMarker view, @Nullable String value) {
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Override
|
|
103
|
+
public void setDraggable(MapMarker view, boolean value) {
|
|
104
|
+
view.setDraggable(value);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@Override
|
|
108
|
+
public void setTitle(MapMarker view, @Nullable String value) {
|
|
109
|
+
view.setTitle(value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@Override
|
|
113
|
+
public void setIdentifier(MapMarker view, @Nullable String value) {
|
|
114
|
+
view.setIdentifier(value);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@Override
|
|
118
|
+
public void setIsPreselected(MapMarker view, boolean value) {
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@Override
|
|
123
|
+
public void setOpacity(MapMarker view, double value) {
|
|
124
|
+
view.setOpacity((float) value);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@Override
|
|
128
|
+
public void setPinColor(MapMarker view, @Nullable Integer value) {
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@Override
|
|
133
|
+
public void setTitleVisibility(MapMarker view, @Nullable String value) {
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@Override
|
|
138
|
+
public void setSubtitleVisibility(MapMarker view, @Nullable String value) {
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@Override
|
|
143
|
+
public void setUseLegacyPinView(MapMarker view, boolean value) {
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@Override
|
|
148
|
+
public void animateToCoordinates(MapMarker view, double latitude, double longitude, int duration) {
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@Override
|
|
153
|
+
public void setCoordinates(MapMarker view, double latitude, double longitude) {
|
|
154
|
+
view.setCoordinate(new LatLng(latitude, longitude));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Override
|
|
158
|
+
public void showCallout(MapMarker view) {
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
public void hideCallout(MapMarker view) {
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@Override
|
|
168
|
+
public void redrawCallout(MapMarker view) {
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@Override
|
|
173
|
+
public void redraw(MapMarker view) {
|
|
174
|
+
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnCalloutPressEvent extends Event<OnCalloutPressEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topCalloutPress";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnCalloutPressEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnDeselectEvent extends Event<OnDeselectEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topDeselect";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnDeselectEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnDragEndEvent extends Event<OnDragEndEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topDragEnd";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnDragEndEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnDragEvent extends Event<OnDragEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topDrag";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnDragEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnDragStartEvent extends Event<OnDragStartEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topDragStart";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnDragStartEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -4,7 +4,7 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
4
4
|
import com.facebook.react.uimanager.events.Event;
|
|
5
5
|
|
|
6
6
|
public class OnMarkerDeselectEvent extends Event<OnMarkerDeselectEvent> {
|
|
7
|
-
public static final String EVENT_NAME = "
|
|
7
|
+
public static final String EVENT_NAME = "topMarkerDeselect";
|
|
8
8
|
|
|
9
9
|
private final WritableMap payload;
|
|
10
10
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class OnSelectEvent extends Event<OnSelectEvent> {
|
|
7
|
+
public static final String EVENT_NAME = "topSelect";
|
|
8
|
+
|
|
9
|
+
private final WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public OnSelectEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
12
|
+
super(surfaceId, viewId);
|
|
13
|
+
this.payload = payload;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Override
|
|
17
|
+
public String getEventName() {
|
|
18
|
+
return EVENT_NAME;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public WritableMap getEventData() {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -9,10 +9,10 @@ import com.facebook.react.module.model.ReactModuleInfo;
|
|
|
9
9
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
10
10
|
import com.facebook.react.uimanager.ViewManager;
|
|
11
11
|
import com.rnmaps.fabric.MapViewManager;
|
|
12
|
+
import com.rnmaps.fabric.MarkerManager;
|
|
12
13
|
import com.rnmaps.fabric.NativeAirMapsModule;
|
|
13
14
|
import com.facebook.fbreact.specs.NativeAirMapsModuleSpec;
|
|
14
15
|
|
|
15
|
-
import java.util.Collections;
|
|
16
16
|
import java.util.HashMap;
|
|
17
17
|
import java.util.List;
|
|
18
18
|
import java.util.Map;
|
|
@@ -21,12 +21,15 @@ public class MapAirModulePackage extends TurboReactPackage {
|
|
|
21
21
|
|
|
22
22
|
@Override
|
|
23
23
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
24
|
-
return
|
|
24
|
+
return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
@Override
|
|
29
29
|
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
30
|
+
if (MarkerManager.REACT_CLASS.equals(name)) {
|
|
31
|
+
return new MarkerManager(reactContext);
|
|
32
|
+
}
|
|
30
33
|
if (MapViewManager.REACT_CLASS.equals(name)) {
|
|
31
34
|
return new MapViewManager(reactContext);
|
|
32
35
|
}
|
|
@@ -42,7 +42,7 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
42
42
|
"none", GoogleMap.MAP_TYPE_NONE
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
public static final Map<String, Integer> MY_LOCATION_PRIORITY = MapBuilder.of(
|
|
46
46
|
"balanced", Priority.PRIORITY_BALANCED_POWER_ACCURACY,
|
|
47
47
|
"high", Priority.PRIORITY_HIGH_ACCURACY,
|
|
48
48
|
"low", Priority.PRIORITY_LOW_POWER,
|
|
@@ -240,47 +240,47 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
240
240
|
|
|
241
241
|
@ReactProp(name = "showsBuildings", defaultBoolean = false)
|
|
242
242
|
public void setShowBuildings(MapView view, boolean showBuildings) {
|
|
243
|
-
view.
|
|
243
|
+
view.setShowBuildings(showBuildings);
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
@ReactProp(name = "showsIndoors", defaultBoolean = false)
|
|
247
247
|
public void setShowIndoors(MapView view, boolean showIndoors) {
|
|
248
|
-
view.
|
|
248
|
+
view.setShowIndoors(showIndoors);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
@ReactProp(name = "showsIndoorLevelPicker", defaultBoolean = false)
|
|
252
252
|
public void setShowsIndoorLevelPicker(MapView view, boolean showsIndoorLevelPicker) {
|
|
253
|
-
view.
|
|
253
|
+
view.setShowsIndoorLevelPicker(showsIndoorLevelPicker);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
@ReactProp(name = "showsCompass", defaultBoolean = false)
|
|
257
257
|
public void setShowsCompass(MapView view, boolean showsCompass) {
|
|
258
|
-
view.
|
|
258
|
+
view.setShowsCompass(showsCompass);
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
@ReactProp(name = "scrollEnabled", defaultBoolean = false)
|
|
262
262
|
public void setScrollEnabled(MapView view, boolean scrollEnabled) {
|
|
263
|
-
view.
|
|
263
|
+
view.setScrollEnabled(scrollEnabled);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
@ReactProp(name = "zoomEnabled", defaultBoolean = false)
|
|
267
267
|
public void setZoomEnabled(MapView view, boolean zoomEnabled) {
|
|
268
|
-
view.
|
|
268
|
+
view.setZoomEnabled(zoomEnabled);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
@ReactProp(name = "zoomControlEnabled", defaultBoolean = true)
|
|
272
272
|
public void setZoomControlEnabled(MapView view, boolean zoomControlEnabled) {
|
|
273
|
-
view.
|
|
273
|
+
view.setZoomControlEnabled(zoomControlEnabled);
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
@ReactProp(name = "rotateEnabled", defaultBoolean = false)
|
|
277
277
|
public void setRotateEnabled(MapView view, boolean rotateEnabled) {
|
|
278
|
-
view.
|
|
278
|
+
view.setRotateEnabled(rotateEnabled);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
@ReactProp(name = "scrollDuringRotateOrZoomEnabled", defaultBoolean = true)
|
|
282
282
|
public void setScrollDuringRotateOrZoomEnabled(MapView view, boolean scrollDuringRotateOrZoomEnabled) {
|
|
283
|
-
view.
|
|
283
|
+
view.setScrollDuringRotateOrZoomEnabled(scrollDuringRotateOrZoomEnabled);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
@ReactProp(name = "cacheEnabled", defaultBoolean = false)
|
|
@@ -295,7 +295,7 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
295
295
|
|
|
296
296
|
@ReactProp(name = "loadingEnabled", defaultBoolean = false)
|
|
297
297
|
public void setLoadingEnabled(MapView view, boolean loadingEnabled) {
|
|
298
|
-
view.
|
|
298
|
+
view.setLoadingEnabled(loadingEnabled);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
@ReactProp(name = "moveOnMarkerPress", defaultBoolean = true)
|
|
@@ -315,17 +315,17 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
315
315
|
|
|
316
316
|
@ReactProp(name = "pitchEnabled", defaultBoolean = false)
|
|
317
317
|
public void setPitchEnabled(MapView view, boolean pitchEnabled) {
|
|
318
|
-
view.
|
|
318
|
+
view.setPitchEnabled(pitchEnabled);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
@ReactProp(name = "minZoomLevel")
|
|
322
322
|
public void setMinZoomLevel(MapView view, float minZoomLevel) {
|
|
323
|
-
view.
|
|
323
|
+
view.setMinZoomLevel(minZoomLevel);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
@ReactProp(name = "maxZoomLevel")
|
|
327
327
|
public void setMaxZoomLevel(MapView view, float maxZoomLevel) {
|
|
328
|
-
view.
|
|
328
|
+
view.setMaxZoomLevel(maxZoomLevel);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
@ReactProp(name = "kmlSrc")
|
|
@@ -32,13 +32,27 @@ import com.facebook.imagepipeline.image.CloseableStaticBitmap;
|
|
|
32
32
|
import com.facebook.imagepipeline.image.ImageInfo;
|
|
33
33
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
34
34
|
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|
35
|
+
import com.facebook.react.bridge.ReactContext;
|
|
35
36
|
import com.facebook.react.bridge.ReadableMap;
|
|
37
|
+
import com.facebook.react.bridge.WritableMap;
|
|
38
|
+
import com.facebook.react.common.MapBuilder;
|
|
39
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
40
|
+
import com.facebook.react.uimanager.events.Event;
|
|
41
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
36
42
|
import com.google.android.gms.maps.model.BitmapDescriptor;
|
|
37
43
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
38
44
|
import com.google.android.gms.maps.model.LatLng;
|
|
39
45
|
import com.google.android.gms.maps.model.Marker;
|
|
40
46
|
import com.google.android.gms.maps.model.MarkerOptions;
|
|
41
47
|
import com.google.maps.android.collections.MarkerManager;
|
|
48
|
+
import com.rnmaps.fabric.event.OnDeselectEvent;
|
|
49
|
+
import com.rnmaps.fabric.event.OnDragEndEvent;
|
|
50
|
+
import com.rnmaps.fabric.event.OnDragEvent;
|
|
51
|
+
import com.rnmaps.fabric.event.OnDragStartEvent;
|
|
52
|
+
import com.rnmaps.fabric.event.OnPressEvent;
|
|
53
|
+
import com.rnmaps.fabric.event.OnSelectEvent;
|
|
54
|
+
|
|
55
|
+
import java.util.Map;
|
|
42
56
|
|
|
43
57
|
public class MapMarker extends MapFeature {
|
|
44
58
|
|
|
@@ -155,7 +169,10 @@ public class MapMarker extends MapFeature {
|
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
public void setCoordinate(ReadableMap coordinate) {
|
|
158
|
-
|
|
172
|
+
setCoordinate(new LatLng(coordinate.getDouble("latitude"), coordinate.getDouble("longitude")));
|
|
173
|
+
}
|
|
174
|
+
public void setCoordinate(LatLng position){
|
|
175
|
+
this.position = position;
|
|
159
176
|
if (marker != null) {
|
|
160
177
|
marker.setPosition(position);
|
|
161
178
|
}
|
|
@@ -618,8 +635,43 @@ public class MapMarker extends MapFeature {
|
|
|
618
635
|
getContext().getPackageName());
|
|
619
636
|
}
|
|
620
637
|
|
|
638
|
+
@FunctionalInterface
|
|
639
|
+
public interface EventCreator<T extends Event> {
|
|
640
|
+
T create(int surfaceId, int viewId, WritableMap payload);
|
|
641
|
+
}
|
|
642
|
+
private <T extends Event> void dispatchEvent(WritableMap payload, MapView.EventCreator<T> creator) {
|
|
643
|
+
// Cast context to ReactContext
|
|
644
|
+
ReactContext reactContext = (ReactContext) context;
|
|
645
|
+
|
|
646
|
+
// Get the event dispatcher
|
|
647
|
+
EventDispatcher eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, getId());
|
|
648
|
+
|
|
649
|
+
// If there is a dispatcher, create and dispatch the event
|
|
650
|
+
if (eventDispatcher != null) {
|
|
651
|
+
int surfaceId = UIManagerHelper.getSurfaceId(reactContext);
|
|
652
|
+
T event = creator.create(surfaceId, getId(), payload);
|
|
653
|
+
eventDispatcher.dispatchEvent(event);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
621
657
|
private BitmapDescriptor getBitmapDescriptorByName(String name) {
|
|
622
658
|
return BitmapDescriptorFactory.fromResource(getDrawableResourceByName(name));
|
|
623
659
|
}
|
|
624
660
|
|
|
661
|
+
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
662
|
+
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
663
|
+
builder.put(OnSelectEvent.EVENT_NAME, MapBuilder.of("registrationName", OnSelectEvent.EVENT_NAME));
|
|
664
|
+
builder.put(OnDeselectEvent.EVENT_NAME, MapBuilder.of("registrationName", OnDeselectEvent.EVENT_NAME));
|
|
665
|
+
builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
|
|
666
|
+
return builder.build();
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
public static Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
670
|
+
return MapBuilder.of(
|
|
671
|
+
OnDragEvent.EVENT_NAME, MapBuilder.of("registrationName", OnDragEvent.EVENT_NAME),
|
|
672
|
+
OnDragStartEvent.EVENT_NAME, MapBuilder.of("registrationName", OnDragStartEvent.EVENT_NAME),
|
|
673
|
+
OnDragEndEvent.EVENT_NAME, MapBuilder.of("registrationName", OnDragEndEvent.EVENT_NAME)
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
|
|
625
677
|
}
|
|
@@ -37,7 +37,6 @@ import com.facebook.react.bridge.WritableNativeArray;
|
|
|
37
37
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
38
38
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
39
39
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
40
|
-
import com.facebook.react.uimanager.common.UIManagerType;
|
|
41
40
|
import com.facebook.react.uimanager.events.Event;
|
|
42
41
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
43
42
|
import com.google.android.gms.maps.CameraUpdate;
|
|
@@ -69,7 +68,6 @@ import com.google.maps.android.collections.PolylineManager;
|
|
|
69
68
|
import com.google.maps.android.data.kml.KmlContainer;
|
|
70
69
|
import com.google.maps.android.data.kml.KmlLayer;
|
|
71
70
|
import com.google.maps.android.data.kml.KmlPlacemark;
|
|
72
|
-
import com.google.maps.android.data.kml.KmlStyle;
|
|
73
71
|
|
|
74
72
|
import org.xmlpull.v1.XmlPullParserException;
|
|
75
73
|
|
|
@@ -141,6 +139,18 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
141
139
|
|
|
142
140
|
private final ViewAttacherGroup attacherGroup;
|
|
143
141
|
private LatLng tapLocation;
|
|
142
|
+
private Float maxZoomLevel;
|
|
143
|
+
private Float minZoomLevel;
|
|
144
|
+
private Boolean pitchEnabled;
|
|
145
|
+
private Boolean showsCompass;
|
|
146
|
+
private Boolean rotateEnabled;
|
|
147
|
+
private Boolean zoomEnabled;
|
|
148
|
+
private Boolean zoomControlEnabled;
|
|
149
|
+
private Boolean setShowBuildings;
|
|
150
|
+
private Boolean showsIndoorLevelPicker;
|
|
151
|
+
private Boolean showIndoors;
|
|
152
|
+
private Boolean scrollEnabled;
|
|
153
|
+
private Boolean scrollDuringRotateOrZoomEnabled;
|
|
144
154
|
|
|
145
155
|
private static boolean contextHasBug(Context context) {
|
|
146
156
|
return context == null ||
|
|
@@ -260,6 +270,42 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
260
270
|
return;
|
|
261
271
|
}
|
|
262
272
|
this.map = map;
|
|
273
|
+
if (maxZoomLevel != null){
|
|
274
|
+
setMaxZoomLevel(maxZoomLevel);
|
|
275
|
+
}
|
|
276
|
+
if (minZoomLevel != null){
|
|
277
|
+
setMinZoomLevel(minZoomLevel);
|
|
278
|
+
}
|
|
279
|
+
if (pitchEnabled != null){
|
|
280
|
+
setPitchEnabled(pitchEnabled);
|
|
281
|
+
}
|
|
282
|
+
if (showsCompass != null){
|
|
283
|
+
setShowsCompass(showsCompass);
|
|
284
|
+
}
|
|
285
|
+
if (rotateEnabled != null){
|
|
286
|
+
setRotateEnabled(rotateEnabled);
|
|
287
|
+
}
|
|
288
|
+
if (zoomEnabled != null){
|
|
289
|
+
setZoomEnabled(zoomEnabled);
|
|
290
|
+
}
|
|
291
|
+
if (zoomControlEnabled != null){
|
|
292
|
+
setZoomControlEnabled(zoomControlEnabled);
|
|
293
|
+
}
|
|
294
|
+
if (setShowBuildings != null){
|
|
295
|
+
setShowBuildings(setShowBuildings);
|
|
296
|
+
}
|
|
297
|
+
if (showsIndoorLevelPicker != null){
|
|
298
|
+
setShowsIndoorLevelPicker(showsIndoorLevelPicker);
|
|
299
|
+
}
|
|
300
|
+
if (showIndoors != null){
|
|
301
|
+
setShowIndoors(showIndoors);
|
|
302
|
+
}
|
|
303
|
+
if (scrollEnabled != null){
|
|
304
|
+
setScrollEnabled(scrollEnabled);
|
|
305
|
+
}
|
|
306
|
+
if (scrollDuringRotateOrZoomEnabled != null){
|
|
307
|
+
setScrollDuringRotateOrZoomEnabled(scrollDuringRotateOrZoomEnabled);
|
|
308
|
+
}
|
|
263
309
|
|
|
264
310
|
markerManager = new MarkerManager(map);
|
|
265
311
|
markerCollection = markerManager.newCollection();
|
|
@@ -748,7 +794,7 @@ public static CameraPosition cameraPositionFromMap(ReadableMap camera){
|
|
|
748
794
|
map.setOnPoiClickListener(poiClickEnabled ? this : null);
|
|
749
795
|
}
|
|
750
796
|
|
|
751
|
-
public void
|
|
797
|
+
public void setLoadingEnabled(boolean loadingEnabled) {
|
|
752
798
|
if (loadingEnabled && !this.isMapLoaded) {
|
|
753
799
|
this.getMapLoadingLayoutView().setVisibility(View.VISIBLE);
|
|
754
800
|
}
|
|
@@ -757,6 +803,79 @@ public static CameraPosition cameraPositionFromMap(ReadableMap camera){
|
|
|
757
803
|
public void setMoveOnMarkerPress(boolean moveOnPress) {
|
|
758
804
|
this.moveOnMarkerPress = moveOnPress;
|
|
759
805
|
}
|
|
806
|
+
public void setMaxZoomLevel(float maxZoomLevel){
|
|
807
|
+
this.maxZoomLevel = maxZoomLevel;
|
|
808
|
+
if (map != null) {
|
|
809
|
+
map.setMaxZoomPreference(maxZoomLevel);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
public void setMinZoomLevel(float minZoomLevel){
|
|
813
|
+
this.minZoomLevel = minZoomLevel;
|
|
814
|
+
if (map != null) {
|
|
815
|
+
map.setMinZoomPreference(minZoomLevel);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
public void setPitchEnabled(boolean pitchEnabled){
|
|
819
|
+
this.pitchEnabled = pitchEnabled;
|
|
820
|
+
if (map != null) {
|
|
821
|
+
map.getUiSettings().setTiltGesturesEnabled(pitchEnabled);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
public void setShowsCompass(boolean showsCompass){
|
|
825
|
+
this.showsCompass = showsCompass;
|
|
826
|
+
if (map != null) {
|
|
827
|
+
map.getUiSettings().setCompassEnabled(showsCompass);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
public void setRotateEnabled(boolean rotateEnabled){
|
|
831
|
+
this.rotateEnabled = rotateEnabled;
|
|
832
|
+
if (map != null) {
|
|
833
|
+
map.getUiSettings().setRotateGesturesEnabled(rotateEnabled);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
public void setZoomEnabled(boolean zoomEnabled){
|
|
837
|
+
this.zoomEnabled = zoomEnabled;
|
|
838
|
+
if (map != null) {
|
|
839
|
+
map.getUiSettings().setZoomGesturesEnabled(zoomEnabled);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
public void setZoomControlEnabled(boolean zoomControlEnabled){
|
|
843
|
+
this.zoomControlEnabled = zoomControlEnabled;
|
|
844
|
+
if (map != null) {
|
|
845
|
+
map.getUiSettings().setZoomControlsEnabled(zoomControlEnabled);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
public void setScrollDuringRotateOrZoomEnabled(boolean scrollDuringRotateOrZoomEnabled){
|
|
849
|
+
this.scrollDuringRotateOrZoomEnabled = scrollDuringRotateOrZoomEnabled;
|
|
850
|
+
if (map != null) {
|
|
851
|
+
map.getUiSettings().setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringRotateOrZoomEnabled);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
public void setScrollEnabled(boolean scrollEnabled){
|
|
855
|
+
this.scrollEnabled = scrollEnabled;
|
|
856
|
+
if (map != null) {
|
|
857
|
+
map.getUiSettings().setScrollGesturesEnabled(scrollEnabled);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
public void setShowIndoors(boolean showIndoors){
|
|
861
|
+
this.showIndoors = showIndoors;
|
|
862
|
+
if (map != null) {
|
|
863
|
+
map.setIndoorEnabled(showIndoors);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
public void setShowsIndoorLevelPicker(boolean showsIndoorLevelPicker) {
|
|
867
|
+
this.showsIndoorLevelPicker = showsIndoorLevelPicker;
|
|
868
|
+
if (map != null) {
|
|
869
|
+
map.getUiSettings().setIndoorLevelPickerEnabled(showsIndoorLevelPicker);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
public void setShowBuildings(boolean showBuildings) {
|
|
873
|
+
this.setShowBuildings = showBuildings;
|
|
874
|
+
if (map != null) {
|
|
875
|
+
map.setBuildingsEnabled(showBuildings);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
760
879
|
|
|
761
880
|
public void setLoadingBackgroundColor(Integer loadingBackgroundColor) {
|
|
762
881
|
this.loadingBackgroundColor = loadingBackgroundColor;
|
package/lib/MapMarker.js
CHANGED
|
@@ -116,7 +116,7 @@ class MapMarker extends React.Component {
|
|
|
116
116
|
const { stopPropagation = false } = this.props;
|
|
117
117
|
if (this.fabricMarker === undefined) {
|
|
118
118
|
const provider = this.context;
|
|
119
|
-
this.fabricMarker =
|
|
119
|
+
this.fabricMarker = !(react_native_1.Platform.OS === 'ios' && provider !== ProviderConstants_1.PROVIDER_GOOGLE);
|
|
120
120
|
}
|
|
121
121
|
let icon;
|
|
122
122
|
if (this.props.icon) {
|
|
@@ -40,8 +40,7 @@ function decorateMapComponent(Component, componentName, providers) {
|
|
|
40
40
|
function getNativeComponent() {
|
|
41
41
|
const provider = this.context;
|
|
42
42
|
if (componentName === 'Marker' &&
|
|
43
|
-
provider !== ProviderConstants_1.PROVIDER_GOOGLE
|
|
44
|
-
react_native_1.Platform.OS === 'ios') {
|
|
43
|
+
(react_native_1.Platform.OS !== 'ios' || provider !== ProviderConstants_1.PROVIDER_GOOGLE)) {
|
|
45
44
|
// @ts-ignore
|
|
46
45
|
return NativeComponentMarker_1.default;
|
|
47
46
|
}
|
|
@@ -16,6 +16,4 @@ exports.Commands = (0, codegenNativeCommands_1.default)({
|
|
|
16
16
|
'redraw',
|
|
17
17
|
],
|
|
18
18
|
});
|
|
19
|
-
exports.default = (0, codegenNativeComponent_1.default)('RNMapsMarker', {
|
|
20
|
-
excludedPlatforms: ['android'],
|
|
21
|
-
});
|
|
19
|
+
exports.default = (0, codegenNativeComponent_1.default)('RNMapsMarker', {});
|
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.54",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|