react-native-maps 1.21.0-alpha.41 → 1.21.0-alpha.43
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.
|
@@ -1087,6 +1087,51 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1087
1087
|
return _kmlSrc;
|
|
1088
1088
|
}
|
|
1089
1089
|
|
|
1090
|
+
- (void) setKMLData:(NSData *) urlData {
|
|
1091
|
+
GMUKMLParser *parser = [[GMUKMLParser alloc] initWithData:urlData];
|
|
1092
|
+
[parser parse];
|
|
1093
|
+
|
|
1094
|
+
NSUInteger index = 0;
|
|
1095
|
+
NSMutableArray *markers = [[NSMutableArray alloc]init];
|
|
1096
|
+
|
|
1097
|
+
for (GMUPlacemark *place in parser.placemarks) {
|
|
1098
|
+
|
|
1099
|
+
CLLocationCoordinate2D location =((GMUPoint *) place.geometry).coordinate;
|
|
1100
|
+
|
|
1101
|
+
AIRGoogleMapMarker *marker = (AIRGoogleMapMarker *)[[AIRGoogleMapMarkerManager alloc] view];
|
|
1102
|
+
if (!marker.bridge) {
|
|
1103
|
+
marker.bridge = _bridge;
|
|
1104
|
+
}
|
|
1105
|
+
marker.identifier = place.title;
|
|
1106
|
+
marker.coordinate = location;
|
|
1107
|
+
marker.title = place.title;
|
|
1108
|
+
marker.subtitle = place.snippet;
|
|
1109
|
+
marker.pinColor = place.style.fillColor;
|
|
1110
|
+
marker.imageSrc = [AIRGoogleMap GetIconUrl:place parser:parser];
|
|
1111
|
+
marker.layer.backgroundColor = [UIColor clearColor].CGColor;
|
|
1112
|
+
marker.layer.position = CGPointZero;
|
|
1113
|
+
|
|
1114
|
+
[self insertReactSubview:(UIView *) marker atIndex:index];
|
|
1115
|
+
|
|
1116
|
+
[markers addObject:@{@"id": marker.identifier,
|
|
1117
|
+
@"title": marker.title,
|
|
1118
|
+
@"description": marker.subtitle,
|
|
1119
|
+
@"coordinate": @{
|
|
1120
|
+
@"latitude": @(location.latitude),
|
|
1121
|
+
@"longitude": @(location.longitude)
|
|
1122
|
+
}
|
|
1123
|
+
}];
|
|
1124
|
+
|
|
1125
|
+
index++;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
id event = @{@"markers": markers};
|
|
1129
|
+
if (self.onKmlReady) self.onKmlReady(event);
|
|
1130
|
+
#else
|
|
1131
|
+
REQUIRES_GOOGLE_MAPS_UTILS();
|
|
1132
|
+
#endif
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1090
1135
|
- (void)setKmlSrc:(NSString *)kmlUrl {
|
|
1091
1136
|
#ifdef HAVE_GOOGLE_MAPS_UTILS
|
|
1092
1137
|
|
|
@@ -1096,53 +1141,28 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
1096
1141
|
NSData *urlData = nil;
|
|
1097
1142
|
|
|
1098
1143
|
if ([url isFileURL]) {
|
|
1099
|
-
|
|
1144
|
+
[self setKMLData:[NSData dataWithContentsOfURL:url]];
|
|
1100
1145
|
} else {
|
|
1101
|
-
|
|
1146
|
+
__weak AIRGoogleMap *weakSelf = self;
|
|
1147
|
+
|
|
1148
|
+
NSURLSession *session = [NSURLSession sharedSession];
|
|
1149
|
+
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:url
|
|
1150
|
+
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
|
1151
|
+
if (error) {
|
|
1152
|
+
NSLog(@"Error fetching data: %@", error.localizedDescription);
|
|
1153
|
+
return;
|
|
1154
|
+
} else {
|
|
1155
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1156
|
+
AIRGoogleMap *strongSelf = weakSelf;
|
|
1157
|
+
[strongSelf setKMLData:data];
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
}
|
|
1161
|
+
}];
|
|
1162
|
+
[dataTask resume];
|
|
1102
1163
|
}
|
|
1103
1164
|
|
|
1104
|
-
|
|
1105
|
-
[parser parse];
|
|
1106
|
-
|
|
1107
|
-
NSUInteger index = 0;
|
|
1108
|
-
NSMutableArray *markers = [[NSMutableArray alloc]init];
|
|
1109
|
-
|
|
1110
|
-
for (GMUPlacemark *place in parser.placemarks) {
|
|
1111
|
-
|
|
1112
|
-
CLLocationCoordinate2D location =((GMUPoint *) place.geometry).coordinate;
|
|
1113
|
-
|
|
1114
|
-
AIRGoogleMapMarker *marker = (AIRGoogleMapMarker *)[[AIRGoogleMapMarkerManager alloc] view];
|
|
1115
|
-
if (!marker.bridge) {
|
|
1116
|
-
marker.bridge = _bridge;
|
|
1117
|
-
}
|
|
1118
|
-
marker.identifier = place.title;
|
|
1119
|
-
marker.coordinate = location;
|
|
1120
|
-
marker.title = place.title;
|
|
1121
|
-
marker.subtitle = place.snippet;
|
|
1122
|
-
marker.pinColor = place.style.fillColor;
|
|
1123
|
-
marker.imageSrc = [AIRGoogleMap GetIconUrl:place parser:parser];
|
|
1124
|
-
marker.layer.backgroundColor = [UIColor clearColor].CGColor;
|
|
1125
|
-
marker.layer.position = CGPointZero;
|
|
1126
|
-
|
|
1127
|
-
[self insertReactSubview:(UIView *) marker atIndex:index];
|
|
1128
|
-
|
|
1129
|
-
[markers addObject:@{@"id": marker.identifier,
|
|
1130
|
-
@"title": marker.title,
|
|
1131
|
-
@"description": marker.subtitle,
|
|
1132
|
-
@"coordinate": @{
|
|
1133
|
-
@"latitude": @(location.latitude),
|
|
1134
|
-
@"longitude": @(location.longitude)
|
|
1135
|
-
}
|
|
1136
|
-
}];
|
|
1137
|
-
|
|
1138
|
-
index++;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
id event = @{@"markers": markers};
|
|
1142
|
-
if (self.onKmlReady) self.onKmlReady(event);
|
|
1143
|
-
#else
|
|
1144
|
-
REQUIRES_GOOGLE_MAPS_UTILS();
|
|
1145
|
-
#endif
|
|
1165
|
+
|
|
1146
1166
|
}
|
|
1147
1167
|
|
|
1148
1168
|
|
|
@@ -520,6 +520,7 @@ using namespace facebook::react;
|
|
|
520
520
|
REMAP_MAPVIEW_PROP(zoomTapEnabled)
|
|
521
521
|
REMAP_MAPVIEW_PROP(scrollEnabled)
|
|
522
522
|
|
|
523
|
+
REMAP_MAPVIEW_STRING_PROP(kmlSrc)
|
|
523
524
|
|
|
524
525
|
if (newViewProps.minZoom != oldViewProps.minZoom || newViewProps.maxZoom != oldViewProps.maxZoom){
|
|
525
526
|
[_view setMinZoom:newViewProps.minZoom maxZoom:newViewProps.maxZoom];
|
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.43",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|