File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 19
19
@property (nonatomic , strong ) AIRGMSPolyline *polyline;
20
20
@property (nonatomic , strong ) NSArray <AIRMapCoordinate *> *coordinates;
21
21
@property (nonatomic , copy ) RCTBubblingEventBlock onPress;
22
+ @property (nonatomic , strong ) GMSMapView *originalMap;
22
23
23
24
@property (nonatomic , strong ) UIColor *strokeColor;
24
25
@property (nonatomic , strong ) NSArray <UIColor *> *strokeColors;
Original file line number Diff line number Diff line change @@ -29,11 +29,25 @@ -(void)setCoordinates:(NSArray<AIRMapCoordinate *> *)coordinates
29
29
_coordinates = coordinates;
30
30
31
31
GMSMutablePath *path = [GMSMutablePath path ];
32
- for (int i = 0 ; i < coordinates.count ; i++)
32
+
33
+ if (!coordinates || coordinates.count == 0 )
33
34
{
35
+ _polyline.map = nil ; // Remove polyline from the map
36
+ return ;
37
+ }
38
+
39
+ for (int i = 0 ; i < coordinates.count ; i++) {
34
40
[path addCoordinate: coordinates[i].coordinate];
35
41
}
36
42
43
+ if (!_originalMap) {
44
+ _originalMap = _polyline.map ; // Store the original map
45
+ }
46
+
47
+ if (!_polyline.map ) {
48
+ _polyline.map = _originalMap;
49
+ }
50
+
37
51
_polyline.path = path;
38
52
39
53
[self configureStyleSpansIfNeeded ];
You can’t perform that action at this time.
0 commit comments