react-native-maps 1.21.0-alpha.52 → 1.21.0-alpha.53
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 +7 -4
- 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/MapMarker.java +53 -1
- 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,24 +1,22 @@
|
|
|
1
1
|
package com.rnmaps.fabric;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
import android.view.View;
|
|
5
|
+
|
|
4
6
|
import androidx.annotation.Nullable;
|
|
5
7
|
|
|
6
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
-
import com.facebook.react.bridge.ReactContext;
|
|
8
9
|
import com.facebook.react.bridge.ReadableMap;
|
|
9
10
|
import com.facebook.react.module.annotations.ReactModule;
|
|
10
|
-
import com.facebook.react.uimanager.SimpleViewManager;
|
|
11
11
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
12
12
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
13
13
|
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
14
|
-
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
15
14
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerInterface;
|
|
16
15
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerDelegate;
|
|
17
16
|
import com.google.android.gms.maps.GoogleMap;
|
|
18
17
|
import com.google.android.gms.maps.GoogleMapOptions;
|
|
19
18
|
import com.rnmaps.maps.MapView;
|
|
20
19
|
|
|
21
|
-
import java.util.HashMap;
|
|
22
20
|
import java.util.Map;
|
|
23
21
|
|
|
24
22
|
@ReactModule(name = MapViewManager.REACT_CLASS)
|
|
@@ -142,6 +140,11 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
142
140
|
|
|
143
141
|
}
|
|
144
142
|
|
|
143
|
+
@Override
|
|
144
|
+
public void addView(MapView parent, View child, int index) {
|
|
145
|
+
parent.addFeature(child, index);
|
|
146
|
+
}
|
|
147
|
+
|
|
145
148
|
@Override
|
|
146
149
|
public void setMapType(MapView view, @Nullable String value) {
|
|
147
150
|
//hybrid | none | satellite | standard | terrain
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
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.53",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|