react-native-maps 1.28.2 → 1.29.1
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/src/main/java/com/rnmaps/maps/MapGradientPolyline.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapHeatmap.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapLocalTile.java +4 -0
- package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +4 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +175 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +157 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +183 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +431 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +2 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +22 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +4 -0
- package/dist/src/specs/NativeComponentGoogleMarker.d.ts +250 -0
- package/dist/src/specs/NativeComponentPolygon.d.ts +108 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +3 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +6 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +8 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.h +28 -0
- package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.mm +357 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.h +24 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.mm +64 -0
- package/ios/AirMaps/RNMapsMapView.mm +8 -0
- package/ios/AirMaps/RNMapsPolygonView.h +26 -0
- package/ios/AirMaps/RNMapsPolygonView.mm +240 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +2 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +175 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +157 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +178 -0
- package/ios/generated/RNMapsSpecs/Props.h +379 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +143 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
- package/ios/generated/RNMapsSpecs/States.h +4 -0
- package/package.json +4 -2
- package/src/MapMarker.tsx +4 -3
- package/src/decorateMapComponent.ts +29 -15
- package/src/specs/NativeComponentGoogleMarker.ts +327 -0
- package/src/specs/NativeComponentPolygon.ts +137 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNMapsPolygonView.mm
|
|
3
|
+
// AirMaps
|
|
4
|
+
//
|
|
5
|
+
//
|
|
6
|
+
// Copyright © 2024 react-native-maps. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
9
|
+
|
|
10
|
+
#import "RNMapsPolygonView.h"
|
|
11
|
+
#import "AIRMapPolygon.h"
|
|
12
|
+
#import "AIRMapCoordinate.h"
|
|
13
|
+
#if __has_include(<ReactNativeMaps/generated/RNMapsAirModuleDelegate.h>)
|
|
14
|
+
#import <ReactNativeMaps/generated/RNMapsHostViewDelegate.h>
|
|
15
|
+
#import <ReactNativeMaps/generated/ComponentDescriptors.h>
|
|
16
|
+
#import <ReactNativeMaps/generated/EventEmitters.h>
|
|
17
|
+
#import <ReactNativeMaps/generated/Props.h>
|
|
18
|
+
#import <ReactNativeMaps/generated/RCTComponentViewHelpers.h>
|
|
19
|
+
#else
|
|
20
|
+
#import "../generated/RNMapsHostViewDelegate.h"
|
|
21
|
+
#import "../generated/RNMapsSpecs/ComponentDescriptors.h"
|
|
22
|
+
#import "../generated/RNMapsSpecs/EventEmitters.h"
|
|
23
|
+
#import "../generated/RNMapsSpecs/Props.h"
|
|
24
|
+
#import "../generated/RNMapsSpecs/RCTComponentViewHelpers.h"
|
|
25
|
+
#endif
|
|
26
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
27
|
+
#import <React/RCTConversions.h>
|
|
28
|
+
#import "UIView+AirMap.h"
|
|
29
|
+
|
|
30
|
+
using namespace facebook::react;
|
|
31
|
+
|
|
32
|
+
static BOOL coordinatesEqual(const std::vector<RNMapsPolygonCoordinatesStruct>& a,
|
|
33
|
+
const std::vector<RNMapsPolygonCoordinatesStruct>& b)
|
|
34
|
+
{
|
|
35
|
+
if (a.size() != b.size()) {
|
|
36
|
+
return NO;
|
|
37
|
+
}
|
|
38
|
+
for (size_t i = 0; i < a.size(); ++i) {
|
|
39
|
+
if (a.at(i).latitude != b.at(i).latitude ||
|
|
40
|
+
a.at(i).longitude != b.at(i).longitude) {
|
|
41
|
+
return NO;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return YES;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static BOOL holesEqual(const std::vector<std::vector<RNMapsPolygonHolesStruct>>& a,
|
|
48
|
+
const std::vector<std::vector<RNMapsPolygonHolesStruct>>& b)
|
|
49
|
+
{
|
|
50
|
+
if (a.size() != b.size()) {
|
|
51
|
+
return NO;
|
|
52
|
+
}
|
|
53
|
+
for (size_t h = 0; h < a.size(); ++h) {
|
|
54
|
+
if (a.at(h).size() != b.at(h).size()) {
|
|
55
|
+
return NO;
|
|
56
|
+
}
|
|
57
|
+
for (size_t i = 0; i < a.at(h).size(); ++i) {
|
|
58
|
+
if (a.at(h).at(i).latitude != b.at(h).at(i).latitude ||
|
|
59
|
+
a.at(h).at(i).longitude != b.at(h).at(i).longitude) {
|
|
60
|
+
return NO;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return YES;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@interface RNMapsPolygonView () <RCTRNMapsPolygonViewProtocol>
|
|
68
|
+
@end
|
|
69
|
+
|
|
70
|
+
@implementation RNMapsPolygonView {
|
|
71
|
+
AIRMapPolygon *_view;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
- (AIRMapPolygon *)polygon {
|
|
75
|
+
return _view;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
79
|
+
{
|
|
80
|
+
return concreteComponentDescriptorProvider<RNMapsPolygonComponentDescriptor>();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
- (void)prepareContentView
|
|
84
|
+
{
|
|
85
|
+
_view = [AIRMapPolygon new];
|
|
86
|
+
_view.strokeWidth = 1.0;
|
|
87
|
+
_view.lineCap = kCGLineCapRound;
|
|
88
|
+
_view.lineJoin = kCGLineJoinRound;
|
|
89
|
+
_view.miterLimit = 10.0;
|
|
90
|
+
_view.onPress = [self](NSDictionary *dictionary) {
|
|
91
|
+
if (!_eventEmitter) return;
|
|
92
|
+
NSDictionary *coordinateDict = dictionary[@"coordinate"];
|
|
93
|
+
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(
|
|
94
|
+
[coordinateDict[@"latitude"] doubleValue],
|
|
95
|
+
[coordinateDict[@"longitude"] doubleValue]);
|
|
96
|
+
facebook::react::RNMapsPolygonEventEmitter::OnPressCoordinate coordinate = {
|
|
97
|
+
.latitude = coord.latitude,
|
|
98
|
+
.longitude = coord.longitude,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
CGPoint screenPoint =
|
|
102
|
+
_view.map ? [_view.map convertCoordinate:coord toPointToView:_view.map] : CGPointZero;
|
|
103
|
+
facebook::react::RNMapsPolygonEventEmitter::OnPressPosition position = {
|
|
104
|
+
.x = screenPoint.x,
|
|
105
|
+
.y = screenPoint.y,
|
|
106
|
+
};
|
|
107
|
+
auto eventEmitter = std::static_pointer_cast<RNMapsPolygonEventEmitter const>(_eventEmitter);
|
|
108
|
+
facebook::react::RNMapsPolygonEventEmitter::OnPress data = {
|
|
109
|
+
.action = std::string([dictionary[@"action"] UTF8String]),
|
|
110
|
+
.coordinate = coordinate,
|
|
111
|
+
.position = position,
|
|
112
|
+
};
|
|
113
|
+
eventEmitter->onPress(data);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
118
|
+
{
|
|
119
|
+
if (self = [super initWithFrame:frame]) {
|
|
120
|
+
static const auto defaultProps = std::make_shared<const RNMapsPolygonProps>();
|
|
121
|
+
_props = defaultProps;
|
|
122
|
+
[self prepareContentView];
|
|
123
|
+
}
|
|
124
|
+
return self;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
- (void)prepareForRecycle
|
|
128
|
+
{
|
|
129
|
+
[super prepareForRecycle];
|
|
130
|
+
static const auto defaultProps = std::make_shared<const RNMapsPolygonProps>();
|
|
131
|
+
_props = defaultProps;
|
|
132
|
+
_view = nil;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
136
|
+
{
|
|
137
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNMapsPolygonProps const>(_props);
|
|
138
|
+
const auto &newViewProps = *std::static_pointer_cast<RNMapsPolygonProps const>(props);
|
|
139
|
+
|
|
140
|
+
if (!_view) {
|
|
141
|
+
[self prepareContentView];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Order matters: `AIRMapPolygon setCoordinates:` builds the `MKPolygon` from the
|
|
145
|
+
// current `interiorPolygons` (holes), while `setHoles:` only updates that array
|
|
146
|
+
// without rebuilding. So apply holes first, then (re)build coordinates whenever
|
|
147
|
+
// either holes or coordinates changed.
|
|
148
|
+
const BOOL holesChanged = !holesEqual(newViewProps.holes, oldViewProps.holes);
|
|
149
|
+
const BOOL coordinatesChanged =
|
|
150
|
+
!coordinatesEqual(newViewProps.coordinates, oldViewProps.coordinates);
|
|
151
|
+
|
|
152
|
+
if (holesChanged) {
|
|
153
|
+
if (newViewProps.holes.empty()) {
|
|
154
|
+
// `setHoles:` ignores an empty array (its `if (holes.count)` guard), so
|
|
155
|
+
// clear the interior polygons directly to support removing holes.
|
|
156
|
+
_view.interiorPolygons = nil;
|
|
157
|
+
} else {
|
|
158
|
+
NSMutableArray<NSArray<AIRMapCoordinate *> *> *holes =
|
|
159
|
+
[NSMutableArray arrayWithCapacity:newViewProps.holes.size()];
|
|
160
|
+
for (const auto &hole : newViewProps.holes) {
|
|
161
|
+
NSMutableArray<AIRMapCoordinate *> *holeCoordinates =
|
|
162
|
+
[NSMutableArray arrayWithCapacity:hole.size()];
|
|
163
|
+
for (const auto &c : hole) {
|
|
164
|
+
AIRMapCoordinate *coordinate = [AIRMapCoordinate new];
|
|
165
|
+
coordinate.coordinate = CLLocationCoordinate2DMake(c.latitude, c.longitude);
|
|
166
|
+
[holeCoordinates addObject:coordinate];
|
|
167
|
+
}
|
|
168
|
+
[holes addObject:holeCoordinates];
|
|
169
|
+
}
|
|
170
|
+
_view.holes = holes;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (coordinatesChanged || holesChanged) {
|
|
175
|
+
NSMutableArray<AIRMapCoordinate *> *coordinates =
|
|
176
|
+
[NSMutableArray arrayWithCapacity:newViewProps.coordinates.size()];
|
|
177
|
+
for (const auto &c : newViewProps.coordinates) {
|
|
178
|
+
AIRMapCoordinate *coordinate = [AIRMapCoordinate new];
|
|
179
|
+
coordinate.coordinate = CLLocationCoordinate2DMake(c.latitude, c.longitude);
|
|
180
|
+
[coordinates addObject:coordinate];
|
|
181
|
+
}
|
|
182
|
+
_view.coordinates = coordinates;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (newViewProps.fillColor != oldViewProps.fillColor) {
|
|
186
|
+
_view.fillColor = newViewProps.fillColor
|
|
187
|
+
? RCTUIColorFromSharedColor(newViewProps.fillColor)
|
|
188
|
+
: nil;
|
|
189
|
+
}
|
|
190
|
+
if (newViewProps.strokeColor != oldViewProps.strokeColor) {
|
|
191
|
+
_view.strokeColor = newViewProps.strokeColor
|
|
192
|
+
? RCTUIColorFromSharedColor(newViewProps.strokeColor)
|
|
193
|
+
: nil;
|
|
194
|
+
}
|
|
195
|
+
if (newViewProps.strokeWidth != oldViewProps.strokeWidth) {
|
|
196
|
+
_view.strokeWidth = newViewProps.strokeWidth;
|
|
197
|
+
}
|
|
198
|
+
if (newViewProps.miterLimit != oldViewProps.miterLimit) {
|
|
199
|
+
_view.miterLimit = newViewProps.miterLimit;
|
|
200
|
+
}
|
|
201
|
+
if (newViewProps.lineDashPhase != oldViewProps.lineDashPhase) {
|
|
202
|
+
_view.lineDashPhase = newViewProps.lineDashPhase;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (newViewProps.lineCap != oldViewProps.lineCap) {
|
|
206
|
+
switch (newViewProps.lineCap) {
|
|
207
|
+
case RNMapsPolygonLineCap::Butt: _view.lineCap = kCGLineCapButt; break;
|
|
208
|
+
case RNMapsPolygonLineCap::Round: _view.lineCap = kCGLineCapRound; break;
|
|
209
|
+
case RNMapsPolygonLineCap::Square: _view.lineCap = kCGLineCapSquare; break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (newViewProps.lineJoin != oldViewProps.lineJoin) {
|
|
214
|
+
switch (newViewProps.lineJoin) {
|
|
215
|
+
case RNMapsPolygonLineJoin::Miter: _view.lineJoin = kCGLineJoinMiter; break;
|
|
216
|
+
case RNMapsPolygonLineJoin::Round: _view.lineJoin = kCGLineJoinRound; break;
|
|
217
|
+
case RNMapsPolygonLineJoin::Bevel: _view.lineJoin = kCGLineJoinBevel; break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (newViewProps.lineDashPattern != oldViewProps.lineDashPattern) {
|
|
222
|
+
NSMutableArray<NSNumber *> *pattern =
|
|
223
|
+
[NSMutableArray arrayWithCapacity:newViewProps.lineDashPattern.size()];
|
|
224
|
+
for (const auto &value : newViewProps.lineDashPattern) {
|
|
225
|
+
[pattern addObject:@(value)];
|
|
226
|
+
}
|
|
227
|
+
_view.lineDashPattern = pattern;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
[super updateProps:props oldProps:oldProps];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@end
|
|
234
|
+
|
|
235
|
+
Class<RCTComponentViewProtocol> RNMapsPolygonCls(void)
|
|
236
|
+
{
|
|
237
|
+
return RNMapsPolygonView.class;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
#endif
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
thirdPartyComponents = @{
|
|
23
23
|
@"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
|
|
24
24
|
@"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
|
|
25
|
+
@"RNMapsGoogleMarker": NSClassFromString(@"RNMapsGoogleMarkerView"), // react-native-maps
|
|
25
26
|
@"RNMapsMapView": NSClassFromString(@"RNMapsMapView"), // react-native-maps
|
|
26
27
|
@"RNMapsMarker": NSClassFromString(@"RNMapsMarkerView"), // react-native-maps
|
|
28
|
+
@"RNMapsPolygon": NSClassFromString(@"RNMapsPolygonView"), // react-native-maps
|
|
27
29
|
};
|
|
28
30
|
});
|
|
29
31
|
|
|
@@ -19,10 +19,12 @@ void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
|
|
|
19
19
|
registry->add(concreteComponentDescriptorProvider<RNMapsCalloutComponentDescriptor>());
|
|
20
20
|
registry->add(concreteComponentDescriptorProvider<RNMapsCircleComponentDescriptor>());
|
|
21
21
|
registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDescriptor>());
|
|
22
|
+
registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMarkerComponentDescriptor>());
|
|
22
23
|
registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
|
|
23
24
|
registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
|
|
24
25
|
registry->add(concreteComponentDescriptorProvider<RNMapsMarkerComponentDescriptor>());
|
|
25
26
|
registry->add(concreteComponentDescriptorProvider<RNMapsOverlayComponentDescriptor>());
|
|
27
|
+
registry->add(concreteComponentDescriptorProvider<RNMapsPolygonComponentDescriptor>());
|
|
26
28
|
registry->add(concreteComponentDescriptorProvider<RNMapsPolylineComponentDescriptor>());
|
|
27
29
|
registry->add(concreteComponentDescriptorProvider<RNMapsUrlTileComponentDescriptor>());
|
|
28
30
|
registry->add(concreteComponentDescriptorProvider<RNMapsWMSTileComponentDescriptor>());
|
|
@@ -19,10 +19,12 @@ namespace facebook::react {
|
|
|
19
19
|
using RNMapsCalloutComponentDescriptor = ConcreteComponentDescriptor<RNMapsCalloutShadowNode>;
|
|
20
20
|
using RNMapsCircleComponentDescriptor = ConcreteComponentDescriptor<RNMapsCircleShadowNode>;
|
|
21
21
|
using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMapViewShadowNode>;
|
|
22
|
+
using RNMapsGoogleMarkerComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMarkerShadowNode>;
|
|
22
23
|
using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
|
|
23
24
|
using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
|
|
24
25
|
using RNMapsMarkerComponentDescriptor = ConcreteComponentDescriptor<RNMapsMarkerShadowNode>;
|
|
25
26
|
using RNMapsOverlayComponentDescriptor = ConcreteComponentDescriptor<RNMapsOverlayShadowNode>;
|
|
27
|
+
using RNMapsPolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsPolygonShadowNode>;
|
|
26
28
|
using RNMapsPolylineComponentDescriptor = ConcreteComponentDescriptor<RNMapsPolylineShadowNode>;
|
|
27
29
|
using RNMapsUrlTileComponentDescriptor = ConcreteComponentDescriptor<RNMapsUrlTileShadowNode>;
|
|
28
30
|
using RNMapsWMSTileComponentDescriptor = ConcreteComponentDescriptor<RNMapsWMSTileShadowNode>;
|
|
@@ -384,6 +384,159 @@ void RNMapsGoogleMapViewEventEmitter::onUserLocationChange(OnUserLocationChange
|
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
|
|
387
|
+
void RNMapsGoogleMarkerEventEmitter::onCalloutPress(OnCalloutPress event) const {
|
|
388
|
+
dispatchEvent("calloutPress", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
389
|
+
auto payload = jsi::Object(runtime);
|
|
390
|
+
payload.setProperty(runtime, "action", event.action);
|
|
391
|
+
payload.setProperty(runtime, "id", event.id);
|
|
392
|
+
{
|
|
393
|
+
auto frame = jsi::Object(runtime);
|
|
394
|
+
frame.setProperty(runtime, "x", event.frame.x);
|
|
395
|
+
frame.setProperty(runtime, "y", event.frame.y);
|
|
396
|
+
frame.setProperty(runtime, "width", event.frame.width);
|
|
397
|
+
frame.setProperty(runtime, "height", event.frame.height);
|
|
398
|
+
payload.setProperty(runtime, "frame", frame);
|
|
399
|
+
}
|
|
400
|
+
{
|
|
401
|
+
auto point = jsi::Object(runtime);
|
|
402
|
+
point.setProperty(runtime, "x", event.point.x);
|
|
403
|
+
point.setProperty(runtime, "y", event.point.y);
|
|
404
|
+
payload.setProperty(runtime, "point", point);
|
|
405
|
+
}
|
|
406
|
+
return payload;
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
void RNMapsGoogleMarkerEventEmitter::onDrag(OnDrag event) const {
|
|
412
|
+
dispatchEvent("drag", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
413
|
+
auto payload = jsi::Object(runtime);
|
|
414
|
+
payload.setProperty(runtime, "id", event.id);
|
|
415
|
+
{
|
|
416
|
+
auto coordinate = jsi::Object(runtime);
|
|
417
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
418
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
419
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
420
|
+
}
|
|
421
|
+
{
|
|
422
|
+
auto position = jsi::Object(runtime);
|
|
423
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
424
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
425
|
+
payload.setProperty(runtime, "position", position);
|
|
426
|
+
}
|
|
427
|
+
return payload;
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
void RNMapsGoogleMarkerEventEmitter::onDragEnd(OnDragEnd event) const {
|
|
433
|
+
dispatchEvent("dragEnd", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
434
|
+
auto payload = jsi::Object(runtime);
|
|
435
|
+
payload.setProperty(runtime, "id", event.id);
|
|
436
|
+
{
|
|
437
|
+
auto coordinate = jsi::Object(runtime);
|
|
438
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
439
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
440
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
441
|
+
}
|
|
442
|
+
{
|
|
443
|
+
auto position = jsi::Object(runtime);
|
|
444
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
445
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
446
|
+
payload.setProperty(runtime, "position", position);
|
|
447
|
+
}
|
|
448
|
+
return payload;
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
void RNMapsGoogleMarkerEventEmitter::onDragStart(OnDragStart event) const {
|
|
454
|
+
dispatchEvent("dragStart", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
455
|
+
auto payload = jsi::Object(runtime);
|
|
456
|
+
payload.setProperty(runtime, "id", event.id);
|
|
457
|
+
{
|
|
458
|
+
auto coordinate = jsi::Object(runtime);
|
|
459
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
460
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
461
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
462
|
+
}
|
|
463
|
+
{
|
|
464
|
+
auto position = jsi::Object(runtime);
|
|
465
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
466
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
467
|
+
payload.setProperty(runtime, "position", position);
|
|
468
|
+
}
|
|
469
|
+
return payload;
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
void RNMapsGoogleMarkerEventEmitter::onPress(OnPress event) const {
|
|
475
|
+
dispatchEvent("press", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
476
|
+
auto payload = jsi::Object(runtime);
|
|
477
|
+
payload.setProperty(runtime, "action", event.action);
|
|
478
|
+
payload.setProperty(runtime, "id", event.id);
|
|
479
|
+
{
|
|
480
|
+
auto coordinate = jsi::Object(runtime);
|
|
481
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
482
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
483
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
484
|
+
}
|
|
485
|
+
{
|
|
486
|
+
auto position = jsi::Object(runtime);
|
|
487
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
488
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
489
|
+
payload.setProperty(runtime, "position", position);
|
|
490
|
+
}
|
|
491
|
+
return payload;
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
void RNMapsGoogleMarkerEventEmitter::onSelect(OnSelect event) const {
|
|
497
|
+
dispatchEvent("select", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
498
|
+
auto payload = jsi::Object(runtime);
|
|
499
|
+
payload.setProperty(runtime, "action", event.action);
|
|
500
|
+
payload.setProperty(runtime, "id", event.id);
|
|
501
|
+
{
|
|
502
|
+
auto coordinate = jsi::Object(runtime);
|
|
503
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
504
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
505
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
506
|
+
}
|
|
507
|
+
{
|
|
508
|
+
auto position = jsi::Object(runtime);
|
|
509
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
510
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
511
|
+
payload.setProperty(runtime, "position", position);
|
|
512
|
+
}
|
|
513
|
+
return payload;
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
void RNMapsGoogleMarkerEventEmitter::onDeselect(OnDeselect event) const {
|
|
519
|
+
dispatchEvent("deselect", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
520
|
+
auto payload = jsi::Object(runtime);
|
|
521
|
+
payload.setProperty(runtime, "action", event.action);
|
|
522
|
+
payload.setProperty(runtime, "id", event.id);
|
|
523
|
+
{
|
|
524
|
+
auto coordinate = jsi::Object(runtime);
|
|
525
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
526
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
527
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
528
|
+
}
|
|
529
|
+
{
|
|
530
|
+
auto position = jsi::Object(runtime);
|
|
531
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
532
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
533
|
+
payload.setProperty(runtime, "position", position);
|
|
534
|
+
}
|
|
535
|
+
return payload;
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
|
|
387
540
|
void RNMapsGooglePolygonEventEmitter::onPress(OnPress event) const {
|
|
388
541
|
dispatchEvent("press", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
389
542
|
auto payload = jsi::Object(runtime);
|
|
@@ -953,6 +1106,28 @@ payload.setProperty(runtime, "id", event.id);
|
|
|
953
1106
|
}
|
|
954
1107
|
|
|
955
1108
|
|
|
1109
|
+
void RNMapsPolygonEventEmitter::onPress(OnPress event) const {
|
|
1110
|
+
dispatchEvent("press", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
1111
|
+
auto payload = jsi::Object(runtime);
|
|
1112
|
+
payload.setProperty(runtime, "action", event.action);
|
|
1113
|
+
payload.setProperty(runtime, "id", event.id);
|
|
1114
|
+
{
|
|
1115
|
+
auto coordinate = jsi::Object(runtime);
|
|
1116
|
+
coordinate.setProperty(runtime, "latitude", event.coordinate.latitude);
|
|
1117
|
+
coordinate.setProperty(runtime, "longitude", event.coordinate.longitude);
|
|
1118
|
+
payload.setProperty(runtime, "coordinate", coordinate);
|
|
1119
|
+
}
|
|
1120
|
+
{
|
|
1121
|
+
auto position = jsi::Object(runtime);
|
|
1122
|
+
position.setProperty(runtime, "x", event.position.x);
|
|
1123
|
+
position.setProperty(runtime, "y", event.position.y);
|
|
1124
|
+
payload.setProperty(runtime, "position", position);
|
|
1125
|
+
}
|
|
1126
|
+
return payload;
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
|
|
956
1131
|
void RNMapsPolylineEventEmitter::onPress(OnPress event) const {
|
|
957
1132
|
dispatchEvent("press", [event=std::move(event)](jsi::Runtime &runtime) {
|
|
958
1133
|
auto payload = jsi::Object(runtime);
|
|
@@ -330,6 +330,141 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
|
330
330
|
|
|
331
331
|
void onUserLocationChange(OnUserLocationChange value) const;
|
|
332
332
|
};
|
|
333
|
+
class RNMapsGoogleMarkerEventEmitter : public ViewEventEmitter {
|
|
334
|
+
public:
|
|
335
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
336
|
+
|
|
337
|
+
struct OnCalloutPressFrame {
|
|
338
|
+
double x;
|
|
339
|
+
double y;
|
|
340
|
+
double width;
|
|
341
|
+
double height;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
struct OnCalloutPressPoint {
|
|
345
|
+
double x;
|
|
346
|
+
double y;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
struct OnCalloutPress {
|
|
350
|
+
std::string action;
|
|
351
|
+
std::string id;
|
|
352
|
+
OnCalloutPressFrame frame;
|
|
353
|
+
OnCalloutPressPoint point;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
struct OnDragCoordinate {
|
|
357
|
+
double latitude;
|
|
358
|
+
double longitude;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
struct OnDragPosition {
|
|
362
|
+
double x;
|
|
363
|
+
double y;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
struct OnDrag {
|
|
367
|
+
std::string id;
|
|
368
|
+
OnDragCoordinate coordinate;
|
|
369
|
+
OnDragPosition position;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
struct OnDragEndCoordinate {
|
|
373
|
+
double latitude;
|
|
374
|
+
double longitude;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
struct OnDragEndPosition {
|
|
378
|
+
double x;
|
|
379
|
+
double y;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
struct OnDragEnd {
|
|
383
|
+
std::string id;
|
|
384
|
+
OnDragEndCoordinate coordinate;
|
|
385
|
+
OnDragEndPosition position;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
struct OnDragStartCoordinate {
|
|
389
|
+
double latitude;
|
|
390
|
+
double longitude;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
struct OnDragStartPosition {
|
|
394
|
+
double x;
|
|
395
|
+
double y;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
struct OnDragStart {
|
|
399
|
+
std::string id;
|
|
400
|
+
OnDragStartCoordinate coordinate;
|
|
401
|
+
OnDragStartPosition position;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
struct OnPressCoordinate {
|
|
405
|
+
double latitude;
|
|
406
|
+
double longitude;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
struct OnPressPosition {
|
|
410
|
+
double x;
|
|
411
|
+
double y;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
struct OnPress {
|
|
415
|
+
std::string action;
|
|
416
|
+
std::string id;
|
|
417
|
+
OnPressCoordinate coordinate;
|
|
418
|
+
OnPressPosition position;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
struct OnSelectCoordinate {
|
|
422
|
+
double latitude;
|
|
423
|
+
double longitude;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
struct OnSelectPosition {
|
|
427
|
+
double x;
|
|
428
|
+
double y;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
struct OnSelect {
|
|
432
|
+
std::string action;
|
|
433
|
+
std::string id;
|
|
434
|
+
OnSelectCoordinate coordinate;
|
|
435
|
+
OnSelectPosition position;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
struct OnDeselectCoordinate {
|
|
439
|
+
double latitude;
|
|
440
|
+
double longitude;
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
struct OnDeselectPosition {
|
|
444
|
+
double x;
|
|
445
|
+
double y;
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
struct OnDeselect {
|
|
449
|
+
std::string action;
|
|
450
|
+
std::string id;
|
|
451
|
+
OnDeselectCoordinate coordinate;
|
|
452
|
+
OnDeselectPosition position;
|
|
453
|
+
};
|
|
454
|
+
void onCalloutPress(OnCalloutPress value) const;
|
|
455
|
+
|
|
456
|
+
void onDrag(OnDrag value) const;
|
|
457
|
+
|
|
458
|
+
void onDragEnd(OnDragEnd value) const;
|
|
459
|
+
|
|
460
|
+
void onDragStart(OnDragStart value) const;
|
|
461
|
+
|
|
462
|
+
void onPress(OnPress value) const;
|
|
463
|
+
|
|
464
|
+
void onSelect(OnSelect value) const;
|
|
465
|
+
|
|
466
|
+
void onDeselect(OnDeselect value) const;
|
|
467
|
+
};
|
|
333
468
|
class RNMapsGooglePolygonEventEmitter : public ViewEventEmitter {
|
|
334
469
|
public:
|
|
335
470
|
using ViewEventEmitter::ViewEventEmitter;
|
|
@@ -821,6 +956,28 @@ class RNMapsOverlayEventEmitter : public ViewEventEmitter {
|
|
|
821
956
|
};
|
|
822
957
|
void onPress(OnPress value) const;
|
|
823
958
|
};
|
|
959
|
+
class RNMapsPolygonEventEmitter : public ViewEventEmitter {
|
|
960
|
+
public:
|
|
961
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
962
|
+
|
|
963
|
+
struct OnPressCoordinate {
|
|
964
|
+
double latitude;
|
|
965
|
+
double longitude;
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
struct OnPressPosition {
|
|
969
|
+
double x;
|
|
970
|
+
double y;
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
struct OnPress {
|
|
974
|
+
std::string action;
|
|
975
|
+
std::string id;
|
|
976
|
+
OnPressCoordinate coordinate;
|
|
977
|
+
OnPressPosition position;
|
|
978
|
+
};
|
|
979
|
+
void onPress(OnPress value) const;
|
|
980
|
+
};
|
|
824
981
|
class RNMapsPolylineEventEmitter : public ViewEventEmitter {
|
|
825
982
|
public:
|
|
826
983
|
using ViewEventEmitter::ViewEventEmitter;
|