react-native-maps 1.21.0-alpha.10 → 1.21.0-alpha.100
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/gradle/wrapper/gradle-wrapper.properties +1 -1
- 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 +79 -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 +1654 -1337
- package/ios/AirGoogleMaps/AIRGoogleMap.m +102 -58
- package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +3 -1
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
- 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/AIRGoogleMapWMSTile.h +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
- package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +143 -54
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
- package/ios/AirMaps/AIRMap.h +2 -1
- package/ios/AirMaps/AIRMap.m +227 -236
- package/ios/AirMaps/AIRMapManager.m +6 -0
- 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/RNMapsAirModule.h +1 -1
- package/ios/AirMaps/RNMapsAirModule.mm +4 -3
- package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
- package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
- package/ios/AirMaps/RNMapsMapView.mm +335 -303
- package/ios/AirMaps/RNMapsMarkerView.h +24 -0
- package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +21 -0
- package/ios/AirMaps/UIView +AirMap.m +20 -0
- package/ios/AirMaps/UIView+AirMap.h +11 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +60 -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 +15 -27
- package/lib/MapView.js +109 -124
- 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 +15 -15
- 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 +28 -36
- 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 +24 -22
- package/react-native-maps.podspec +61 -16
- package/specs/NativeAirMapsModule.ts +36 -0
- package/specs/NativeComponentCallout.ts +63 -0
- package/specs/NativeComponentCircle.ts +94 -0
- package/specs/NativeComponentGoogleMapView.ts +916 -0
- package/specs/NativeComponentGooglePolygon.ts +94 -0
- package/specs/NativeComponentMapView.ts +1071 -0
- package/specs/NativeComponentMarker.ts +326 -0
- package/specs/NativeComponentOverlay.ts +89 -0
- package/specs/NativeComponentPolyline.ts +124 -0
|
@@ -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];
|
|
@@ -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];
|
|
@@ -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,20 +8,19 @@
|
|
|
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>
|
|
22
21
|
#import "RCTConvert+GMSMapViewType.h"
|
|
23
22
|
#import "RCTConvert+AirMap.h"
|
|
24
|
-
|
|
23
|
+
#import "UIView+AirMap.h"
|
|
25
24
|
|
|
26
25
|
using namespace facebook::react;
|
|
27
26
|
|
|
@@ -32,6 +31,7 @@ using namespace facebook::react;
|
|
|
32
31
|
AIRGoogleMap *_view;
|
|
33
32
|
AIRGoogleMapManager* _legacyMapManager;
|
|
34
33
|
NSMutableDictionary<NSNumber*, UIView*>* _pendingInsertsSubviews;
|
|
34
|
+
NSMutableArray *_polygons;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
@@ -43,11 +43,12 @@ using namespace facebook::react;
|
|
|
43
43
|
- (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration{
|
|
44
44
|
NSDictionary* regionDic = [RCTConvert dictonaryFromString:regionJSON];
|
|
45
45
|
MKCoordinateRegion region = [RCTConvert MKCoordinateRegion:regionDic];
|
|
46
|
-
[CATransaction begin];
|
|
47
|
-
[CATransaction setAnimationDuration:duration/1000];
|
|
48
46
|
GMSCameraPosition *camera = [AIRGoogleMap makeGMSCameraPositionFromMap:_view andMKCoordinateRegion:region];
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
if (duration == 0){
|
|
48
|
+
[_view setRegion:region];
|
|
49
|
+
} else {
|
|
50
|
+
[_view animateToCameraPosition:camera];
|
|
51
|
+
}
|
|
51
52
|
}
|
|
52
53
|
- (void)setCamera:(NSString *)cameraJSON{
|
|
53
54
|
NSDictionary* cameraDic = [RCTConvert dictonaryFromString:cameraJSON];
|
|
@@ -80,9 +81,19 @@ using namespace facebook::react;
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
NSDictionary* edgePadding = [RCTConvert dictonaryFromString:edgePaddingJSON];
|
|
83
|
-
|
|
84
|
+
|
|
84
85
|
[_view fitToCoordinates:coordinatesArray withEdgePadding:edgePadding animated:animated];
|
|
85
86
|
}
|
|
87
|
+
- (void) setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex
|
|
88
|
+
{
|
|
89
|
+
if (!_view.indoorDisplay) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if ( activeLevelIndex < [_view.indoorDisplay.activeBuilding.levels count]) {
|
|
93
|
+
_view.indoorDisplay.activeLevel = _view.indoorDisplay.activeBuilding.levels[activeLevelIndex];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
86
97
|
|
|
87
98
|
#pragma mark - Native commands
|
|
88
99
|
|
|
@@ -111,9 +122,10 @@ using namespace facebook::react;
|
|
|
111
122
|
}
|
|
112
123
|
|
|
113
124
|
- (void) prepareContentView {
|
|
114
|
-
|
|
125
|
+
|
|
115
126
|
_view = (AIRGoogleMap *)[_legacyMapManager view];
|
|
116
|
-
|
|
127
|
+
_polygons = [NSMutableArray new];
|
|
128
|
+
|
|
117
129
|
self.contentView = _view;
|
|
118
130
|
|
|
119
131
|
_view.onPress = [self](NSDictionary* dictionary) {
|
|
@@ -143,7 +155,7 @@ using namespace facebook::react;
|
|
|
143
155
|
mapViewEventEmitter->onPress(data);
|
|
144
156
|
}
|
|
145
157
|
};
|
|
146
|
-
|
|
158
|
+
|
|
147
159
|
_view.onLongPress = [self](NSDictionary* dictionary) {
|
|
148
160
|
if (_eventEmitter) {
|
|
149
161
|
// Extract values from the NSDictionary
|
|
@@ -180,7 +192,40 @@ using namespace facebook::react;
|
|
|
180
192
|
mapViewEventEmitter->onMapReady(data);
|
|
181
193
|
}
|
|
182
194
|
};
|
|
183
|
-
|
|
195
|
+
|
|
196
|
+
_view.onIndoorLevelActivated = [self](NSDictionary* dictionary) {
|
|
197
|
+
if (_eventEmitter) {
|
|
198
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
199
|
+
|
|
200
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorLevelActivatedIndoorLevel level = {
|
|
201
|
+
.activeLevelIndex= (int) [dictionary[@"activeLevelIndex"] integerValue],
|
|
202
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
203
|
+
.shortName = [dictionary[@"shortName"] UTF8String],
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorLevelActivated data = {
|
|
207
|
+
.indoorLevel = level,
|
|
208
|
+
};
|
|
209
|
+
mapViewEventEmitter->onIndoorLevelActivated(data);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
_view.onIndoorBuildingFocused = [self](NSDictionary* dictionary) {
|
|
214
|
+
if (_eventEmitter) {
|
|
215
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
216
|
+
|
|
217
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorBuildingFocusedIndoorBuilding indoorBuilding = {
|
|
218
|
+
.underground = [dictionary[@"underground"] boolValue],
|
|
219
|
+
.activeLevelIndex = (int) [dictionary[@"activeLevelIndex"] integerValue]
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnIndoorBuildingFocused data = {
|
|
223
|
+
.indoorBuilding = indoorBuilding
|
|
224
|
+
};
|
|
225
|
+
mapViewEventEmitter->onIndoorBuildingFocused(data);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
184
229
|
_view.onMapLoaded = [self](NSDictionary* dictionary) {
|
|
185
230
|
if (_eventEmitter) {
|
|
186
231
|
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
@@ -188,7 +233,7 @@ using namespace facebook::react;
|
|
|
188
233
|
mapViewEventEmitter->onMapLoaded(data);
|
|
189
234
|
}
|
|
190
235
|
};
|
|
191
|
-
|
|
236
|
+
|
|
192
237
|
_view.onKmlReady = [self](NSDictionary* dictionary) {
|
|
193
238
|
if (_eventEmitter) {
|
|
194
239
|
|
|
@@ -256,7 +301,7 @@ using namespace facebook::react;
|
|
|
256
301
|
if (errorDict){
|
|
257
302
|
str = errorDict[@"message"];
|
|
258
303
|
}
|
|
259
|
-
|
|
304
|
+
|
|
260
305
|
facebook::react::RNMapsGoogleMapViewEventEmitter::OnUserLocationChangeError error = {
|
|
261
306
|
.message = std::string([str UTF8String]),
|
|
262
307
|
};
|
|
@@ -271,6 +316,35 @@ using namespace facebook::react;
|
|
|
271
316
|
}
|
|
272
317
|
};
|
|
273
318
|
|
|
319
|
+
_view.onPoiClick = [self](NSDictionary* dictionary) {
|
|
320
|
+
if (_eventEmitter) {
|
|
321
|
+
|
|
322
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
323
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
324
|
+
|
|
325
|
+
// Populate the OnMapPressCoordinate struct
|
|
326
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClickCoordinate coordinate = {
|
|
327
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
328
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
329
|
+
};
|
|
330
|
+
// Populate the OnMapDouplePressPosition struct
|
|
331
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClickPosition position = {
|
|
332
|
+
.x = [positionDict[@"x"] doubleValue],
|
|
333
|
+
.y = [positionDict[@"y"] doubleValue],
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsGoogleMapViewEventEmitter const>(_eventEmitter);
|
|
338
|
+
facebook::react::RNMapsGoogleMapViewEventEmitter::OnPoiClick data = {
|
|
339
|
+
.coordinate = coordinate,
|
|
340
|
+
.position = position,
|
|
341
|
+
.placeId = [dictionary[@"placeId"] UTF8String],
|
|
342
|
+
.name = [dictionary[@"name"] UTF8String],
|
|
343
|
+
};
|
|
344
|
+
mapViewEventEmitter->onPoiClick(data);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
274
348
|
|
|
275
349
|
|
|
276
350
|
_view.onRegionChangeStart = [self](NSDictionary* dictionary) {
|
|
@@ -288,7 +362,7 @@ using namespace facebook::react;
|
|
|
288
362
|
mapViewEventEmitter->onRegionChangeStart(data);
|
|
289
363
|
}
|
|
290
364
|
};
|
|
291
|
-
|
|
365
|
+
|
|
292
366
|
_view.onRegionChange = [self](NSDictionary* dictionary) {
|
|
293
367
|
if (_eventEmitter) {
|
|
294
368
|
|
|
@@ -304,7 +378,7 @@ using namespace facebook::react;
|
|
|
304
378
|
mapViewEventEmitter->onRegionChange(data);
|
|
305
379
|
}
|
|
306
380
|
};
|
|
307
|
-
|
|
381
|
+
|
|
308
382
|
_view.onRegionChangeComplete = [self](NSDictionary* dictionary) {
|
|
309
383
|
if (_eventEmitter) {
|
|
310
384
|
|
|
@@ -380,44 +454,60 @@ using namespace facebook::react;
|
|
|
380
454
|
return self;
|
|
381
455
|
}
|
|
382
456
|
|
|
383
|
-
- (id)getPaperViewFromChildComponentView:(UIView *)childComponentView {
|
|
384
|
-
// Check if the childComponentView responds to the "adapter" selector
|
|
385
|
-
if ([childComponentView respondsToSelector:@selector(paperView)]) {
|
|
386
|
-
// Safely return the paperView
|
|
387
|
-
return [childComponentView valueForKey:@"paperView"];
|
|
388
|
-
}
|
|
389
|
-
// Return nil if paperView is not accessible
|
|
390
|
-
return nil;
|
|
391
|
-
}
|
|
392
457
|
|
|
393
458
|
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
|
|
394
|
-
id<RCTComponent> paperView = [
|
|
459
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
395
460
|
if (paperView){
|
|
396
461
|
if(_view && [_view isReady]){
|
|
397
462
|
[_view insertReactSubview:paperView atIndex:index];
|
|
398
463
|
} else {
|
|
399
464
|
[_pendingInsertsSubviews setObject:paperView forKey:[NSNumber numberWithInteger:index]];
|
|
400
465
|
}
|
|
466
|
+
} else {
|
|
467
|
+
[_view insertReactSubview:childComponentView atIndex:index];
|
|
468
|
+
if ([childComponentView isKindOfClass:[RNMapsGooglePolygonView class]]){
|
|
469
|
+
RNMapsGooglePolygonView* polygon = (RNMapsGooglePolygonView *) childComponentView;
|
|
470
|
+
[_polygons addObject:childComponentView];
|
|
471
|
+
[polygon didInsertInMap:_view];
|
|
472
|
+
}
|
|
401
473
|
}
|
|
402
474
|
}
|
|
475
|
+
|
|
403
476
|
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
404
477
|
{
|
|
405
|
-
id<RCTComponent> paperView = [
|
|
478
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
406
479
|
if (paperView){
|
|
407
480
|
if(_view && [_view isReady]){
|
|
408
481
|
[_view removeReactSubview:paperView];
|
|
409
482
|
} else {
|
|
410
483
|
[_pendingInsertsSubviews removeObjectForKey:[NSNumber numberWithInteger:index]];
|
|
411
484
|
}
|
|
485
|
+
} else {
|
|
486
|
+
[_view removeReactSubview:childComponentView];
|
|
487
|
+
if ([childComponentView isKindOfClass:[RNMapsGooglePolygonView class]]){
|
|
488
|
+
RNMapsGooglePolygonView* polygon = (RNMapsGooglePolygonView *) childComponentView;
|
|
489
|
+
[_polygons removeObject:childComponentView];
|
|
490
|
+
[polygon didRemoveFromMap];
|
|
491
|
+
}
|
|
412
492
|
}
|
|
413
493
|
}
|
|
494
|
+
- (void) prepareForRecycle
|
|
495
|
+
{
|
|
496
|
+
[super prepareForRecycle];
|
|
497
|
+
static const auto defaultProps = std::make_shared<const RNMapsGoogleMapViewProps>();
|
|
498
|
+
_props = defaultProps;
|
|
499
|
+
_legacyMapManager = [[AIRGoogleMapManager alloc] init];
|
|
500
|
+
_pendingInsertsSubviews = [NSMutableDictionary new];
|
|
501
|
+
[_view removeFromSuperview];
|
|
502
|
+
_view = nil;
|
|
503
|
+
}
|
|
414
504
|
|
|
415
505
|
|
|
416
506
|
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
417
507
|
{
|
|
418
508
|
const auto &oldViewProps = *std::static_pointer_cast<RNMapsGoogleMapViewProps const>(_props);
|
|
419
509
|
const auto &newViewProps = *std::static_pointer_cast<RNMapsGoogleMapViewProps const>(props);
|
|
420
|
-
|
|
510
|
+
|
|
421
511
|
|
|
422
512
|
if (oldViewProps.googleMapId != newViewProps.googleMapId) {
|
|
423
513
|
NSString* mapID = RCTNSStringFromString(newViewProps.googleMapId);
|
|
@@ -449,7 +539,7 @@ using namespace facebook::react;
|
|
|
449
539
|
_legacyMapManager.camera = camera;
|
|
450
540
|
}
|
|
451
541
|
|
|
452
|
-
|
|
542
|
+
|
|
453
543
|
|
|
454
544
|
if (!_view){
|
|
455
545
|
[self prepareContentView];
|
|
@@ -483,20 +573,6 @@ using namespace facebook::react;
|
|
|
483
573
|
_view.name = region; \
|
|
484
574
|
}
|
|
485
575
|
|
|
486
|
-
#define REMAP_GOOGLEMAPVIEW_CAMERA_PROP(name) \
|
|
487
|
-
if (newViewProps.name.center.latitude != oldViewProps.name.center.latitude || \
|
|
488
|
-
newViewProps.name.center.longitude != oldViewProps.name.center.longitude || \
|
|
489
|
-
newViewProps.name.heading != oldViewProps.name.heading || \
|
|
490
|
-
newViewProps.name.pitch != oldViewProps.name.pitch || \
|
|
491
|
-
newViewProps.name.zoom != oldViewProps.name.zoom) { \
|
|
492
|
-
GMSCameraPosition* camera = [GMSCameraPosition cameraWithLatitude:newViewProps.name.center.latitude \
|
|
493
|
-
longitude:newViewProps.name.center.longitude \
|
|
494
|
-
zoom:newViewProps.name.zoom \
|
|
495
|
-
bearing:newViewProps.name.heading \
|
|
496
|
-
viewingAngle:newViewProps.name.pitch]; \
|
|
497
|
-
_view.name = camera; \
|
|
498
|
-
}
|
|
499
|
-
|
|
500
576
|
|
|
501
577
|
#define REMAP_MAPVIEW_EDGEINSETS_PROP(name) \
|
|
502
578
|
if (newViewProps.name.top != oldViewProps.name.top || \
|
|
@@ -511,16 +587,16 @@ using namespace facebook::react;
|
|
|
511
587
|
|
|
512
588
|
|
|
513
589
|
REMAP_MAPVIEW_PROP(pitchEnabled)
|
|
514
|
-
|
|
515
590
|
REMAP_MAPVIEW_PROP(zoomTapEnabled)
|
|
516
|
-
|
|
517
591
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
518
|
-
|
|
592
|
+
|
|
593
|
+
REMAP_MAPVIEW_STRING_PROP(kmlSrc)
|
|
594
|
+
|
|
519
595
|
if (newViewProps.minZoom != oldViewProps.minZoom || newViewProps.maxZoom != oldViewProps.maxZoom){
|
|
520
596
|
[_view setMinZoom:newViewProps.minZoom maxZoom:newViewProps.maxZoom];
|
|
521
597
|
}
|
|
522
598
|
|
|
523
|
-
|
|
599
|
+
[_view setShowsCompass:newViewProps.showsCompass];
|
|
524
600
|
REMAP_MAPVIEW_PROP(showsTraffic)
|
|
525
601
|
REMAP_MAPVIEW_PROP(showsUserLocation)
|
|
526
602
|
REMAP_MAPVIEW_PROP(zoomEnabled)
|
|
@@ -529,9 +605,20 @@ using namespace facebook::react;
|
|
|
529
605
|
REMAP_MAPVIEW_REGION_PROP(region)
|
|
530
606
|
REMAP_MAPVIEW_REGION_PROP(initialRegion)
|
|
531
607
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
608
|
+
if (newViewProps.camera.center.latitude != oldViewProps.camera.center.latitude ||
|
|
609
|
+
newViewProps.camera.center.longitude != oldViewProps.camera.center.longitude ||
|
|
610
|
+
newViewProps.camera.heading != oldViewProps.camera.heading ||
|
|
611
|
+
newViewProps.camera.pitch != oldViewProps.camera.pitch ||
|
|
612
|
+
newViewProps.camera.zoom != oldViewProps.camera.zoom) {
|
|
613
|
+
GMSCameraPosition* camera = [GMSCameraPosition cameraWithLatitude:newViewProps.camera.center.latitude
|
|
614
|
+
longitude:newViewProps.camera.center.longitude
|
|
615
|
+
zoom:newViewProps.camera.zoom
|
|
616
|
+
bearing:newViewProps.camera.heading
|
|
617
|
+
viewingAngle:newViewProps.camera.pitch];
|
|
618
|
+
_view.cameraProp = camera;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
|
|
535
622
|
REMAP_MAPVIEW_EDGEINSETS_PROP(mapPadding)
|
|
536
623
|
|
|
537
624
|
|
|
@@ -545,14 +632,16 @@ using namespace facebook::react;
|
|
|
545
632
|
break;
|
|
546
633
|
case RNMapsGoogleMapViewMapType::Terrain:
|
|
547
634
|
_view.mapType = kGMSTypeTerrain;
|
|
635
|
+
break;
|
|
548
636
|
case RNMapsGoogleMapViewMapType::Hybrid:
|
|
549
637
|
_view.mapType = kGMSTypeHybrid;
|
|
638
|
+
break;
|
|
550
639
|
default:
|
|
551
640
|
_view.mapType = kGMSTypeNormal;
|
|
552
641
|
break;
|
|
553
642
|
}
|
|
554
643
|
}
|
|
555
|
-
|
|
644
|
+
|
|
556
645
|
if (oldViewProps.userInterfaceStyle != newViewProps.userInterfaceStyle){
|
|
557
646
|
switch (newViewProps.userInterfaceStyle) {
|
|
558
647
|
case RNMapsGoogleMapViewUserInterfaceStyle::Light:
|
|
@@ -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
|