react-native-maps 1.25.0-alpha.7 → 1.25.0
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/README.md +2 -53
- package/android/src/main/RCTThirdPartyComponentsProvider.mm +0 -2
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +1 -1
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +3 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +1 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +6 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +2 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +41 -5
- package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +9 -2
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +1 -2
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +46 -3
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +8 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +104 -51
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +84 -27
- package/android/src/main/java/com/rnmaps/maps/RegionChangeEvent.java +1 -4
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +6 -6
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +6 -6
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +5 -2
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +27 -2
- package/ios/AirGoogleMaps/AIRGoogleMap.mm +13 -12
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +4 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +3 -3
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +6 -6
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +4 -4
- package/ios/AirMaps/AIRMap.h +2 -1
- package/ios/AirMaps/AIRMapManager.m +34 -18
- package/ios/AirMaps/AIRMapMarker.m +7 -1
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +2 -2
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +1 -1
- package/ios/AirMaps/RNMapsAirModule.mm +3 -3
- package/ios/AirMaps/RNMapsMapView.h +4 -4
- package/ios/AirMaps/RNMapsMapView.mm +55 -10
- package/ios/AirMaps/RNMapsMapViewManager.mm +1 -1
- package/ios/AirMaps/RNMapsMarkerView.mm +4 -3
- package/ios/generated/RNMapsAirModuleDelegate.h +1 -1
- package/ios/generated/{RNMapsHostVewDelegate.h → RNMapsHostViewDelegate.h} +1 -1
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +8 -6
- package/ios/generated/RNMapsSpecs/EventEmitters.h +20 -6
- package/ios/generated/RNMapsSpecs/Props.cpp +37 -2
- package/ios/generated/RNMapsSpecs/Props.h +110 -13
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
- package/ios/generated/RNMapsSpecs/States.h +24 -0
- package/ios/generated/module.modulemap +1 -1
- package/package.json +10 -4
- package/plugin/build/ios.js +3 -3
- package/src/AnimatedRegion.ts +3 -1
- package/src/Geojson.tsx +5 -5
- package/src/MapCallout.tsx +5 -5
- package/src/MapCalloutSubview.tsx +9 -5
- package/src/MapCircle.tsx +5 -5
- package/src/MapHeatmap.tsx +11 -6
- package/src/MapLocalTile.tsx +4 -4
- package/src/MapMarker.tsx +38 -17
- package/src/MapMarkerNativeComponent.ts +3 -2
- package/src/MapOverlay.tsx +10 -10
- package/src/MapPolygon.tsx +6 -6
- package/src/MapPolygon.types.ts +2 -2
- package/src/MapPolyline.tsx +5 -5
- package/src/MapUrlTile.tsx +4 -4
- package/src/MapView.tsx +34 -37
- package/src/MapView.types.ts +2 -3
- package/src/MapViewNativeComponent.ts +3 -3
- package/src/MapWMSTile.tsx +4 -4
- package/src/createFabricMap.tsx +39 -37
- package/src/decorateMapComponent.ts +9 -3
- package/src/fixImageProp.ts +1 -1
- package/src/index.ts +1 -1
- package/src/sharedTypes.ts +1 -1
- package/src/specs/NativeAirMapsModule.ts +1 -1
- package/src/specs/NativeComponentCallout.ts +1 -1
- package/src/specs/NativeComponentCircle.ts +3 -2
- package/src/specs/NativeComponentGoogleMapView.ts +12 -10
- package/src/specs/NativeComponentGooglePolygon.ts +12 -1
- package/src/specs/NativeComponentMapView.ts +12 -10
- package/src/specs/NativeComponentMarker.ts +26 -2
- package/src/specs/NativeComponentOverlay.ts +1 -1
- package/src/specs/NativeComponentPolyline.ts +2 -2
- package/src/specs/NativeComponentUrlTile.ts +4 -1
- package/src/specs/NativeComponentWMSTile.ts +4 -1
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +0 -98
- package/ios/AirMaps.xcodeproj/project.pbxproj +0 -627
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ See [Setup Instructions for the Included Example Project](docs/examples-setup.md
|
|
|
19
19
|
### Important Notes:
|
|
20
20
|
|
|
21
21
|
- **Fabric is now supported**:
|
|
22
|
-
Fabric is now supported for the latest version of the library, if you don't have Fabric (New Arch) enabled, please use v1.21.0 or earlier
|
|
22
|
+
Fabric is now supported for the latest version of the library, **latest version is strongly recommended** because many regressions appeared after the release of v1.22.0 if you don't have Fabric (New Arch) enabled, please use v1.21.0 or earlier
|
|
23
23
|
|
|
24
24
|
### Version Requirements:
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ See [Setup Instructions for the Included Example Project](docs/examples-setup.md
|
|
|
29
29
|
|
|
30
30
|
#### Old Arch
|
|
31
31
|
|
|
32
|
-
- **Version `1.21.
|
|
32
|
+
- **Version `1.21.1` and below**: Requires **React Native `>= 0.74`**.
|
|
33
33
|
- **Version `1.14.0` and above**: Requires **React Native `>= 0.74`**.
|
|
34
34
|
- **Versions below `1.14.0`**: Require **React Native `>= 0.64.3`**.
|
|
35
35
|
|
|
@@ -214,57 +214,6 @@ For Android: add the following line in your AndroidManifest.xml
|
|
|
214
214
|
|
|
215
215
|
For IOS: configure [App Transport Security](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33) in your app
|
|
216
216
|
|
|
217
|
-
## React Native Configuration for Fabric / New Architecture
|
|
218
|
-
|
|
219
|
-
This library doesn't support the new arch yet due to issues with inserting subviews / interoplayer. we're working on it.
|
|
220
|
-
|
|
221
|
-
### Configuration Steps
|
|
222
|
-
|
|
223
|
-
1. **Open your configuration file**: Locate the `react-native-config` file in your project directory.
|
|
224
|
-
|
|
225
|
-
2. **Add the following configuration**: Include the `unstable_reactLegacyComponentNames` array for both Android and iOS platforms as shown below:
|
|
226
|
-
|
|
227
|
-
```javascript
|
|
228
|
-
module.exports = {
|
|
229
|
-
project: {
|
|
230
|
-
android: {
|
|
231
|
-
unstable_reactLegacyComponentNames: [
|
|
232
|
-
'AIRMap',
|
|
233
|
-
'AIRMapCallout',
|
|
234
|
-
'AIRMapCalloutSubview',
|
|
235
|
-
'AIRMapCircle',
|
|
236
|
-
'AIRMapHeatmap',
|
|
237
|
-
'AIRMapLocalTile',
|
|
238
|
-
'AIRMapMarker',
|
|
239
|
-
'AIRMapOverlay',
|
|
240
|
-
'AIRMapPolygon',
|
|
241
|
-
'AIRMapPolyline',
|
|
242
|
-
'AIRMapUrlTile',
|
|
243
|
-
'AIRMapWMSTile',
|
|
244
|
-
],
|
|
245
|
-
},
|
|
246
|
-
ios: {
|
|
247
|
-
unstable_reactLegacyComponentNames: [
|
|
248
|
-
'AIRMap',
|
|
249
|
-
'AIRMapCallout',
|
|
250
|
-
'AIRMapCalloutSubview',
|
|
251
|
-
'AIRMapCircle',
|
|
252
|
-
'AIRMapHeatmap',
|
|
253
|
-
'AIRMapLocalTile',
|
|
254
|
-
'AIRMapMarker',
|
|
255
|
-
'AIRMapOverlay',
|
|
256
|
-
'AIRMapPolygon',
|
|
257
|
-
'AIRMapPolyline',
|
|
258
|
-
'AIRMapUrlTile',
|
|
259
|
-
'AIRMapWMSTile',
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
checkout the example project to see it in action.
|
|
267
|
-
|
|
268
217
|
#### Tile Overlay using local tiles
|
|
269
218
|
|
|
270
219
|
Tiles can be stored locally within device using xyz tiling scheme and displayed as tile overlay as well. This is usefull especially for offline map usage when tiles are available for selected map region within device storage.
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
17
17
|
{
|
|
18
18
|
return @{
|
|
19
|
-
@"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
|
|
20
|
-
@"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
|
|
21
19
|
@"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
|
|
22
20
|
@"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
|
|
23
21
|
@"RNMapsMapView": NSClassFromString(@"RNMapsMapView"), // react-native-maps
|
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java
CHANGED
|
@@ -37,7 +37,7 @@ public class RNMapsCircleManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
37
37
|
mViewManager.setStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
38
38
|
break;
|
|
39
39
|
case "strokeWidth":
|
|
40
|
-
mViewManager.setStrokeWidth(view, value == null ?
|
|
40
|
+
mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
|
|
41
41
|
break;
|
|
42
42
|
case "tappable":
|
|
43
43
|
mViewManager.setTappable(view, value == null ? false : (boolean) value);
|
|
@@ -33,6 +33,9 @@ public class RNMapsGooglePolygonManagerDelegate<T extends View, U extends BaseVi
|
|
|
33
33
|
case "strokeColor":
|
|
34
34
|
mViewManager.setStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
35
35
|
break;
|
|
36
|
+
case "strokeWidth":
|
|
37
|
+
mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
|
|
38
|
+
break;
|
|
36
39
|
case "geodesic":
|
|
37
40
|
mViewManager.setGeodesic(view, value == null ? false : (boolean) value);
|
|
38
41
|
break;
|
|
@@ -17,6 +17,7 @@ public interface RNMapsGooglePolygonManagerInterface<T extends View> {
|
|
|
17
17
|
void setCoordinates(T view, @Nullable ReadableArray value);
|
|
18
18
|
void setFillColor(T view, @Nullable Integer value);
|
|
19
19
|
void setStrokeColor(T view, @Nullable Integer value);
|
|
20
|
+
void setStrokeWidth(T view, float value);
|
|
20
21
|
void setGeodesic(T view, boolean value);
|
|
21
22
|
void setHoles(T view, @Nullable ReadableArray value);
|
|
22
23
|
void setTappable(T view, boolean value);
|
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java
CHANGED
|
@@ -40,6 +40,9 @@ public class RNMapsMarkerManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
40
40
|
case "displayPriority":
|
|
41
41
|
mViewManager.setDisplayPriority(view, (String) value);
|
|
42
42
|
break;
|
|
43
|
+
case "centerOffset":
|
|
44
|
+
mViewManager.setCenterOffset(view, (ReadableMap) value);
|
|
45
|
+
break;
|
|
43
46
|
case "coordinate":
|
|
44
47
|
mViewManager.setCoordinate(view, (ReadableMap) value);
|
|
45
48
|
break;
|
|
@@ -52,6 +55,9 @@ public class RNMapsMarkerManagerDelegate<T extends View, U extends BaseViewManag
|
|
|
52
55
|
case "title":
|
|
53
56
|
mViewManager.setTitle(view, value == null ? null : (String) value);
|
|
54
57
|
break;
|
|
58
|
+
case "tracksViewChanges":
|
|
59
|
+
mViewManager.setTracksViewChanges(view, value == null ? true : (boolean) value);
|
|
60
|
+
break;
|
|
55
61
|
case "identifier":
|
|
56
62
|
mViewManager.setIdentifier(view, value == null ? null : (String) value);
|
|
57
63
|
break;
|
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java
CHANGED
|
@@ -19,10 +19,12 @@ public interface RNMapsMarkerManagerInterface<T extends View> {
|
|
|
19
19
|
void setImage(T view, @Nullable ReadableMap value);
|
|
20
20
|
void setCalloutOffset(T view, @Nullable ReadableMap value);
|
|
21
21
|
void setDisplayPriority(T view, @Nullable String value);
|
|
22
|
+
void setCenterOffset(T view, @Nullable ReadableMap value);
|
|
22
23
|
void setCoordinate(T view, @Nullable ReadableMap value);
|
|
23
24
|
void setDescription(T view, @Nullable String value);
|
|
24
25
|
void setDraggable(T view, boolean value);
|
|
25
26
|
void setTitle(T view, @Nullable String value);
|
|
27
|
+
void setTracksViewChanges(T view, boolean value);
|
|
26
28
|
void setIdentifier(T view, @Nullable String value);
|
|
27
29
|
void setIsPreselected(T view, boolean value);
|
|
28
30
|
void setOpacity(T view, double value);
|
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java
CHANGED
|
@@ -46,7 +46,7 @@ public class RNMapsPolylineManagerDelegate<T extends View, U extends BaseViewMan
|
|
|
46
46
|
mViewManager.setStrokeColors(view, (ReadableArray) value);
|
|
47
47
|
break;
|
|
48
48
|
case "strokeWidth":
|
|
49
|
-
mViewManager.setStrokeWidth(view, value == null ?
|
|
49
|
+
mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
|
|
50
50
|
break;
|
|
51
51
|
case "tappable":
|
|
52
52
|
mViewManager.setTappable(view, value == null ? false : (boolean) value);
|
|
@@ -134,6 +134,7 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
134
134
|
double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
|
|
135
135
|
double y = map != null && map.hasKey("y") ? map.getDouble("y") : 1.0;
|
|
136
136
|
view.setAnchor(x, y);
|
|
137
|
+
view.setUpdated(true);
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
@Override
|
|
@@ -143,7 +144,12 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
143
144
|
|
|
144
145
|
@Override
|
|
145
146
|
public void setImage(MapMarker view, @Nullable ReadableMap value) {
|
|
146
|
-
|
|
147
|
+
if (value != null && value.hasKey("uri")) {
|
|
148
|
+
view.setImage(value.getString("uri"));
|
|
149
|
+
} else {
|
|
150
|
+
view.setImage(null);
|
|
151
|
+
}
|
|
152
|
+
view.setUpdated(true);
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
@Override
|
|
@@ -156,29 +162,43 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
156
162
|
|
|
157
163
|
}
|
|
158
164
|
|
|
165
|
+
@Override
|
|
166
|
+
public void setCenterOffset(MapMarker view, @Nullable ReadableMap value) {
|
|
167
|
+
}
|
|
168
|
+
|
|
159
169
|
@Override
|
|
160
170
|
public void setCoordinate(MapMarker view, @Nullable ReadableMap value) {
|
|
161
171
|
view.setCoordinate(value);
|
|
172
|
+
view.setUpdated(true);
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
@Override
|
|
165
176
|
public void setDescription(MapMarker view, @Nullable String value) {
|
|
166
177
|
view.setSnippet(value);
|
|
178
|
+
view.setUpdated(true);
|
|
167
179
|
}
|
|
168
180
|
|
|
169
181
|
@Override
|
|
170
182
|
public void setDraggable(MapMarker view, boolean value) {
|
|
171
183
|
view.setDraggable(value);
|
|
184
|
+
view.setUpdated(true);
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
@Override
|
|
175
188
|
public void setTitle(MapMarker view, @Nullable String value) {
|
|
176
189
|
view.setTitle(value);
|
|
190
|
+
view.setUpdated(true);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@Override
|
|
194
|
+
public void setTracksViewChanges(MapMarker view, boolean value) {
|
|
195
|
+
view.setTracksViewChanges(value);
|
|
177
196
|
}
|
|
178
197
|
|
|
179
198
|
@Override
|
|
180
199
|
public void setIdentifier(MapMarker view, @Nullable String value) {
|
|
181
200
|
view.setIdentifier(value);
|
|
201
|
+
view.setUpdated(true);
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
@Override
|
|
@@ -189,6 +209,7 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
189
209
|
@Override
|
|
190
210
|
public void setOpacity(MapMarker view, double value) {
|
|
191
211
|
view.setOpacity((float) value);
|
|
212
|
+
view.setUpdated(true);
|
|
192
213
|
}
|
|
193
214
|
|
|
194
215
|
@Override
|
|
@@ -197,6 +218,7 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
197
218
|
Color.colorToHSV(value, hsv);
|
|
198
219
|
// NOTE: android only supports a hue
|
|
199
220
|
view.setMarkerHue(hsv[0]);
|
|
221
|
+
view.setUpdated(true);
|
|
200
222
|
}
|
|
201
223
|
|
|
202
224
|
@Override
|
|
@@ -221,18 +243,20 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
221
243
|
|
|
222
244
|
@Override
|
|
223
245
|
public void setCoordinates(MapMarker view, double latitude, double longitude) {
|
|
224
|
-
|
|
246
|
+
view.setCoordinate(new LatLng(latitude, longitude));
|
|
247
|
+
view.setUpdated(true);
|
|
225
248
|
}
|
|
226
249
|
|
|
227
250
|
@Override
|
|
228
251
|
public void showCallout(MapMarker view) {
|
|
229
252
|
((Marker) view.getFeature()).showInfoWindow();
|
|
230
|
-
|
|
253
|
+
view.setUpdated(true);
|
|
231
254
|
}
|
|
232
255
|
|
|
233
256
|
@Override
|
|
234
257
|
public void hideCallout(MapMarker view) {
|
|
235
258
|
((Marker) view.getFeature()).hideInfoWindow();
|
|
259
|
+
view.setUpdated(true);
|
|
236
260
|
}
|
|
237
261
|
|
|
238
262
|
@Override
|
|
@@ -242,8 +266,9 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
242
266
|
|
|
243
267
|
@Override
|
|
244
268
|
public void redraw(MapMarker view) {
|
|
245
|
-
|
|
269
|
+
view.redraw();
|
|
246
270
|
}
|
|
271
|
+
|
|
247
272
|
@Override
|
|
248
273
|
public void addView(MapMarker parent, View child, int index) {
|
|
249
274
|
// if an <Callout /> component is a child, then it is a callout view, NOT part of the
|
|
@@ -252,7 +277,18 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
252
277
|
parent.setCalloutView((MapCallout) child);
|
|
253
278
|
} else {
|
|
254
279
|
super.addView(parent, child, index);
|
|
280
|
+
if (index == 0) {
|
|
281
|
+
child.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
|
|
282
|
+
@Override
|
|
283
|
+
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
|
284
|
+
int newWidth = right - left;
|
|
285
|
+
int newHeight = bottom - top;
|
|
286
|
+
MapMarker marker = (MapMarker) v.getParent();
|
|
287
|
+
marker.update(newWidth, newHeight);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
255
291
|
parent.update(true);
|
|
256
292
|
}
|
|
257
293
|
}
|
|
258
|
-
}
|
|
294
|
+
}
|
|
@@ -2,7 +2,7 @@ package com.rnmaps.fabric;
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import androidx.annotation.Nullable;
|
|
5
|
-
|
|
5
|
+
import android.util.DisplayMetrics;
|
|
6
6
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
7
|
import com.facebook.react.bridge.ReadableArray;
|
|
8
8
|
import com.facebook.react.module.annotations.ReactModule;
|
|
@@ -72,6 +72,13 @@ public class PolygonManager extends ViewGroupManager<MapPolygon> implements RNMa
|
|
|
72
72
|
view.setStrokeColor(value);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
@Override
|
|
76
|
+
public void setStrokeWidth(MapPolygon view, float value) {
|
|
77
|
+
DisplayMetrics metrics = view.getContext().getResources().getDisplayMetrics();
|
|
78
|
+
float widthInScreenPx = metrics.density * value; // done for parity with iOS
|
|
79
|
+
view.setStrokeWidth(widthInScreenPx);
|
|
80
|
+
}
|
|
81
|
+
|
|
75
82
|
@Override
|
|
76
83
|
public void setGeodesic(MapPolygon view, boolean value) {
|
|
77
84
|
view.setGeodesic(value);
|
|
@@ -86,4 +93,4 @@ public class PolygonManager extends ViewGroupManager<MapPolygon> implements RNMa
|
|
|
86
93
|
public void setTappable(MapPolygon view, boolean value) {
|
|
87
94
|
view.setTappable(value);
|
|
88
95
|
}
|
|
89
|
-
}
|
|
96
|
+
}
|
|
@@ -18,10 +18,9 @@ public class OnRegionChangeEvent extends Event<OnRegionChangeEvent> {
|
|
|
18
18
|
super(surfaceId, viewId);
|
|
19
19
|
this.payload = payload;
|
|
20
20
|
}
|
|
21
|
-
public static WritableMap payLoadFor(LatLngBounds bounds, boolean
|
|
21
|
+
public static WritableMap payLoadFor(LatLngBounds bounds, boolean isGesture) {
|
|
22
22
|
|
|
23
23
|
WritableMap event = new WritableNativeMap();
|
|
24
|
-
event.putBoolean("continuous", continuous);
|
|
25
24
|
WritableMap region = new WritableNativeMap();
|
|
26
25
|
LatLng center = bounds.getCenter();
|
|
27
26
|
region.putDouble("latitude", center.latitude);
|
|
@@ -14,6 +14,9 @@ import android.animation.ObjectAnimator;
|
|
|
14
14
|
import android.util.Property;
|
|
15
15
|
import android.animation.TypeEvaluator;
|
|
16
16
|
|
|
17
|
+
import android.os.Handler;
|
|
18
|
+
import android.os.Looper;
|
|
19
|
+
|
|
17
20
|
import androidx.annotation.Nullable;
|
|
18
21
|
|
|
19
22
|
import com.facebook.common.references.CloseableReference;
|
|
@@ -89,6 +92,8 @@ public class MapMarker extends MapFeature {
|
|
|
89
92
|
private float calloutAnchorY;
|
|
90
93
|
private boolean calloutAnchorIsSet;
|
|
91
94
|
|
|
95
|
+
private int updated = 0;
|
|
96
|
+
|
|
92
97
|
private boolean tracksViewChanges = true;
|
|
93
98
|
private boolean tracksViewChangesActive = false;
|
|
94
99
|
|
|
@@ -313,11 +318,15 @@ public class MapMarker extends MapFeature {
|
|
|
313
318
|
}
|
|
314
319
|
|
|
315
320
|
public boolean updateCustomForTracking() {
|
|
316
|
-
if (!tracksViewChangesActive)
|
|
321
|
+
if (!tracksViewChangesActive || updated == 0) {
|
|
322
|
+
tracksViewChangesActive = false;
|
|
317
323
|
return false;
|
|
324
|
+
}
|
|
318
325
|
|
|
319
326
|
updateMarkerIcon();
|
|
320
|
-
|
|
327
|
+
if (updated > 0){
|
|
328
|
+
updated--;
|
|
329
|
+
}
|
|
321
330
|
return true;
|
|
322
331
|
}
|
|
323
332
|
|
|
@@ -455,6 +464,14 @@ public class MapMarker extends MapFeature {
|
|
|
455
464
|
updateTracksViewChanges();
|
|
456
465
|
update(true);
|
|
457
466
|
}
|
|
467
|
+
} else {
|
|
468
|
+
// custom subview
|
|
469
|
+
if (!(getChildAt(0) instanceof MapCallout)) {
|
|
470
|
+
if (updated == 0) {
|
|
471
|
+
updated = 1;
|
|
472
|
+
updateTracksViewChanges();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
458
475
|
}
|
|
459
476
|
}
|
|
460
477
|
|
|
@@ -539,15 +556,27 @@ public class MapMarker extends MapFeature {
|
|
|
539
556
|
} else {
|
|
540
557
|
marker.setInfoWindowAnchor(0.5f, 0);
|
|
541
558
|
}
|
|
559
|
+
updated +=1;
|
|
542
560
|
}
|
|
543
561
|
|
|
544
562
|
public void update(int width, int height) {
|
|
545
563
|
this.width = width;
|
|
546
564
|
this.height = height;
|
|
547
|
-
|
|
565
|
+
updated +=1;
|
|
566
|
+
updateTracksViewChanges();
|
|
567
|
+
clearDrawableCache();
|
|
548
568
|
update(true);
|
|
549
569
|
}
|
|
550
570
|
|
|
571
|
+
public void redraw() {
|
|
572
|
+
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
573
|
+
@Override
|
|
574
|
+
public void run() {
|
|
575
|
+
updateMarkerIcon();
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
551
580
|
private Bitmap mLastBitmapCreated = null;
|
|
552
581
|
|
|
553
582
|
private void clearDrawableCache() {
|
|
@@ -663,6 +692,14 @@ public class MapMarker extends MapFeature {
|
|
|
663
692
|
this.imageLoadedListener = imageLoadedListener;
|
|
664
693
|
}
|
|
665
694
|
|
|
695
|
+
public void setUpdated(boolean updated) {
|
|
696
|
+
if (updated) {
|
|
697
|
+
this.updated += 1;
|
|
698
|
+
} else {
|
|
699
|
+
this.updated = 0;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
666
703
|
@FunctionalInterface
|
|
667
704
|
public interface EventCreator<T extends Event> {
|
|
668
705
|
T create(int surfaceId, int viewId, WritableMap payload);
|
|
@@ -703,4 +740,10 @@ public class MapMarker extends MapFeature {
|
|
|
703
740
|
);
|
|
704
741
|
}
|
|
705
742
|
|
|
743
|
+
@Override
|
|
744
|
+
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
745
|
+
super.onLayout(changed, l, t, r, b);
|
|
746
|
+
this.height = b-t;
|
|
747
|
+
this.width = r-l;
|
|
748
|
+
}
|
|
706
749
|
}
|
|
@@ -41,6 +41,8 @@ public class MapPolyline extends MapFeature {
|
|
|
41
41
|
private ReadableArray patternValues;
|
|
42
42
|
private List<PatternItem> pattern;
|
|
43
43
|
|
|
44
|
+
private List<StyleSpan> spans;
|
|
45
|
+
|
|
44
46
|
public MapPolyline(Context context) {
|
|
45
47
|
super(context);
|
|
46
48
|
}
|
|
@@ -76,8 +78,10 @@ public class MapPolyline extends MapFeature {
|
|
|
76
78
|
}
|
|
77
79
|
spans.add(new StyleSpan(stroke));
|
|
78
80
|
}
|
|
79
|
-
|
|
81
|
+
this.spans = spans;
|
|
82
|
+
if (polyline != null){
|
|
80
83
|
polyline.setSpans(spans);
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
public void setWidth(float width) {
|
|
@@ -178,6 +182,9 @@ public class MapPolyline extends MapFeature {
|
|
|
178
182
|
PolylineManager.Collection polylineCollection = (PolylineManager.Collection) collection;
|
|
179
183
|
polyline = polylineCollection.addPolyline(getPolylineOptions());
|
|
180
184
|
polyline.setClickable(this.tappable);
|
|
185
|
+
if (spans != null){
|
|
186
|
+
polyline.setSpans(spans);
|
|
187
|
+
}
|
|
181
188
|
}
|
|
182
189
|
|
|
183
190
|
@Override
|