react-native-maps 1.21.0-alpha.11 → 1.21.0-alpha.111
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/build.gradle +77 -57
- package/android/gradlew +1 -2
- package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
- package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
- package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +619 -0
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +258 -0
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +235 -2
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +95 -0
- package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +89 -0
- package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -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 +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnKmlReadyEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +39 -3
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
- package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +637 -556
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +267 -151
- package/android/src/main/java/com/rnmaps/maps/MapPolygon.java +31 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
- package/android/src/main/java/com/rnmaps/maps/MapView.java +1650 -1337
- package/ios/AirGoogleMaps/AIRGMSMarker.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMap.h +9 -10
- package/ios/AirGoogleMaps/AIRGoogleMap.m +112 -74
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +10 -9
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +2 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +30 -0
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +0 -1
- package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +0 -7
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +4 -4
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +137 -57
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +26 -0
- package/ios/AirMaps/AIRMap.h +7 -7
- package/ios/AirMaps/AIRMap.m +227 -236
- package/ios/AirMaps/AIRMapManager.m +13 -7
- package/ios/AirMaps/AIRMapMarker.h +1 -0
- package/ios/AirMaps/AIRMapMarker.m +165 -103
- package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
- package/ios/AirMaps/NSObject+DynamicLoad.h +16 -0
- package/ios/AirMaps/NSObject+DynamicLoad.m +28 -0
- package/ios/AirMaps/RNMapsAirModule.h +1 -1
- package/ios/AirMaps/RNMapsAirModule.mm +4 -3
- package/ios/AirMaps/RNMapsAirModuleDelegate.h +2 -2
- package/ios/AirMaps/RNMapsMapView.mm +332 -295
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +28 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +20 -0
- package/lib/MapCircle.d.ts +1 -1
- package/lib/MapHeatmap.d.ts +2 -2
- package/lib/MapHeatmap.js +1 -1
- package/lib/MapMarker.d.ts +16 -3
- package/lib/MapMarker.js +55 -13
- package/lib/MapMarkerNativeComponent.js +0 -2
- package/lib/MapOverlay.d.ts +1 -0
- package/lib/MapOverlay.js +11 -9
- package/lib/MapPolygon.d.ts +1 -1
- package/lib/MapPolyline.d.ts +7 -7
- package/lib/MapView.d.ts +17 -29
- package/lib/MapView.js +114 -128
- package/lib/MapView.types.d.ts +1 -1
- package/lib/createFabricMap.d.ts +1 -0
- package/lib/createFabricMap.js +17 -4
- package/lib/decorateMapComponent.js +40 -0
- package/lib/fixImageProp.d.ts +4 -0
- package/lib/fixImageProp.js +16 -0
- package/lib/specs/NativeAirMapsModule.d.ts +2 -2
- package/lib/specs/NativeComponentCallout.d.ts +46 -0
- package/lib/specs/NativeComponentCallout.js +9 -0
- package/lib/specs/NativeComponentCircle.d.ts +74 -0
- package/lib/specs/NativeComponentCircle.js +7 -0
- package/lib/specs/NativeComponentGoogleMapView.d.ts +19 -22
- package/lib/specs/NativeComponentGoogleMapView.js +1 -0
- package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
- package/lib/specs/NativeComponentGooglePolygon.js +7 -0
- package/lib/specs/NativeComponentMapView.d.ts +43 -56
- package/lib/specs/NativeComponentMapView.js +2 -3
- package/lib/specs/NativeComponentMarker.d.ts +258 -0
- package/lib/specs/NativeComponentMarker.js +19 -0
- package/lib/specs/NativeComponentOverlay.d.ts +67 -0
- package/lib/specs/NativeComponentOverlay.js +7 -0
- package/lib/specs/NativeComponentPolyline.d.ts +101 -0
- package/lib/specs/NativeComponentPolyline.js +7 -0
- package/package.json +21 -19
- package/react-native-maps.podspec +15 -15
- package/specs/NativeAirMapsModule.ts +36 -0
- package/specs/NativeComponentCallout.ts +63 -0
- package/specs/NativeComponentCircle.ts +94 -0
- package/specs/NativeComponentGoogleMapView.ts +913 -0
- package/specs/NativeComponentGooglePolygon.ts +94 -0
- package/specs/NativeComponentMapView.ts +1059 -0
- package/specs/NativeComponentMarker.ts +326 -0
- package/specs/NativeComponentOverlay.ts +89 -0
- package/specs/NativeComponentPolyline.ts +124 -0
|
@@ -86,7 +86,7 @@ RCT_EXPORT_METHOD(redrawCallout:(nonnull NSNumber *)reactTag)
|
|
|
86
86
|
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
87
87
|
} else {
|
|
88
88
|
AIRGoogleMapMarker* marker = (AIRGoogleMapMarker *) view;
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
[NSTimer scheduledTimerWithTimeInterval:0.0
|
|
91
91
|
target:[NSBlockOperation blockOperationWithBlock:^{
|
|
92
92
|
[marker hideCalloutView];
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#import <React/RCTBridge.h>
|
|
11
11
|
#import "AIRGMSPolygon.h"
|
|
12
12
|
#import "AIRGoogleMapCoordinate.h"
|
|
13
|
+
#import "AIRGoogleMap.h"
|
|
13
14
|
|
|
14
15
|
@interface AIRGoogleMapPolygon : UIView
|
|
15
16
|
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
@property (nonatomic, assign) BOOL geodesic;
|
|
27
28
|
@property (nonatomic, assign) int zIndex;
|
|
28
29
|
@property (nonatomic, assign) BOOL tappable;
|
|
29
|
-
|
|
30
|
+
- (void) didInsertInMap:(AIRGoogleMap *) map;
|
|
30
31
|
@end
|
|
31
32
|
|
|
32
33
|
#endif
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#import "AIRGoogleMapPolygon.h"
|
|
10
10
|
#import "AIRGMSPolygon.h"
|
|
11
11
|
#import <GoogleMaps/GoogleMaps.h>
|
|
12
|
+
#import "AIRGoogleMap.h"
|
|
12
13
|
|
|
13
14
|
@implementation AIRGoogleMapPolygon
|
|
14
15
|
{
|
|
@@ -41,6 +42,35 @@
|
|
|
41
42
|
_polygon.strokeWidth = _strokeWidth;
|
|
42
43
|
}
|
|
43
44
|
}
|
|
45
|
+
- (void) didInsertInMap:(AIRGoogleMap *) map
|
|
46
|
+
{
|
|
47
|
+
_polygon = [AIRGMSPolygon new];
|
|
48
|
+
|
|
49
|
+
if (_identifier){
|
|
50
|
+
[_polygon setIdentifier:_identifier];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[_polygon setTappable:_tappable];
|
|
54
|
+
if (_strokeColor){
|
|
55
|
+
_polygon.strokeColor = _strokeColor;
|
|
56
|
+
}
|
|
57
|
+
if (_fillColor){
|
|
58
|
+
_polygon.fillColor = _fillColor;
|
|
59
|
+
}
|
|
60
|
+
if (_strokeWidth){
|
|
61
|
+
_polygon.strokeWidth = _strokeWidth;
|
|
62
|
+
}
|
|
63
|
+
if (_coordinates){
|
|
64
|
+
[self setCoordinates:_coordinates];
|
|
65
|
+
}
|
|
66
|
+
if (_holes){
|
|
67
|
+
[self setHoles:_holes];
|
|
68
|
+
}
|
|
69
|
+
if (_zIndex){
|
|
70
|
+
_polygon.zIndex = _zIndex;
|
|
71
|
+
}
|
|
72
|
+
[_polygon setMap:map];
|
|
73
|
+
}
|
|
44
74
|
|
|
45
75
|
- (void)setCoordinates:(NSArray<AIRGoogleMapCoordinate *> *)coordinates
|
|
46
76
|
{
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
@property (nonatomic, strong) UIColor *strokeColor;
|
|
26
26
|
@property (nonatomic, strong) NSArray<UIColor *> *strokeColors;
|
|
27
27
|
@property (nonatomic, assign) double strokeWidth;
|
|
28
|
-
@property (nonatomic, assign) UIColor *fillColor;
|
|
29
28
|
@property (nonatomic, strong) NSArray<NSNumber *> *lineDashPattern;
|
|
30
29
|
@property (nonatomic, assign) BOOL geodesic;
|
|
31
30
|
@property (nonatomic, assign) NSString *title;
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
{
|
|
20
20
|
if (self = [super init]) {
|
|
21
21
|
_polyline = [[AIRGMSPolyline alloc] init];
|
|
22
|
-
_polyline.spans = @[[GMSStyleSpan spanWithColor:_strokeColor]];
|
|
23
22
|
_polyline.strokeColor = _strokeColor;
|
|
24
23
|
}
|
|
25
24
|
return self;
|
|
@@ -79,12 +78,6 @@
|
|
|
79
78
|
_polyline.strokeWidth = strokeWidth;
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
-(void)setFillColor:(UIColor *)fillColor
|
|
83
|
-
{
|
|
84
|
-
_fillColor = fillColor;
|
|
85
|
-
_polyline.spans = @[[GMSStyleSpan spanWithColor:fillColor]];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
81
|
- (void)setLineDashPattern:(NSArray<NSNumber *> *)lineDashPattern {
|
|
89
82
|
_lineDashPattern = lineDashPattern;
|
|
90
83
|
[self configureStyleSpansIfNeeded];
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
NSInteger *maximumZ = self.maximumZ;
|
|
29
29
|
NSInteger *minimumZ = self.minimumZ;
|
|
30
30
|
GMSTileURLConstructor urls = ^NSURL* _Nullable (NSUInteger x, NSUInteger y, NSUInteger zoom) {
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
if (self.flipY == YES) {
|
|
33
33
|
y = (1 << zoom) - y - 1;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
NSString *url = urlTemplate;
|
|
37
37
|
url = [url stringByReplacingOccurrencesOfString:@"{x}" withString:[NSString stringWithFormat: @"%ld", (long)x]];
|
|
38
38
|
url = [url stringByReplacingOccurrencesOfString:@"{y}" withString:[NSString stringWithFormat: @"%ld", (long)y]];
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
@interface WMSTileOverlay : GMSSyncTileLayer
|
|
15
15
|
@property (nonatomic) double MapX,MapY,FULL;
|
|
16
|
-
@property (nonatomic,
|
|
16
|
+
@property (nonatomic, assign) NSString *urlTemplate;
|
|
17
17
|
@property (nonatomic, assign) NSInteger maximumZ;
|
|
18
18
|
@property (nonatomic, assign) NSInteger minimumZ;
|
|
19
19
|
@end
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
{
|
|
63
63
|
_urlTemplate = urlTemplate;
|
|
64
64
|
WMSTileOverlay *tile = [[WMSTileOverlay alloc] init];
|
|
65
|
-
[tile
|
|
65
|
+
[tile setUrlTemplate:urlTemplate];
|
|
66
66
|
[tile setMaximumZ: _maximumZ];
|
|
67
67
|
[tile setMinimumZ: _minimumZ];
|
|
68
68
|
[tile setOpacity: _opacity];
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
[NSNumber numberWithDouble:_MapX + (double)(x+1) * tile ],
|
|
92
92
|
[NSNumber numberWithDouble:_MapY - (double)y * tile ],
|
|
93
93
|
nil];
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
return result;
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
- (UIImage *)tileForX:(NSUInteger)x y:(NSUInteger)y zoom:(NSUInteger)zoom
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
return nil;
|
|
108
108
|
}
|
|
109
109
|
NSArray *bb = [self getBoundBox:x yAxis:y zoom:zoom];
|
|
110
|
-
NSMutableString *url = [self.
|
|
110
|
+
NSMutableString *url = [self.urlTemplate mutableCopy];
|
|
111
111
|
[url replaceOccurrencesOfString: @"{minX}" withString:[NSString stringWithFormat:@"%@", bb[0]] options:0 range:NSMakeRange(0, url.length)];
|
|
112
112
|
[url replaceOccurrencesOfString: @"{minY}" withString:[NSString stringWithFormat:@"%@", bb[1]] options:0 range:NSMakeRange(0, url.length)];
|
|
113
113
|
[url replaceOccurrencesOfString: @"{maxX}" withString:[NSString stringWithFormat:@"%@", bb[2]] options:0 range:NSMakeRange(0, url.length)];
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
+ (AIRGoogleMapCoordinate *)AIRGoogleMapCoordinate:(id)json
|
|
35
35
|
{
|
|
36
|
+
// empty coordinates
|
|
37
|
+
if ([json isKindOfClass:[NSArray class]] && [json count] == 0) return nil;
|
|
36
38
|
AIRGoogleMapCoordinate *coord = [AIRGoogleMapCoordinate new];
|
|
37
39
|
coord.coordinate = [self CLLocationCoordinate2D:json];
|
|
38
40
|
return coord;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
// RNMapsGoogleMapView.mm
|
|
3
|
-
//
|
|
3
|
+
//
|
|
4
4
|
//
|
|
5
5
|
// Created by Salah Ghanim on 23.11.24.
|
|
6
6
|
// Copyright © 2024 react-native-maps. All rights reserved.
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
#ifdef HAVE_GOOGLE_MAPS
|
|
9
9
|
|
|
10
10
|
#import "RNMapsGoogleMapView.h"
|
|
11
|
-
#import "
|
|
11
|
+
#import "RNMapsGooglePolygonView.h"
|
|
12
|
+
#import "AIRGoogleMap.h"
|
|
12
13
|
#import "AIRMapMarker.h"
|
|
13
|
-
#import "
|
|
14
|
-
|
|
14
|
+
#import "AIRGoogleMapManager.h"
|
|
15
15
|
#import <react/renderer/components/RNMapsSpecs/ComponentDescriptors.h>
|
|
16
16
|
#import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
|
|
17
17
|
#import <react/renderer/components/RNMapsSpecs/Props.h>
|
|
18
18
|
#import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
|
|
19
|
-
|
|
20
19
|
#import "RCTFabricComponentsPlugins.h"
|
|
21
20
|
#import <React/RCTConversions.h>
|
|
21
|
+
#import <React/RCTUtils.h>
|
|
22
22
|
#import "RCTConvert+GMSMapViewType.h"
|
|
23
23
|
#import "RCTConvert+AirMap.h"
|
|
24
24
|
#import "UIView+AirMap.h"
|
|
@@ -32,6 +32,7 @@ using namespace facebook::react;
|
|
|
32
32
|
AIRGoogleMap *_view;
|
|
33
33
|
AIRGoogleMapManager* _legacyMapManager;
|
|
34
34
|
NSMutableDictionary<NSNumber*, UIView*>* _pendingInsertsSubviews;
|
|
35
|
+
NSMutableArray *_polygons;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
|
|
@@ -43,11 +44,12 @@ using namespace facebook::react;
|
|
|
43
44
|
- (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration{
|
|
44
45
|
NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
|
|
45
46
|
MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
|
|
46
|
-
[CATransaction begin];
|
|
47
|
-
[CATransaction setAnimationDuration:duration/1000];
|
|
48
47
|
GMSCameraPosition *camera = [AIRGoogleMap makeGMSCameraPositionFromMap:_view andMKCoordinateRegion:region];
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (duration == 0){
|
|
49
|
+
[_view setRegion:region];
|
|
50
|
+
} else {
|
|
51
|
+
[_view animateToCameraPosition:camera];
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
- (void)setCamera:(NSString *)cameraJSON{
|
|
53
55
|
NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
|
|
@@ -80,9 +82,19 @@ using namespace facebook::react;
|
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
NSDictionary* edgePadding = [RCTConvert dictonaryFromString:edgePaddingJSON];
|
|
83
|
-
|
|
85
|
+
|
|
84
86
|
[_view fitToCoordinates:coordinatesArray withEdgePadding:edgePadding animated:animated];
|
|
85
87
|
}
|
|
88
|
+
- (void) setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex
|
|
89
|
+
{
|
|
90
|
+
if (!_view.indoorDisplay) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if ( activeLevelIndex < [_view.indoorDisplay.activeBuilding.levels count]) {
|
|
94
|
+
_view.indoorDisplay.activeLevel = _view.indoorDisplay.activeBuilding.levels[activeLevelIndex];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|
|
86
98
|
|
|
87
99
|
#pragma mark - Native commands
|
|
88
100
|
|
|
@@ -111,9 +123,10 @@ using namespace facebook::react;
|
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
- (void) prepareContentView {
|
|
114
|
-
|
|
126
|
+
|
|
115
127
|
_view = (AIRGoogleMap *)[_legacyMapManager view];
|
|
116
|
-
|
|
128
|
+
_polygons = [NSMutableArray new];
|
|
129
|
+
|
|
117
130
|
self.contentView = _view;
|
|
118
131
|
|
|
119
132
|
_view.onPress = [self](NSDictionary* dictionary) {
|
|
@@ -143,7 +156,7 @@ using namespace facebook::react;
|
|
|
143
156
|
mapViewEventEmitter->onPress(data);
|
|
144
157
|
}
|
|
145
158
|
};
|
|
146
|
-
|
|
159
|
+
|
|
147
160
|
_view.onLongPress = [self](NSDictionary* dictionary) {
|
|
148
161
|
if (_eventEmitter) {
|
|
149
162
|
// Extract values from the NSDictionary
|
|
@@ -180,7 +193,37 @@ using namespace facebook::react;
|
|
|
180
193
|
mapViewEventEmitter->onMapReady(data);
|
|
181
194
|
}
|
|
182
195
|
};
|
|
183
|
-
|
|
196
|
+
|
|
197
|
+
_view.onIndoorLevelActivated = [self](NSDictionary* dictionary) {
|
|
198
|
+
if (_eventEmitter) {
|
|
199
|
+
|
|
200
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
201
|
+
|
|
202
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorLevelActivated data = {
|
|
203
|
+
.activeLevelIndex= (int) [dictionary[@"activeLevelIndex"] integerValue],
|
|
204
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
205
|
+
.shortName = [dictionary[@"shortName"] UTF8String],
|
|
206
|
+
};
|
|
207
|
+
mapViewEventEmitter->onIndoorLevelActivated(data);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
_view.onIndoorBuildingFocused = [self](NSDictionary* dictionary) {
|
|
212
|
+
if (_eventEmitter) {
|
|
213
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
214
|
+
|
|
215
|
+
NSError *jsError = nil;
|
|
216
|
+
NSString *levelsStr = RCTJSONStringify(dictionary[@"levels"], &jsError);
|
|
217
|
+
|
|
218
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorBuildingFocused data = {
|
|
219
|
+
.underground = [dictionary[@"underground"] boolValue],
|
|
220
|
+
.activeLevelIndex = (int) [dictionary[@"activeLevelIndex"] integerValue],
|
|
221
|
+
.levels = [levelsStr UTF8String]
|
|
222
|
+
};
|
|
223
|
+
mapViewEventEmitter->onIndoorBuildingFocused(data);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
184
227
|
_view.onMapLoaded = [self](NSDictionary* dictionary) {
|
|
185
228
|
if (_eventEmitter) {
|
|
186
229
|
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
@@ -188,7 +231,7 @@ using namespace facebook::react;
|
|
|
188
231
|
mapViewEventEmitter->onMapLoaded(data);
|
|
189
232
|
}
|
|
190
233
|
};
|
|
191
|
-
|
|
234
|
+
|
|
192
235
|
_view.onKmlReady = [self](NSDictionary* dictionary) {
|
|
193
236
|
if (_eventEmitter) {
|
|
194
237
|
|
|
@@ -197,7 +240,7 @@ using namespace facebook::react;
|
|
|
197
240
|
mapViewEventEmitter->onKmlReady(data);
|
|
198
241
|
}
|
|
199
242
|
};
|
|
200
|
-
_view.
|
|
243
|
+
_view.onRegionChange = [self](NSDictionary* dictionary) {
|
|
201
244
|
if (_eventEmitter) {
|
|
202
245
|
|
|
203
246
|
NSDictionary* regionDict = dictionary[@"region"];
|
|
@@ -256,7 +299,7 @@ using namespace facebook::react;
|
|
|
256
299
|
if (errorDict){
|
|
257
300
|
str = errorDict[@"message"];
|
|
258
301
|
}
|
|
259
|
-
|
|
302
|
+
|
|
260
303
|
facebook::react::RNMapsGoogleMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
261
304
|
.message = std::string([str UTF8String]),
|
|
262
305
|
};
|
|
@@ -271,6 +314,35 @@ using namespace facebook::react;
|
|
|
271
314
|
}
|
|
272
315
|
};
|
|
273
316
|
|
|
317
|
+
_view.onPoiClick = [self](NSDictionary* dictionary) {
|
|
318
|
+
if (_eventEmitter) {
|
|
319
|
+
|
|
320
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
321
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
322
|
+
|
|
323
|
+
// Populate the OnMapPressCoordinate struct
|
|
324
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClickCoordinate coordinate = {
|
|
325
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
326
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
327
|
+
};
|
|
328
|
+
// Populate the OnMapDouplePressPosition struct
|
|
329
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClickPosition position = {
|
|
330
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
331
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
336
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClick data = {
|
|
337
|
+
.coordinate = coordinate,
|
|
338
|
+
.position = position,
|
|
339
|
+
.placeId = [dictionary[@"placeId"] UTF8String],
|
|
340
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
341
|
+
};
|
|
342
|
+
mapViewEventEmitter->onPoiClick(data);
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
274
346
|
|
|
275
347
|
|
|
276
348
|
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
@@ -288,23 +360,7 @@ using namespace facebook::react;
|
|
|
288
360
|
mapViewEventEmitter->onRegionChangeStart(data);
|
|
289
361
|
}
|
|
290
362
|
};
|
|
291
|
-
|
|
292
|
-
_view.onRegionChange = [self](NSDictionary* dictionary) {
|
|
293
|
-
if (_eventEmitter) {
|
|
294
363
|
|
|
295
|
-
NSDictionary* regionDict = dictionary[@"region"];
|
|
296
|
-
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
297
|
-
facebook::react::RNMapsGoogleMapViewEventEmitter::OnRegionChange data = {
|
|
298
|
-
.region.latitude = [regionDict[@"latitude"] doubleValue],
|
|
299
|
-
.region.longitude = [regionDict[@"longitude"] doubleValue],
|
|
300
|
-
.region.latitudeDelta = [regionDict[@"latitudeDelta"] doubleValue],
|
|
301
|
-
.region.longitudeDelta = [regionDict[@"longitudeDelta"] doubleValue],
|
|
302
|
-
.continuous = [dictionary[@"continuous"] boolValue],
|
|
303
|
-
};
|
|
304
|
-
mapViewEventEmitter->onRegionChange(data);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
|
|
308
364
|
_view.onRegionChangeComplete = [self](NSDictionary* dictionary) {
|
|
309
365
|
if (_eventEmitter) {
|
|
310
366
|
|
|
@@ -389,8 +445,16 @@ using namespace facebook::react;
|
|
|
389
445
|
} else {
|
|
390
446
|
[_pendingInsertsSubviews setObject:paperView forKey:[NSNumber numberWithInteger:index]];
|
|
391
447
|
}
|
|
448
|
+
} else {
|
|
449
|
+
[_view insertReactSubview:childComponentView atIndex:index];
|
|
450
|
+
if ([childComponentView isKindOfClass:[RNMapsGooglePolygonView class]]){
|
|
451
|
+
RNMapsGooglePolygonView* polygon = (RNMapsGooglePolygonView *) childComponentView;
|
|
452
|
+
[_polygons addObject:childComponentView];
|
|
453
|
+
[polygon didInsertInMap:_view];
|
|
454
|
+
}
|
|
392
455
|
}
|
|
393
456
|
}
|
|
457
|
+
|
|
394
458
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
395
459
|
{
|
|
396
460
|
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
@@ -400,15 +464,32 @@ using namespace facebook::react;
|
|
|
400
464
|
} else {
|
|
401
465
|
[_pendingInsertsSubviews removeObjectForKey:[NSNumber numberWithInteger:index]];
|
|
402
466
|
}
|
|
467
|
+
} else {
|
|
468
|
+
[_view removeReactSubview:childComponentView];
|
|
469
|
+
if ([childComponentView isKindOfClass:[RNMapsGooglePolygonView class]]){
|
|
470
|
+
RNMapsGooglePolygonView* polygon = (RNMapsGooglePolygonView *) childComponentView;
|
|
471
|
+
[_polygons removeObject:childComponentView];
|
|
472
|
+
[polygon didRemoveFromMap];
|
|
473
|
+
}
|
|
403
474
|
}
|
|
404
475
|
}
|
|
476
|
+
- (void) prepareForRecycle
|
|
477
|
+
{
|
|
478
|
+
[super prepareForRecycle];
|
|
479
|
+
static const auto defaultProps = std::make_shared<const RNMapsGoogleMapViewProps>();
|
|
480
|
+
_props = defaultProps;
|
|
481
|
+
_legacyMapManager = [[AIRGoogleMapManager alloc] init];
|
|
482
|
+
_pendingInsertsSubviews = [NSMutableDictionary new];
|
|
483
|
+
[_view removeFromSuperview];
|
|
484
|
+
_view = nil;
|
|
485
|
+
}
|
|
405
486
|
|
|
406
487
|
|
|
407
488
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
408
489
|
{
|
|
409
490
|
const auto &oldViewProps = *std::static_pointer_cast<RNMapsGoogleMapViewProps const>(_props);
|
|
410
491
|
const auto &newViewProps = *std::static_pointer_cast<RNMapsGoogleMapViewProps const>(props);
|
|
411
|
-
|
|
492
|
+
|
|
412
493
|
|
|
413
494
|
if (oldViewProps.googleMapId != newViewProps.googleMapId) {
|
|
414
495
|
NSString* mapID = RCTNSStringFromString(newViewProps.googleMapId);
|
|
@@ -440,7 +521,7 @@ using namespace facebook::react;
|
|
|
440
521
|
_legacyMapManager.camera = camera;
|
|
441
522
|
}
|
|
442
523
|
|
|
443
|
-
|
|
524
|
+
|
|
444
525
|
|
|
445
526
|
if (!_view){
|
|
446
527
|
[self prepareContentView];
|
|
@@ -474,20 +555,6 @@ using namespace facebook::react;
|
|
|
474
555
|
_view.name = region; \
|
|
475
556
|
}
|
|
476
557
|
|
|
477
|
-
#define REMAP_GOOGLEMAPVIEW_CAMERA_PROP(name) \
|
|
478
|
-
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
479
|
-
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
|
480
|
-
newViewProps.name.heading != oldViewProps.name.heading || \
|
|
481
|
-
newViewProps.name.pitch != oldViewProps.name.pitch || \
|
|
482
|
-
newViewProps.name.zoom != oldViewProps.name.zoom) { \
|
|
483
|
-
GMSCameraPosition* camera = [GMSCameraPosition cameraWithLatitude:newViewProps.name.center.latitude \
|
|
484
|
-
longitude:newViewProps.name.center.longitude \
|
|
485
|
-
zoom:newViewProps.name.zoom \
|
|
486
|
-
bearing:newViewProps.name.heading \
|
|
487
|
-
viewingAngle:newViewProps.name.pitch]; \
|
|
488
|
-
_view.name = camera; \
|
|
489
|
-
}
|
|
490
|
-
|
|
491
558
|
|
|
492
559
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
493
560
|
if (newViewProps.name.top != oldViewProps.name.top || \
|
|
@@ -502,16 +569,16 @@ using namespace facebook::react;
|
|
|
502
569
|
|
|
503
570
|
|
|
504
571
|
REMAP_MAPVIEW_PROP(pitchEnabled)
|
|
505
|
-
|
|
506
572
|
REMAP_MAPVIEW_PROP(zoomTapEnabled)
|
|
507
|
-
|
|
508
573
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
509
|
-
|
|
574
|
+
|
|
575
|
+
REMAP_MAPVIEW_STRING_PROP(kmlSrc)
|
|
576
|
+
|
|
510
577
|
if (newViewProps.minZoom != oldViewProps.minZoom || newViewProps.maxZoom != oldViewProps.maxZoom){
|
|
511
578
|
[_view setMinZoom:newViewProps.minZoom maxZoom:newViewProps.maxZoom];
|
|
512
579
|
}
|
|
513
580
|
|
|
514
|
-
|
|
581
|
+
[_view setShowsCompass:newViewProps.showsCompass];
|
|
515
582
|
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
516
583
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
517
584
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
@@ -520,9 +587,20 @@ using namespace facebook::react;
|
|
|
520
587
|
REMAP_MAPVIEW_REGION_PROP(region)
|
|
521
588
|
REMAP_MAPVIEW_REGION_PROP(initialRegion)
|
|
522
589
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
590
|
+
if (newViewProps.camera.center.latitude != oldViewProps.camera.center.latitude ||
|
|
591
|
+
newViewProps.camera.center.longitude != oldViewProps.camera.center.longitude ||
|
|
592
|
+
newViewProps.camera.heading != oldViewProps.camera.heading ||
|
|
593
|
+
newViewProps.camera.pitch != oldViewProps.camera.pitch ||
|
|
594
|
+
newViewProps.camera.zoom != oldViewProps.camera.zoom) {
|
|
595
|
+
GMSCameraPosition* camera = [GMSCameraPosition cameraWithLatitude:newViewProps.camera.center.latitude
|
|
596
|
+
longitude:newViewProps.camera.center.longitude
|
|
597
|
+
zoom:newViewProps.camera.zoom
|
|
598
|
+
bearing:newViewProps.camera.heading
|
|
599
|
+
viewingAngle:newViewProps.camera.pitch];
|
|
600
|
+
_view.cameraProp = camera;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
|
|
526
604
|
REMAP_MAPVIEW_EDGEINSETS_PROP(mapPadding)
|
|
527
605
|
|
|
528
606
|
|
|
@@ -536,14 +614,16 @@ using namespace facebook::react;
|
|
|
536
614
|
break;
|
|
537
615
|
case RNMapsGoogleMapViewMapType::Terrain:
|
|
538
616
|
_view.mapType = kGMSTypeTerrain;
|
|
617
|
+
break;
|
|
539
618
|
case RNMapsGoogleMapViewMapType::Hybrid:
|
|
540
619
|
_view.mapType = kGMSTypeHybrid;
|
|
620
|
+
break;
|
|
541
621
|
default:
|
|
542
622
|
_view.mapType = kGMSTypeNormal;
|
|
543
623
|
break;
|
|
544
624
|
}
|
|
545
625
|
}
|
|
546
|
-
|
|
626
|
+
|
|
547
627
|
if (oldViewProps.userInterfaceStyle != newViewProps.userInterfaceStyle){
|
|
548
628
|
switch (newViewProps.userInterfaceStyle) {
|
|
549
629
|
case RNMapsGoogleMapViewUserInterfaceStyle::Light:
|
|
@@ -18,7 +18,22 @@
|
|
|
18
18
|
|
|
19
19
|
RCT_EXPORT_MODULE(RNMapsGoogleMapViewManager)
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTDirectEventBlock)
|
|
22
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTDirectEventBlock)
|
|
23
|
+
RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTDirectEventBlock)
|
|
24
|
+
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
25
|
+
RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
26
|
+
RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTDirectEventBlock)
|
|
27
|
+
RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTDirectEventBlock)
|
|
28
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
29
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerDeselect, RCTDirectEventBlock)
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
33
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
34
|
+
RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
|
|
35
|
+
RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
|
|
36
|
+
RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
|
|
22
37
|
|
|
23
38
|
@end
|
|
24
39
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNMapsGoogleMapView.h
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Created by Salah Ghanim on 23.11.24.
|
|
6
|
+
// Copyright © 2024 react-native-maps. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
#ifdef HAVE_GOOGLE_MAPS
|
|
10
|
+
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <UIKit/UIKit.h>
|
|
13
|
+
|
|
14
|
+
@class AIRGoogleMap;
|
|
15
|
+
@class AIRGMSPolygon;
|
|
16
|
+
|
|
17
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
18
|
+
@interface RNMapsGooglePolygonView : RCTViewComponentView
|
|
19
|
+
- (void) didInsertInMap:(AIRGoogleMap*) map;
|
|
20
|
+
- (void) didRemoveFromMap;
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
NS_ASSUME_NONNULL_END
|
|
24
|
+
|
|
25
|
+
#endif
|
|
26
|
+
#endif
|