react-native-cn-maps 0.1.0
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/CnMaps.podspec +21 -0
- package/LICENSE +20 -0
- package/README.md +89 -0
- package/android/build.gradle +68 -0
- package/android/src/main/AndroidManifest.xml +7 -0
- package/android/src/main/java/com/cnmaps/MapView.kt +368 -0
- package/android/src/main/java/com/cnmaps/MapViewManager.kt +112 -0
- package/android/src/main/java/com/cnmaps/MapsPackage.kt +17 -0
- package/ios/RNMapsMapView.h +14 -0
- package/ios/RNMapsMapView.mm +291 -0
- package/lib/module/MapMarker.js +8 -0
- package/lib/module/MapMarker.js.map +1 -0
- package/lib/module/MapView.js +111 -0
- package/lib/module/MapView.js.map +1 -0
- package/lib/module/MapViewNativeComponent.ts +79 -0
- package/lib/module/coordinate.js +72 -0
- package/lib/module/coordinate.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/MapMarker.d.ts +8 -0
- package/lib/typescript/src/MapMarker.d.ts.map +1 -0
- package/lib/typescript/src/MapView.d.ts +145 -0
- package/lib/typescript/src/MapView.d.ts.map +1 -0
- package/lib/typescript/src/MapViewNativeComponent.d.ts +55 -0
- package/lib/typescript/src/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/coordinate.d.ts +8 -0
- package/lib/typescript/src/coordinate.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +50 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +182 -0
- package/src/MapMarker.tsx +14 -0
- package/src/MapView.tsx +201 -0
- package/src/MapViewNativeComponent.ts +79 -0
- package/src/coordinate.ts +123 -0
- package/src/index.tsx +15 -0
- package/src/types.ts +59 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#ifndef RNMapsMapView_h
|
|
5
|
+
#define RNMapsMapView_h
|
|
6
|
+
|
|
7
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
+
|
|
9
|
+
@interface RNMapsMapView : RCTViewComponentView
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|
|
13
|
+
|
|
14
|
+
#endif /* RNMapsMapView_h */
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#import "RNMapsMapView.h"
|
|
2
|
+
|
|
3
|
+
#import <MAMapKit/MAMapKit.h>
|
|
4
|
+
#import <React/RCTConversions.h>
|
|
5
|
+
#import <React/RCTUtils.h>
|
|
6
|
+
|
|
7
|
+
#import <react/renderer/components/RNMapsSpecs/ComponentDescriptors.h>
|
|
8
|
+
#import <react/renderer/components/RNMapsSpecs/EventEmitters.h>
|
|
9
|
+
#import <react/renderer/components/RNMapsSpecs/Props.h>
|
|
10
|
+
#import <react/renderer/components/RNMapsSpecs/RCTComponentViewHelpers.h>
|
|
11
|
+
|
|
12
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
13
|
+
|
|
14
|
+
#include <cmath>
|
|
15
|
+
|
|
16
|
+
using namespace facebook::react;
|
|
17
|
+
|
|
18
|
+
@interface RNMapsMarkerAnnotation : MAPointAnnotation
|
|
19
|
+
@property (nonatomic, copy) NSString *identifier;
|
|
20
|
+
@property (nonatomic, copy, nullable) NSString *pinColor;
|
|
21
|
+
@property (nonatomic, assign) BOOL draggable;
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation RNMapsMarkerAnnotation
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
@interface RNMapsMapView () <MAMapViewDelegate, RCTRNMapsMapViewViewProtocol>
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
static NSString *RNMapsNSStringFromString(const std::string &value)
|
|
31
|
+
{
|
|
32
|
+
if (value.empty()) {
|
|
33
|
+
return nil;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return [NSString stringWithUTF8String:value.c_str()];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
template <typename Region>
|
|
40
|
+
static BOOL RNMapsRegionIsValid(const Region ®ion)
|
|
41
|
+
{
|
|
42
|
+
return std::isfinite(region.latitude) &&
|
|
43
|
+
std::isfinite(region.longitude) &&
|
|
44
|
+
std::isfinite(region.latitudeDelta) &&
|
|
45
|
+
std::isfinite(region.longitudeDelta) &&
|
|
46
|
+
region.latitudeDelta > 0 &&
|
|
47
|
+
region.longitudeDelta > 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
template <typename Region>
|
|
51
|
+
static MACoordinateRegion RNMapsMACoordinateRegionFromRegion(const Region ®ion)
|
|
52
|
+
{
|
|
53
|
+
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(region.latitude, region.longitude);
|
|
54
|
+
MACoordinateSpan span = MACoordinateSpanMake(region.latitudeDelta, region.longitudeDelta);
|
|
55
|
+
return MACoordinateRegionMake(center, span);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static BOOL RNMapsRegionChanged(
|
|
59
|
+
const RNMapsMapViewRegionStruct &oldRegion,
|
|
60
|
+
const RNMapsMapViewRegionStruct &newRegion)
|
|
61
|
+
{
|
|
62
|
+
return oldRegion.latitude != newRegion.latitude ||
|
|
63
|
+
oldRegion.longitude != newRegion.longitude ||
|
|
64
|
+
oldRegion.latitudeDelta != newRegion.latitudeDelta ||
|
|
65
|
+
oldRegion.longitudeDelta != newRegion.longitudeDelta;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static MAPinAnnotationColor RNMapsPinColor(NSString *color)
|
|
69
|
+
{
|
|
70
|
+
NSString *lowercaseColor = [color lowercaseString];
|
|
71
|
+
|
|
72
|
+
if ([lowercaseColor containsString:@"green"] || [lowercaseColor isEqualToString:@"#00ff00"]) {
|
|
73
|
+
return MAPinAnnotationColorGreen;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ([lowercaseColor containsString:@"purple"] || [lowercaseColor containsString:@"violet"]) {
|
|
77
|
+
return MAPinAnnotationColorPurple;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return MAPinAnnotationColorRed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@implementation RNMapsMapView {
|
|
84
|
+
MAMapView *_mapView;
|
|
85
|
+
NSMutableDictionary<NSString *, RNMapsMarkerAnnotation *> *_annotationsByIdentifier;
|
|
86
|
+
BOOL _initialRegionApplied;
|
|
87
|
+
BOOL _isGesture;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
91
|
+
{
|
|
92
|
+
return concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
96
|
+
{
|
|
97
|
+
if (self = [super initWithFrame:frame]) {
|
|
98
|
+
static const auto defaultProps = std::make_shared<const RNMapsMapViewProps>();
|
|
99
|
+
_props = defaultProps;
|
|
100
|
+
|
|
101
|
+
_mapView = [[MAMapView alloc] initWithFrame:self.bounds];
|
|
102
|
+
_mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
103
|
+
_mapView.delegate = self;
|
|
104
|
+
_mapView.zoomEnabled = YES;
|
|
105
|
+
_mapView.scrollEnabled = YES;
|
|
106
|
+
_mapView.rotateEnabled = YES;
|
|
107
|
+
_mapView.rotateCameraEnabled = YES;
|
|
108
|
+
|
|
109
|
+
_annotationsByIdentifier = [NSMutableDictionary new];
|
|
110
|
+
self.contentView = _mapView;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return self;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
- (void)prepareForRecycle
|
|
117
|
+
{
|
|
118
|
+
[super prepareForRecycle];
|
|
119
|
+
[_mapView removeAnnotations:_annotationsByIdentifier.allValues];
|
|
120
|
+
[_annotationsByIdentifier removeAllObjects];
|
|
121
|
+
_initialRegionApplied = NO;
|
|
122
|
+
_isGesture = NO;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
- (void)dealloc
|
|
126
|
+
{
|
|
127
|
+
_mapView.delegate = nil;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
- (void)animateToRegion:(double)latitude
|
|
131
|
+
longitude:(double)longitude
|
|
132
|
+
latitudeDelta:(double)latitudeDelta
|
|
133
|
+
longitudeDelta:(double)longitudeDelta
|
|
134
|
+
duration:(NSInteger)duration
|
|
135
|
+
{
|
|
136
|
+
MACoordinateRegion region = MACoordinateRegionMake(
|
|
137
|
+
CLLocationCoordinate2DMake(latitude, longitude),
|
|
138
|
+
MACoordinateSpanMake(latitudeDelta, longitudeDelta)
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
[_mapView setRegion:region animated:duration > 0];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
145
|
+
{
|
|
146
|
+
RCTRNMapsMapViewHandleCommand(self, commandName, args);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
150
|
+
{
|
|
151
|
+
const auto &oldViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(_props);
|
|
152
|
+
const auto &newViewProps = *std::static_pointer_cast<RNMapsMapViewProps const>(props);
|
|
153
|
+
|
|
154
|
+
if (!_initialRegionApplied && RNMapsRegionIsValid(newViewProps.initialRegion)) {
|
|
155
|
+
[_mapView setRegion:RNMapsMACoordinateRegionFromRegion(newViewProps.initialRegion) animated:NO];
|
|
156
|
+
_initialRegionApplied = YES;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (RNMapsRegionIsValid(newViewProps.region) && RNMapsRegionChanged(oldViewProps.region, newViewProps.region)) {
|
|
160
|
+
[_mapView setRegion:RNMapsMACoordinateRegionFromRegion(newViewProps.region) animated:NO];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
_mapView.showsUserLocation = newViewProps.showsUserLocation;
|
|
164
|
+
_mapView.zoomEnabled = newViewProps.zoomEnabled;
|
|
165
|
+
_mapView.scrollEnabled = newViewProps.scrollEnabled;
|
|
166
|
+
_mapView.rotateEnabled = newViewProps.rotateEnabled;
|
|
167
|
+
_mapView.rotateCameraEnabled = newViewProps.pitchEnabled;
|
|
168
|
+
|
|
169
|
+
[self updateMarkers:newViewProps.markers];
|
|
170
|
+
|
|
171
|
+
[super updateProps:props oldProps:oldProps];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
- (void)updateMarkers:(const std::vector<RNMapsMapViewMarkersStruct> &)markers
|
|
175
|
+
{
|
|
176
|
+
[_mapView removeAnnotations:_annotationsByIdentifier.allValues];
|
|
177
|
+
[_annotationsByIdentifier removeAllObjects];
|
|
178
|
+
|
|
179
|
+
for (const auto &marker : markers) {
|
|
180
|
+
NSString *identifier = RNMapsNSStringFromString(marker.identifier);
|
|
181
|
+
if (identifier == nil) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
RNMapsMarkerAnnotation *annotation = [RNMapsMarkerAnnotation new];
|
|
186
|
+
annotation.identifier = identifier;
|
|
187
|
+
annotation.coordinate = CLLocationCoordinate2DMake(marker.latitude, marker.longitude);
|
|
188
|
+
annotation.title = RNMapsNSStringFromString(marker.title);
|
|
189
|
+
annotation.subtitle = RNMapsNSStringFromString(marker.description);
|
|
190
|
+
annotation.pinColor = RNMapsNSStringFromString(marker.pinColor);
|
|
191
|
+
annotation.draggable = marker.draggable;
|
|
192
|
+
|
|
193
|
+
_annotationsByIdentifier[identifier] = annotation;
|
|
194
|
+
[_mapView addAnnotation:annotation];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
- (void)emitRegionChangeComplete:(BOOL)complete isGesture:(BOOL)isGesture
|
|
199
|
+
{
|
|
200
|
+
if (!_eventEmitter) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
MACoordinateRegion region = _mapView.region;
|
|
205
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
206
|
+
|
|
207
|
+
if (complete) {
|
|
208
|
+
RNMapsMapViewEventEmitter::OnRegionChangeComplete event = {
|
|
209
|
+
.region.latitude = region.center.latitude,
|
|
210
|
+
.region.longitude = region.center.longitude,
|
|
211
|
+
.region.latitudeDelta = region.span.latitudeDelta,
|
|
212
|
+
.region.longitudeDelta = region.span.longitudeDelta,
|
|
213
|
+
.isGesture = static_cast<bool>(isGesture),
|
|
214
|
+
};
|
|
215
|
+
mapViewEventEmitter->onRegionChangeComplete(event);
|
|
216
|
+
} else {
|
|
217
|
+
RNMapsMapViewEventEmitter::OnRegionChange event = {
|
|
218
|
+
.region.latitude = region.center.latitude,
|
|
219
|
+
.region.longitude = region.center.longitude,
|
|
220
|
+
.region.latitudeDelta = region.span.latitudeDelta,
|
|
221
|
+
.region.longitudeDelta = region.span.longitudeDelta,
|
|
222
|
+
.isGesture = static_cast<bool>(isGesture),
|
|
223
|
+
};
|
|
224
|
+
mapViewEventEmitter->onRegionChange(event);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation
|
|
229
|
+
{
|
|
230
|
+
if (![annotation isKindOfClass:[RNMapsMarkerAnnotation class]]) {
|
|
231
|
+
return nil;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
static NSString *reuseIdentifier = @"RNMapsMarker";
|
|
235
|
+
MAPinAnnotationView *annotationView =
|
|
236
|
+
(MAPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:reuseIdentifier];
|
|
237
|
+
|
|
238
|
+
if (annotationView == nil) {
|
|
239
|
+
annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
|
|
240
|
+
} else {
|
|
241
|
+
annotationView.annotation = annotation;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
RNMapsMarkerAnnotation *marker = (RNMapsMarkerAnnotation *)annotation;
|
|
245
|
+
annotationView.canShowCallout = YES;
|
|
246
|
+
annotationView.draggable = marker.draggable;
|
|
247
|
+
|
|
248
|
+
if (marker.pinColor != nil) {
|
|
249
|
+
annotationView.pinColor = RNMapsPinColor(marker.pinColor);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return annotationView;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
- (void)mapViewRegionChanged:(MAMapView *)mapView
|
|
256
|
+
{
|
|
257
|
+
[self emitRegionChangeComplete:NO isGesture:_isGesture];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
- (void)mapView:(MAMapView *)mapView
|
|
261
|
+
regionWillChangeAnimated:(BOOL)animated
|
|
262
|
+
wasUserAction:(BOOL)wasUserAction
|
|
263
|
+
{
|
|
264
|
+
_isGesture = wasUserAction;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
- (void)mapView:(MAMapView *)mapView
|
|
268
|
+
regionDidChangeAnimated:(BOOL)animated
|
|
269
|
+
wasUserAction:(BOOL)wasUserAction
|
|
270
|
+
{
|
|
271
|
+
[self emitRegionChangeComplete:YES isGesture:wasUserAction];
|
|
272
|
+
_isGesture = NO;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
- (void)mapView:(MAMapView *)mapView didSelectAnnotationView:(MAAnnotationView *)view
|
|
276
|
+
{
|
|
277
|
+
if (!_eventEmitter || ![view.annotation isKindOfClass:[RNMapsMarkerAnnotation class]]) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
RNMapsMarkerAnnotation *marker = (RNMapsMarkerAnnotation *)view.annotation;
|
|
282
|
+
auto mapViewEventEmitter = std::static_pointer_cast<RNMapsMapViewEventEmitter const>(_eventEmitter);
|
|
283
|
+
RNMapsMapViewEventEmitter::OnMarkerPress event = {
|
|
284
|
+
.identifier = std::string([marker.identifier UTF8String]),
|
|
285
|
+
.coordinate.latitude = marker.coordinate.latitude,
|
|
286
|
+
.coordinate.longitude = marker.coordinate.longitude,
|
|
287
|
+
};
|
|
288
|
+
mapViewEventEmitter->onMarkerPress(event);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Marker","_props","__MAP_MARKER"],"sourceRoot":"../../src","sources":["MapMarker.tsx"],"mappings":";;AAMA,OAAO,MAAMA,MAAuB,GAAG,SAASA,MAAMA,CAACC,MAAmB,EAAE;EAC1E,OAAO,IAAI;AACb,CAAoB;AAEpBD,MAAM,CAACE,YAAY,GAAG,IAAI;AAE1B,eAAeF,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import NativeMapView, { Commands } from './MapViewNativeComponent';
|
|
5
|
+
import { fromProviderCoordinate, fromProviderRegion, toProviderCoordinate, toProviderRegion } from "./coordinate.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const SUPPORTED_PROVIDER = 'amap';
|
|
8
|
+
const DEFAULT_COORDINATE_SYSTEM = 'gcj02';
|
|
9
|
+
function isMarkerElement(child) {
|
|
10
|
+
return /*#__PURE__*/React.isValidElement(child) && Boolean(child.type.__MAP_MARKER);
|
|
11
|
+
}
|
|
12
|
+
function markerColorToString(color) {
|
|
13
|
+
if (typeof color === 'string') {
|
|
14
|
+
return color;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
export const MapView = /*#__PURE__*/React.forwardRef(function MapView({
|
|
19
|
+
provider = SUPPORTED_PROVIDER,
|
|
20
|
+
coordinateSystem = DEFAULT_COORDINATE_SYSTEM,
|
|
21
|
+
initialRegion,
|
|
22
|
+
region,
|
|
23
|
+
children,
|
|
24
|
+
onRegionChange,
|
|
25
|
+
onRegionChangeComplete,
|
|
26
|
+
...rest
|
|
27
|
+
}, ref) {
|
|
28
|
+
const nativeRef = React.useRef(null);
|
|
29
|
+
const markerHandlers = React.useRef({});
|
|
30
|
+
if (__DEV__ && provider !== SUPPORTED_PROVIDER) {
|
|
31
|
+
console.warn(`[react-native-cn-maps] provider="${provider}" is reserved but not implemented yet. Falling back to "amap".`);
|
|
32
|
+
}
|
|
33
|
+
const markers = React.useMemo(() => {
|
|
34
|
+
const nextHandlers = {};
|
|
35
|
+
const nativeMarkers = [];
|
|
36
|
+
React.Children.forEach(children, (child, index) => {
|
|
37
|
+
if (!isMarkerElement(child)) {
|
|
38
|
+
if (__DEV__ && child != null) {
|
|
39
|
+
console.warn('[react-native-cn-maps] Only <Marker /> children are rendered in the current MapView milestone.');
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const identifier = child.props.identifier ?? String(index);
|
|
44
|
+
const coordinate = toProviderCoordinate(child.props.coordinate, coordinateSystem);
|
|
45
|
+
if (child.props.onPress) {
|
|
46
|
+
nextHandlers[identifier] = child.props.onPress;
|
|
47
|
+
}
|
|
48
|
+
nativeMarkers.push({
|
|
49
|
+
identifier,
|
|
50
|
+
latitude: coordinate.latitude,
|
|
51
|
+
longitude: coordinate.longitude,
|
|
52
|
+
title: child.props.title,
|
|
53
|
+
description: child.props.description,
|
|
54
|
+
pinColor: markerColorToString(child.props.pinColor),
|
|
55
|
+
draggable: child.props.draggable
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
markerHandlers.current = nextHandlers;
|
|
59
|
+
return nativeMarkers;
|
|
60
|
+
}, [children, coordinateSystem]);
|
|
61
|
+
React.useImperativeHandle(ref, () => ({
|
|
62
|
+
animateToRegion(nextRegion, duration = 500) {
|
|
63
|
+
const providerRegion = toProviderRegion(nextRegion, coordinateSystem);
|
|
64
|
+
if (providerRegion && nativeRef.current) {
|
|
65
|
+
Commands.animateToRegion(nativeRef.current, providerRegion.latitude, providerRegion.longitude, providerRegion.latitudeDelta, providerRegion.longitudeDelta, duration);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}), [coordinateSystem]);
|
|
69
|
+
const handleRegionChange = React.useCallback(event => {
|
|
70
|
+
onRegionChange?.({
|
|
71
|
+
nativeEvent: {
|
|
72
|
+
...event.nativeEvent,
|
|
73
|
+
region: fromProviderRegion(event.nativeEvent.region, coordinateSystem)
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}, [coordinateSystem, onRegionChange]);
|
|
77
|
+
const handleRegionChangeComplete = React.useCallback(event => {
|
|
78
|
+
onRegionChangeComplete?.({
|
|
79
|
+
nativeEvent: {
|
|
80
|
+
...event.nativeEvent,
|
|
81
|
+
region: fromProviderRegion(event.nativeEvent.region, coordinateSystem)
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, [coordinateSystem, onRegionChangeComplete]);
|
|
85
|
+
const handleMarkerPress = React.useCallback(event => {
|
|
86
|
+
const handler = markerHandlers.current[event.nativeEvent.identifier];
|
|
87
|
+
if (!handler) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const coordinate = fromProviderCoordinate(event.nativeEvent.coordinate, coordinateSystem);
|
|
91
|
+
handler({
|
|
92
|
+
nativeEvent: {
|
|
93
|
+
identifier: event.nativeEvent.identifier,
|
|
94
|
+
coordinate
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}, [coordinateSystem]);
|
|
98
|
+
return /*#__PURE__*/_jsx(NativeMapView, {
|
|
99
|
+
...rest,
|
|
100
|
+
ref: nativeRef,
|
|
101
|
+
provider: SUPPORTED_PROVIDER,
|
|
102
|
+
coordinateSystem: coordinateSystem,
|
|
103
|
+
initialRegion: toProviderRegion(initialRegion, coordinateSystem),
|
|
104
|
+
region: toProviderRegion(region, coordinateSystem),
|
|
105
|
+
markers: markers,
|
|
106
|
+
onRegionChange: onRegionChange ? handleRegionChange : undefined,
|
|
107
|
+
onRegionChangeComplete: onRegionChangeComplete ? handleRegionChangeComplete : undefined,
|
|
108
|
+
onMarkerPress: handleMarkerPress
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=MapView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","NativeMapView","Commands","fromProviderCoordinate","fromProviderRegion","toProviderCoordinate","toProviderRegion","jsx","_jsx","SUPPORTED_PROVIDER","DEFAULT_COORDINATE_SYSTEM","isMarkerElement","child","isValidElement","Boolean","type","__MAP_MARKER","markerColorToString","color","undefined","MapView","forwardRef","provider","coordinateSystem","initialRegion","region","children","onRegionChange","onRegionChangeComplete","rest","ref","nativeRef","useRef","markerHandlers","__DEV__","console","warn","markers","useMemo","nextHandlers","nativeMarkers","Children","forEach","index","identifier","props","String","coordinate","onPress","push","latitude","longitude","title","description","pinColor","draggable","current","useImperativeHandle","animateToRegion","nextRegion","duration","providerRegion","latitudeDelta","longitudeDelta","handleRegionChange","useCallback","event","nativeEvent","handleRegionChangeComplete","handleMarkerPress","handler","onMarkerPress"],"sourceRoot":"../../src","sources":["MapView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,aAAa,IAAIC,QAAQ,QAAQ,0BAA0B;AAClE,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,oBAAoB,EACpBC,gBAAgB,QACX,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgBtB,MAAMC,kBAA+B,GAAG,MAAM;AAC9C,MAAMC,yBAA2C,GAAG,OAAO;AAE3D,SAASC,eA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,gBAAiB;IACnCC,aAAa,EAAElB,gBAAgB,CAACkB,aAAa,EAAED,gBAAgB,CAAE;IACjEE,MAAM,EAAEnB,gBAAgB,CAACmB,MAAM,EAAEF,gBAAgB,CAAE;IACnDc,OAAO,EAAEA,OAAQ;IACjBV,cAAc,EAAEA,cAAc,GAAGqC,kBAAkB,GAAG7C,SAAU;IAChES,sBAAsB,EACpBA,sBAAsB,GAAGwC,0BAA0B,GAAGjD,SACvD;IACDoD,aAAa,EAAEF;EAAkB,CAClC,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeCommands,
|
|
3
|
+
codegenNativeComponent,
|
|
4
|
+
type CodegenTypes,
|
|
5
|
+
type HostComponent,
|
|
6
|
+
type ViewProps,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
export type NativeRegion = Readonly<{
|
|
10
|
+
latitude: CodegenTypes.Double;
|
|
11
|
+
longitude: CodegenTypes.Double;
|
|
12
|
+
latitudeDelta: CodegenTypes.Double;
|
|
13
|
+
longitudeDelta: CodegenTypes.Double;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export type NativeMarker = Readonly<{
|
|
17
|
+
identifier: string;
|
|
18
|
+
latitude: CodegenTypes.Double;
|
|
19
|
+
longitude: CodegenTypes.Double;
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
pinColor?: string;
|
|
23
|
+
draggable?: CodegenTypes.WithDefault<boolean, false>;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
export type NativeRegionChangeEvent = Readonly<{
|
|
27
|
+
region: Readonly<{
|
|
28
|
+
latitude: CodegenTypes.Double;
|
|
29
|
+
longitude: CodegenTypes.Double;
|
|
30
|
+
latitudeDelta: CodegenTypes.Double;
|
|
31
|
+
longitudeDelta: CodegenTypes.Double;
|
|
32
|
+
}>;
|
|
33
|
+
isGesture?: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
|
|
36
|
+
export type NativeMarkerPressEvent = Readonly<{
|
|
37
|
+
identifier: string;
|
|
38
|
+
coordinate: Readonly<{
|
|
39
|
+
latitude: CodegenTypes.Double;
|
|
40
|
+
longitude: CodegenTypes.Double;
|
|
41
|
+
}>;
|
|
42
|
+
}>;
|
|
43
|
+
|
|
44
|
+
export interface NativeProps extends ViewProps {
|
|
45
|
+
provider?: CodegenTypes.WithDefault<string, 'amap'>;
|
|
46
|
+
coordinateSystem?: CodegenTypes.WithDefault<string, 'gcj02'>;
|
|
47
|
+
initialRegion?: NativeRegion;
|
|
48
|
+
region?: NativeRegion;
|
|
49
|
+
markers?: ReadonlyArray<NativeMarker>;
|
|
50
|
+
showsUserLocation?: CodegenTypes.WithDefault<boolean, false>;
|
|
51
|
+
zoomEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
52
|
+
scrollEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
53
|
+
rotateEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
54
|
+
pitchEnabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
55
|
+
onRegionChange?: CodegenTypes.DirectEventHandler<NativeRegionChangeEvent>;
|
|
56
|
+
onRegionChangeComplete?: CodegenTypes.DirectEventHandler<NativeRegionChangeEvent>;
|
|
57
|
+
onMarkerPress?: CodegenTypes.DirectEventHandler<NativeMarkerPressEvent>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
61
|
+
|
|
62
|
+
interface NativeCommands {
|
|
63
|
+
animateToRegion: (
|
|
64
|
+
viewRef: React.ElementRef<ComponentType>,
|
|
65
|
+
latitude: CodegenTypes.Double,
|
|
66
|
+
longitude: CodegenTypes.Double,
|
|
67
|
+
latitudeDelta: CodegenTypes.Double,
|
|
68
|
+
longitudeDelta: CodegenTypes.Double,
|
|
69
|
+
duration: CodegenTypes.Int32
|
|
70
|
+
) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
74
|
+
supportedCommands: ['animateToRegion'],
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export default codegenNativeComponent<NativeProps>(
|
|
78
|
+
'RNMapsMapView'
|
|
79
|
+
) as ComponentType;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const A = 6378245.0;
|
|
4
|
+
const EE = 0.00669342162296594323;
|
|
5
|
+
const PI = Math.PI;
|
|
6
|
+
function isOutsideChina(latitude, longitude) {
|
|
7
|
+
return longitude < 72.004 || longitude > 137.8347 || latitude < 0.8293 || latitude > 55.8271;
|
|
8
|
+
}
|
|
9
|
+
function transformLatitude(x, y) {
|
|
10
|
+
let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
|
|
11
|
+
ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
|
|
12
|
+
ret += (20.0 * Math.sin(y * PI) + 40.0 * Math.sin(y / 3.0 * PI)) * 2.0 / 3.0;
|
|
13
|
+
ret += (160.0 * Math.sin(y / 12.0 * PI) + 320 * Math.sin(y * PI / 30.0)) * 2.0 / 3.0;
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
function transformLongitude(x, y) {
|
|
17
|
+
let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
|
|
18
|
+
ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
|
|
19
|
+
ret += (20.0 * Math.sin(x * PI) + 40.0 * Math.sin(x / 3.0 * PI)) * 2.0 / 3.0;
|
|
20
|
+
ret += (150.0 * Math.sin(x / 12.0 * PI) + 300.0 * Math.sin(x / 30.0 * PI)) * 2.0 / 3.0;
|
|
21
|
+
return ret;
|
|
22
|
+
}
|
|
23
|
+
export function wgs84ToGcj02(coordinate) {
|
|
24
|
+
const {
|
|
25
|
+
latitude,
|
|
26
|
+
longitude
|
|
27
|
+
} = coordinate;
|
|
28
|
+
if (isOutsideChina(latitude, longitude)) {
|
|
29
|
+
return coordinate;
|
|
30
|
+
}
|
|
31
|
+
let dLat = transformLatitude(longitude - 105.0, latitude - 35.0);
|
|
32
|
+
let dLon = transformLongitude(longitude - 105.0, latitude - 35.0);
|
|
33
|
+
const radLat = latitude / 180.0 * PI;
|
|
34
|
+
let magic = Math.sin(radLat);
|
|
35
|
+
magic = 1 - EE * magic * magic;
|
|
36
|
+
const sqrtMagic = Math.sqrt(magic);
|
|
37
|
+
dLat = dLat * 180.0 / (A * (1 - EE) / (magic * sqrtMagic) * PI);
|
|
38
|
+
dLon = dLon * 180.0 / (A / sqrtMagic * Math.cos(radLat) * PI);
|
|
39
|
+
return {
|
|
40
|
+
latitude: latitude + dLat,
|
|
41
|
+
longitude: longitude + dLon
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function gcj02ToWgs84(coordinate) {
|
|
45
|
+
const converted = wgs84ToGcj02(coordinate);
|
|
46
|
+
return {
|
|
47
|
+
latitude: coordinate.latitude * 2 - converted.latitude,
|
|
48
|
+
longitude: coordinate.longitude * 2 - converted.longitude
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function toProviderCoordinate(coordinate, coordinateSystem) {
|
|
52
|
+
return coordinateSystem === 'wgs84' ? wgs84ToGcj02(coordinate) : coordinate;
|
|
53
|
+
}
|
|
54
|
+
export function fromProviderCoordinate(coordinate, coordinateSystem) {
|
|
55
|
+
return coordinateSystem === 'wgs84' ? gcj02ToWgs84(coordinate) : coordinate;
|
|
56
|
+
}
|
|
57
|
+
export function toProviderRegion(region, coordinateSystem) {
|
|
58
|
+
if (!region) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...region,
|
|
63
|
+
...toProviderCoordinate(region, coordinateSystem)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export function fromProviderRegion(region, coordinateSystem) {
|
|
67
|
+
return {
|
|
68
|
+
...region,
|
|
69
|
+
...fromProviderCoordinate(region, coordinateSystem)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=coordinate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["A","EE","PI","Math","isOutsideChina","latitude","longitude","transformLatitude","x","y","ret","sqrt","abs","sin","transformLongitude","wgs84ToGcj02","coordinate","dLat","dLon","radLat","magic","sqrtMagic","cos","gcj02ToWgs84","converted","toProviderCoordinate","coordinateSystem","fromProviderCoordinate","toProviderRegion","region","undefined","fromProviderRegion"],"sourceRoot":"../../src","sources":["coordinate.ts"],"mappings":";;AAEA,MAAMA,CAAC,GAAG,SAAS;AACnB,MAAMC,EAAE,GAAG,sBAAsB;AACjC,MAAMC,EAAE,GAAGC,IAAI,CAACD,EAAE;AAElB,SAASE,cAAcA,CAACC,QAAgB,EAAEC,SAAiB,EAAE;EAC3D,OACEA,SAAS,GAAG,MAAM,IAClBA,SAAS,GAAG,QAAQ,IACpBD,QAAQ,GAAG,MAAM,IACjBA,QAAQ,GAAG,OAAO;AAEtB;AAEA,SAASE,iBAAiBA,CAACC,CAAS,EAAEC,CAAS,EAAE;EAC/C,IAAIC,GAAG,GACL,CAAC,KAAK,GACN,GAAG,GAAGF,CAAC,GACP,GAAG,GAAGC,CAAC,GACP,GAAG,GAAGA,CAAC,GAAGA,CAAC,GACX,GAAG,GAAGD,CAAC,GAAGC,CAAC,GACX,GAAG,GAAGN,IAAI,CAACQ,IAAI,CAACR,IAAI,CAACS,GAAG,CAACJ,CAAC,CAAC,CAAC;EAC9BE,GAAG,IACA,CAAC,IAAI,GAAGP,IAAI,CAACU,GAAG,CAAC,GAAG,GAAGL,CAAC,GAAGN,EAAE,C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AAO,SAASK,YAAYA,CAACP,UAAkB,EAAU;EACvD,MAAMQ,SAAS,GAAGT,YAAY,CAACC,UAAU,CAAC;EAE1C,OAAO;IACLX,QAAQ,EAAEW,UAAU,CAACX,QAAQ,GAAG,CAAC,GAAGmB,SAAS,CAACnB,QAAQ;IACtDC,SAAS,EAAEU,UAAU,CAACV,SAAS,GAAG,CAAC,GAAGkB,SAAS,CAAClB;EAClD,CAAC;AACH;AAEA,OAAO,SAASmB,oBAAoBA,CAClCT,UAAkB,EAClBU,gBAAkC,EAC1B;EACR,OAAOA,gBAAgB,KAAK,OAAO,GAAGX,YAAY,CAACC,UAAU,CAAC,GAAGA,UAAU;AAC7E;AAEA,OAAO,SAASW,sBAAsBA,CACpCX,UAAkB,EAClBU,gBAAkC,EAC1B;EACR,OAAOA,gBAAgB,KAAK,OAAO,GAAGH,YAAY,CAACP,UAAU,CAAC,GAAGA,UAAU;AAC7E;AAEA,OAAO,SAASY,gBAAgBA,CAC9BC,MAA0B,EAC1BH,gBAAkC,EACd;EACpB,IAAI,CAACG,MAAM,EAAE;IACX,OAAOC,SAAS;EAClB;EAEA,OAAO;IACL,GAAGD,MAAM;IACT,GAAGJ,oBAAoB,CAACI,MAAM,EAAEH,gBAAgB;EAClD,CAAC;AACH;AAEA,OAAO,SAASK,kBAAkBA,CAChCF,MAAc,EACdH,gBAAkC,EAC1B;EACR,OAAO;IACL,GAAGG,MAAM;IACT,GAAGF,sBAAsB,CAACE,MAAM,EAAEH,gBAAgB;EACpD,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MapView","default","Marker","MapMarker"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,OAAO,EAAED,OAAO,QAAQ,cAAW;AACvD,SAASC,OAAO,IAAIC,MAAM,EAAEA,MAAM,IAAIC,SAAS,QAAQ,gBAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MarkerProps } from './types';
|
|
2
|
+
export type MarkerComponent = ((props: MarkerProps) => null) & {
|
|
3
|
+
__MAP_MARKER: true;
|
|
4
|
+
};
|
|
5
|
+
export declare const Marker: MarkerComponent;
|
|
6
|
+
export default Marker;
|
|
7
|
+
export type { MarkerProps as MapMarkerProps };
|
|
8
|
+
//# sourceMappingURL=MapMarker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapMarker.d.ts","sourceRoot":"","sources":["../../../src/MapMarker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG;IAC7D,YAAY,EAAE,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,eAED,CAAC;AAIrB,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,WAAW,IAAI,cAAc,EAAE,CAAC"}
|