react-native-maps 1.21.0-alpha.23 → 1.21.0-alpha.24
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.
|
@@ -30,7 +30,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
30
30
|
BOOL _calloutIsOpen;
|
|
31
31
|
NSInteger _zIndexBeforeOpen;
|
|
32
32
|
BOOL _useLegacyPinView;
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
CADisplayLink *_displayLink;
|
|
35
35
|
CLLocationCoordinate2D _startCoordinate;
|
|
36
36
|
CLLocationCoordinate2D _endCoordinate;
|
|
@@ -355,7 +355,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
355
355
|
_reloadImageCancellationBlock();
|
|
356
356
|
_reloadImageCancellationBlock = nil;
|
|
357
357
|
}
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
_reloadImageCancellationBlock = [[[RCTBridge currentBridge] moduleForName:@"ImageLoader"] loadImageWithURLRequest:[RCTConvert NSURLRequest:_imageSrc]
|
|
360
360
|
size:self.bounds.size
|
|
361
361
|
scale:RCTScreenScale()
|
|
@@ -416,7 +416,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
416
416
|
NSLog(@"Animation already in progress. Rejecting new animation request.");
|
|
417
417
|
return;
|
|
418
418
|
}
|
|
419
|
-
|
|
419
|
+
|
|
420
420
|
// Mark as animating
|
|
421
421
|
_isAnimating = YES;
|
|
422
422
|
|
|
@@ -855,4 +855,4 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
855
855
|
- (CGFloat)frameBottom { return self.frame.origin.y + self.frame.size.height; }
|
|
856
856
|
- (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=fmaxf(bottom-self.frame.origin.y,0) }; }
|
|
857
857
|
|
|
858
|
-
@end
|
|
858
|
+
@end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNMapsMarker.h
|
|
3
|
+
// AirMaps
|
|
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
|
+
|
|
10
|
+
#import <React/RCTViewComponentView.h>
|
|
11
|
+
#import <UIKit/UIKit.h>
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
14
|
+
|
|
15
|
+
typedef void (^LoadCompletionHandler)(UIView *view);
|
|
16
|
+
|
|
17
|
+
@class AIRMapMarker;
|
|
18
|
+
@interface RNMapsMarkerView : RCTViewComponentView
|
|
19
|
+
- (AIRMapMarker*) marker;
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
NS_ASSUME_NONNULL_END
|
|
23
|
+
|
|
24
|
+
#endif
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNMapsMarker.m
|
|
3
|
+
// AirMaps
|
|
4
|
+
//
|
|
5
|
+
// Created by Salah Ghanim on 23.11.24.
|
|
6
|
+
// Copyright © 2024 react-native-maps. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "RNMapsMarkerView.h"
|
|
10
|
+
#import "AirMap.h"
|
|
11
|
+
#import "AIRMapMarker.h"
|
|
12
|
+
#import "AIRMapMarkerManager.h"
|
|
13
|
+
#import <react/renderer/components/RNMapsSpecs/ComponentDescriptors.h>
|
|
14
|
+
#import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
|
|
15
|
+
#import <react/renderer/components/RNMapsSpecs/Props.h>
|
|
16
|
+
#import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
|
|
17
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
18
|
+
#import <React/RCTConversions.h>
|
|
19
|
+
#import "UIView+AirMap.h"
|
|
20
|
+
|
|
21
|
+
using namespace facebook::react;
|
|
22
|
+
|
|
23
|
+
@interface RNMapsMarkerView () <RCTRNMapsMarkerViewProtocol>
|
|
24
|
+
@end
|
|
25
|
+
|
|
26
|
+
@implementation RNMapsMarkerView {
|
|
27
|
+
AIRMapMarker *_view;
|
|
28
|
+
AIRMapMarkerManager* _legacyMapManager;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (AIRMapMarker *) marker {
|
|
32
|
+
return _view;
|
|
33
|
+
}
|
|
34
|
+
- (void) prepareForRecycle
|
|
35
|
+
{
|
|
36
|
+
[super prepareForRecycle];
|
|
37
|
+
[_view removeFromSuperview];
|
|
38
|
+
_view = nil;
|
|
39
|
+
_legacyMapManager = nil;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#pragma mark - JS Commands
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
#pragma mark - Native commands
|
|
46
|
+
|
|
47
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
48
|
+
{
|
|
49
|
+
RCTRNMapsMarkerHandleCommand(self, commandName, args);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
54
|
+
{
|
|
55
|
+
return concreteComponentDescriptorProvider<RNMapsMarkerComponentDescriptor>();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void) animateToCoordinates:(double)latitude longitude:(double)longitude duration:(NSInteger)duration
|
|
59
|
+
{
|
|
60
|
+
[_view animateToCoordinate:CLLocationCoordinate2DMake(latitude, longitude) duration:duration/1000];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void) showCallout
|
|
64
|
+
{
|
|
65
|
+
[_view.map selectAnnotation:_view animated:YES];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
- (void) hideCallout
|
|
69
|
+
{
|
|
70
|
+
[_view.map deselectAnnotation:_view animated:YES];
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (void) setCoordinates:(double)latitude longitude:(double)longitude
|
|
75
|
+
{
|
|
76
|
+
[_view setCoordinate:CLLocationCoordinate2DMake(latitude, longitude)];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
- (void) prepareMarkerView
|
|
82
|
+
{
|
|
83
|
+
if (_legacyMapManager && _view) return;
|
|
84
|
+
static const auto defaultProps = std::make_shared<const RNMapsMarkerProps>();
|
|
85
|
+
_props = defaultProps;
|
|
86
|
+
_legacyMapManager = [[AIRMapMarkerManager alloc] init];
|
|
87
|
+
_view = (AIRMapMarker *)[_legacyMapManager view];
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
_view.onPress = [self](NSDictionary* dictionary) {
|
|
91
|
+
if (_eventEmitter) {
|
|
92
|
+
// Extract values from the NSDictionary
|
|
93
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
94
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
95
|
+
|
|
96
|
+
// Populate the OnCalloutPressPoint struct
|
|
97
|
+
facebook::react::RNMapsMarkerEventEmitter::OnPressPosition point = {
|
|
98
|
+
.x = [coordinateDict[@"x"] doubleValue],
|
|
99
|
+
.y = [coordinateDict[@"y"] doubleValue],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
facebook::react::RNMapsMarkerEventEmitter::OnPressCoordinate coordinate = {
|
|
104
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
105
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
109
|
+
facebook::react::RNMapsMarkerEventEmitter::OnPress data = {
|
|
110
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
111
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
112
|
+
.position = point,
|
|
113
|
+
.coordinate = coordinate,
|
|
114
|
+
};
|
|
115
|
+
eventEmitter->onPress(data);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_view.onDeselect = [self](NSDictionary* dictionary) {
|
|
120
|
+
if (_eventEmitter) {
|
|
121
|
+
// Extract values from the NSDictionary
|
|
122
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
123
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
124
|
+
|
|
125
|
+
// Populate the OnCalloutPressPoint struct
|
|
126
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDeselectPosition point = {
|
|
127
|
+
.x = [coordinateDict[@"x"] doubleValue],
|
|
128
|
+
.y = [coordinateDict[@"y"] doubleValue],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDeselectCoordinate coordinate = {
|
|
133
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
134
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
138
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDeselect data = {
|
|
139
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
140
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
141
|
+
.position = point,
|
|
142
|
+
.coordinate = coordinate,
|
|
143
|
+
};
|
|
144
|
+
eventEmitter->onDeselect(data);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
_view.onDrag = [self](NSDictionary* dictionary) {
|
|
149
|
+
if (_eventEmitter) {
|
|
150
|
+
// Extract values from the NSDictionary
|
|
151
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDragCoordinate coordinate = {
|
|
155
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
156
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
160
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDrag data = {
|
|
161
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
162
|
+
.coordinate = coordinate,
|
|
163
|
+
};
|
|
164
|
+
eventEmitter->onDrag(data);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
_view.onDragStart = [self](NSDictionary* dictionary) {
|
|
168
|
+
if (_eventEmitter) {
|
|
169
|
+
// Extract values from the NSDictionary
|
|
170
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
171
|
+
|
|
172
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDragStartCoordinate coordinate = {
|
|
173
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
174
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
178
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDragStart data = {
|
|
179
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
180
|
+
.coordinate = coordinate,
|
|
181
|
+
};
|
|
182
|
+
eventEmitter->onDragStart(data);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
_view.onDragEnd = [self](NSDictionary* dictionary) {
|
|
187
|
+
if (_eventEmitter) {
|
|
188
|
+
// Extract values from the NSDictionary
|
|
189
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDragEndCoordinate coordinate = {
|
|
193
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
194
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
198
|
+
facebook::react::RNMapsMarkerEventEmitter::OnDragEnd data = {
|
|
199
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
200
|
+
.coordinate = coordinate,
|
|
201
|
+
};
|
|
202
|
+
eventEmitter->onDragEnd(data);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
_view.onSelect = [self](NSDictionary* dictionary) {
|
|
207
|
+
if (_eventEmitter) {
|
|
208
|
+
// Extract values from the NSDictionary
|
|
209
|
+
NSDictionary* coordinateDict = dictionary[@"coordinate"];
|
|
210
|
+
NSDictionary* positionDict = dictionary[@"position"];
|
|
211
|
+
|
|
212
|
+
// Populate the OnCalloutPressPoint struct
|
|
213
|
+
facebook::react::RNMapsMarkerEventEmitter::OnSelectPosition point = {
|
|
214
|
+
.x = [coordinateDict[@"x"] doubleValue],
|
|
215
|
+
.y = [coordinateDict[@"y"] doubleValue],
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
facebook::react::RNMapsMarkerEventEmitter::OnSelectCoordinate coordinate = {
|
|
220
|
+
.latitude = [coordinateDict[@"latitude"] doubleValue],
|
|
221
|
+
.longitude = [coordinateDict[@"longitude"] doubleValue],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
225
|
+
facebook::react::RNMapsMarkerEventEmitter::OnSelect data = {
|
|
226
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
227
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
228
|
+
.position = point,
|
|
229
|
+
.coordinate = coordinate,
|
|
230
|
+
};
|
|
231
|
+
eventEmitter->onSelect(data);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
_view.onCalloutPress = [self](NSDictionary* dictionary) {
|
|
237
|
+
if (_eventEmitter) {
|
|
238
|
+
// Extract values from the NSDictionary
|
|
239
|
+
NSDictionary* pointDict = dictionary[@"point"];
|
|
240
|
+
NSDictionary* frameDict = dictionary[@"frame"];
|
|
241
|
+
|
|
242
|
+
// Populate the OnCalloutPressPoint struct
|
|
243
|
+
facebook::react::RNMapsMarkerEventEmitter::OnCalloutPressPoint point = {
|
|
244
|
+
.x = [pointDict[@"x"] doubleValue],
|
|
245
|
+
.y = [pointDict[@"y"] doubleValue],
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
facebook::react::RNMapsMarkerEventEmitter::OnCalloutPressFrame frame = {
|
|
250
|
+
.x = [frameDict[@"x"] doubleValue],
|
|
251
|
+
.y = [frameDict[@"x"] doubleValue],
|
|
252
|
+
.width = [frameDict[@"width"] doubleValue],
|
|
253
|
+
.height = [frameDict[@"height"] doubleValue],
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsMarkerEventEmitter const>(_eventEmitter);
|
|
257
|
+
facebook::react::RNMapsMarkerEventEmitter::OnCalloutPress data = {
|
|
258
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
259
|
+
.id = std::string([dictionary[@"id"] UTF8String]),
|
|
260
|
+
.frame = frame,
|
|
261
|
+
.point = point,
|
|
262
|
+
};
|
|
263
|
+
eventEmitter->onCalloutPress(data);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
|
|
270
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
271
|
+
if (paperView){
|
|
272
|
+
[_view insertReactSubview:paperView atIndex:index];
|
|
273
|
+
} else {
|
|
274
|
+
[_view insertReactSubview:childComponentView atIndex:index];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
- (void) unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
279
|
+
{
|
|
280
|
+
id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
|
|
281
|
+
if (paperView){
|
|
282
|
+
[_view removeReactSubview:paperView];
|
|
283
|
+
} else {
|
|
284
|
+
[_view removeReactSubview:childComponentView];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
288
|
+
{
|
|
289
|
+
if (self = [super initWithFrame:frame]) {
|
|
290
|
+
[self prepareMarkerView];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return self;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
297
|
+
{
|
|
298
|
+
[self prepareMarkerView];
|
|
299
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNMapsMarkerProps const>(_props);
|
|
300
|
+
const auto &newViewProps = *std::static_pointer_cast<RNMapsMarkerProps const>(props);
|
|
301
|
+
BOOL completionHandlerCalled = false;
|
|
302
|
+
|
|
303
|
+
#define REMAP_MAPVIEW_PROP(name) \
|
|
304
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
305
|
+
_view.name = newViewProps.name; \
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
#define REMAP_MAPVIEW_STRING_PROP(name) \
|
|
309
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
310
|
+
_view.name = RCTNSStringFromString(newViewProps.name); \
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
#define REMAP_MAPVIEW_COLOR_PROP(name) \
|
|
314
|
+
if (oldViewProps.name != newViewProps.name) { \
|
|
315
|
+
_view.name = RCTUIColorFromSharedColor(newViewProps.name); \
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
#define REMAP_MAPVIEW_POINT_PROP(name) \
|
|
319
|
+
if (newViewProps.name.x != oldViewProps.name.x || \
|
|
320
|
+
newViewProps.name.y != oldViewProps.name.y) { \
|
|
321
|
+
_view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (newViewProps.zIndex != oldViewProps.zIndex){
|
|
325
|
+
if (newViewProps.zIndex.has_value()){
|
|
326
|
+
_view.zIndex = newViewProps.zIndex.value();
|
|
327
|
+
} else {
|
|
328
|
+
// default
|
|
329
|
+
_view.zIndex = 0;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (newViewProps.image != oldViewProps.image){
|
|
333
|
+
if (newViewProps.image.uri.size()){
|
|
334
|
+
[_view setImageSrc:RCTNSStringFromString(newViewProps.image.uri)];
|
|
335
|
+
completionHandlerCalled = true;
|
|
336
|
+
} else {
|
|
337
|
+
[_view setImageSrc:nil];
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
REMAP_MAPVIEW_PROP(useLegacyPinView)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
REMAP_MAPVIEW_PROP(opacity)
|
|
345
|
+
REMAP_MAPVIEW_PROP(draggable)
|
|
346
|
+
REMAP_MAPVIEW_PROP(isPreselected)
|
|
347
|
+
|
|
348
|
+
REMAP_MAPVIEW_COLOR_PROP(pinColor)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
REMAP_MAPVIEW_POINT_PROP(calloutOffset)
|
|
352
|
+
if (newViewProps.coordinate.latitude != oldViewProps.coordinate.latitude ||
|
|
353
|
+
newViewProps.coordinate.longitude != oldViewProps.coordinate.longitude) {
|
|
354
|
+
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(
|
|
355
|
+
newViewProps.coordinate.latitude,
|
|
356
|
+
newViewProps.coordinate.longitude);
|
|
357
|
+
_view.coordinate = coordinates;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
if (newViewProps.description != oldViewProps.description){
|
|
362
|
+
_view.subtitle = RCTNSStringFromString(newViewProps.description);
|
|
363
|
+
}
|
|
364
|
+
REMAP_MAPVIEW_STRING_PROP(title)
|
|
365
|
+
REMAP_MAPVIEW_STRING_PROP(identifier)
|
|
366
|
+
if (newViewProps.titleVisibility != oldViewProps.titleVisibility){
|
|
367
|
+
switch (newViewProps.titleVisibility) {
|
|
368
|
+
case RNMapsMarkerTitleVisibility::Visible:
|
|
369
|
+
[_view setTitleVisibility:MKFeatureVisibilityVisible];
|
|
370
|
+
break;
|
|
371
|
+
case RNMapsMarkerTitleVisibility::Adaptive:
|
|
372
|
+
[_view setTitleVisibility:MKFeatureVisibilityAdaptive];
|
|
373
|
+
break;
|
|
374
|
+
case RNMapsMarkerTitleVisibility::Hidden:
|
|
375
|
+
[_view setTitleVisibility:MKFeatureVisibilityHidden];
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (newViewProps.subtitleVisibility != oldViewProps.subtitleVisibility){
|
|
380
|
+
switch (newViewProps.subtitleVisibility) {
|
|
381
|
+
case RNMapsMarkerSubtitleVisibility::Visible:
|
|
382
|
+
[_view setSubtitleVisibility:MKFeatureVisibilityVisible];
|
|
383
|
+
break;
|
|
384
|
+
case RNMapsMarkerSubtitleVisibility::Adaptive:
|
|
385
|
+
[_view setSubtitleVisibility:MKFeatureVisibilityAdaptive];
|
|
386
|
+
break;
|
|
387
|
+
case RNMapsMarkerSubtitleVisibility::Hidden:
|
|
388
|
+
[_view setSubtitleVisibility:MKFeatureVisibilityHidden];
|
|
389
|
+
break;
|
|
390
|
+
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
[super updateProps:props oldProps:oldProps];
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
@end
|
|
400
|
+
|
|
401
|
+
Class<RCTComponentViewProtocol> RNMapsMarkerCls(void)
|
|
402
|
+
{
|
|
403
|
+
return RNMapsMarkerView.class;
|
|
404
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNMapsMarkerManager.m
|
|
3
|
+
// AirMaps
|
|
4
|
+
//
|
|
5
|
+
// Created by Salah Ghanim on 23.11.24.
|
|
6
|
+
// Copyright © 2024 react-native-maps. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <React/RCTLog.h>
|
|
10
|
+
#import <React/RCTUIManager.h>
|
|
11
|
+
#import <React/RCTViewManager.h>
|
|
12
|
+
|
|
13
|
+
@interface RNMapsMarkerViewManager : RCTViewManager
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
@implementation RNMapsMarkerViewManager
|
|
17
|
+
|
|
18
|
+
RCT_EXPORT_MODULE(RNMapsMarkerViewManager)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@end
|
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.24",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|