@rnmapbox/maps 10.2.7 → 10.2.9
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/build.gradle +9 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +10 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/location/RNMBXCustomLocationProvider.kt +7 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/mapview/RNMBXMapView.kt +7 -1
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +180 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleValue.kt +4 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/events/MapSteadyEvent.kt +50 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/events/RNMBXCameraGestureObserver.kt +296 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/events/RNMBXCameraGestureObserverManager.kt +74 -0
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXModule.kt +2 -2
- package/android/src/main/java/com/rnmapbox/rnmbx/modules/RNMBXOfflineModuleLegacy.kt +10 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/layers/generated/RasterParticleLayer.kt +58 -0
- package/android/src/main/mapbox-v11-compat/v10/com/mapbox/maps/extension/style/sources/generated/RasterArraySource.kt +20 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +22 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +16 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +59 -0
- package/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt +45 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayer.kt +38 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/layers/RNMBXRasterParticleLayerManager.kt +85 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySource.kt +41 -0
- package/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterArraySourceManager.kt +76 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCameraGestureObserverManagerDelegate.java +39 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXCameraGestureObserverManagerInterface.java +18 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerDelegate.java +54 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterArraySourceManagerInterface.java +23 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerDelegate.java +66 -0
- package/android/src/main/old-arch/com/facebook/react/viewmanagers/RNMBXRasterParticleLayerManagerInterface.java +27 -0
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +2 -0
- package/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.swift +5 -0
- package/ios/RNMBX/RNMBXCamera.swift +88 -17
- package/ios/RNMBX/RNMBXCameraGestureObserver.swift +218 -0
- package/ios/RNMBX/RNMBXCameraGestureObserverComponentView.h +15 -0
- package/ios/RNMBX/RNMBXCameraGestureObserverComponentView.mm +119 -0
- package/ios/RNMBX/RNMBXCameraModule.h +3 -2
- package/ios/RNMBX/RNMBXCameraModule.mm +8 -16
- package/ios/RNMBX/RNMBXCustomLocationProvider.swift +22 -24
- package/ios/RNMBX/RNMBXImageModule.h +3 -2
- package/ios/RNMBX/RNMBXImageModule.mm +8 -16
- package/ios/RNMBX/RNMBXImages.swift +1 -4
- package/ios/RNMBX/RNMBXInteractiveElement.swift +22 -15
- package/ios/RNMBX/RNMBXMapView.swift +118 -12
- package/ios/RNMBX/RNMBXNativeUserLocation.swift +6 -6
- package/ios/RNMBX/RNMBXPointAnnotation.swift +6 -8
- package/ios/RNMBX/RNMBXPointAnnotationModule.h +3 -2
- package/ios/RNMBX/RNMBXPointAnnotationModule.mm +8 -16
- package/ios/RNMBX/RNMBXRasterArraySource.swift +47 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterArraySourceComponentView.mm +161 -0
- package/ios/RNMBX/RNMBXRasterArraySourceViewManager.swift +16 -0
- package/ios/RNMBX/RNMBXRasterParticleLayer.swift +100 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.h +15 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerComponentView.mm +110 -0
- package/ios/RNMBX/RNMBXRasterParticleLayerViewManager.swift +17 -0
- package/ios/RNMBX/RNMBXShapeSource.swift +5 -4
- package/ios/RNMBX/RNMBXShapeSourceModule.h +3 -2
- package/ios/RNMBX/RNMBXShapeSourceModule.mm +8 -16
- package/ios/RNMBX/RNMBXSource.swift +51 -21
- package/ios/RNMBX/RNMBXStyle.swift +152 -27
- package/ios/RNMBX/RNMBXStyleValue.swift +27 -0
- package/ios/RNMBX/RNMBXViewport.swift +13 -13
- package/ios/RNMBX/RNMBXViewportModule.h +3 -2
- package/ios/RNMBX/RNMBXViewportModule.mm +8 -16
- package/lib/commonjs/plugin/build/withMapbox.js +1 -1
- package/lib/commonjs/plugin/src/withMapbox.ts +13 -3
- package/lib/module/Mapbox.native.js +4 -0
- package/lib/module/Mapbox.native.js.map +1 -1
- package/lib/module/RNMBXModule.js.map +1 -1
- package/lib/module/components/CameraGestureObserver.js +17 -0
- package/lib/module/components/CameraGestureObserver.js.map +1 -0
- package/lib/module/components/PointAnnotation.js.map +1 -1
- package/lib/module/components/RasterArraySource.js +67 -0
- package/lib/module/components/RasterArraySource.js.map +1 -0
- package/lib/module/components/RasterParticleLayer.js +40 -0
- package/lib/module/components/RasterParticleLayer.js.map +1 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js +14 -0
- package/lib/module/modules/offline/offlineManagerLegacy.js.map +1 -1
- package/lib/module/specs/RNMBXCameraGestureObserverNativeComponent.ts +28 -0
- package/lib/module/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/lib/module/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/lib/module/utils/MapboxStyles.js.map +1 -1
- package/lib/module/utils/styleMap.js +9 -0
- package/lib/module/utils/styleMap.js.map +1 -1
- package/lib/typescript/plugin/src/withMapbox.d.ts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/generateCodeWithEjs.d.mts.map +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts +1 -1
- package/lib/typescript/scripts/autogenHelpers/globals.d.mts.map +1 -1
- package/lib/typescript/src/Mapbox.native.d.ts +5 -1
- package/lib/typescript/src/Mapbox.native.d.ts.map +1 -1
- package/lib/typescript/src/RNMBXModule.d.ts.map +1 -1
- package/lib/typescript/src/components/CameraGestureObserver.d.ts +27 -0
- package/lib/typescript/src/components/CameraGestureObserver.d.ts.map +1 -0
- package/lib/typescript/src/components/PointAnnotation.d.ts +1 -1
- package/lib/typescript/src/components/PointAnnotation.d.ts.map +1 -1
- package/lib/typescript/src/components/RasterArraySource.d.ts +72 -0
- package/lib/typescript/src/components/RasterArraySource.d.ts.map +1 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts +80 -0
- package/lib/typescript/src/components/RasterParticleLayer.d.ts.map +1 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts +11 -0
- package/lib/typescript/src/modules/offline/offlineManagerLegacy.d.ts.map +1 -1
- package/lib/typescript/src/specs/RNMBXCameraGestureObserverNativeComponent.d.ts +20 -0
- package/lib/typescript/src/specs/RNMBXCameraGestureObserverNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts +16 -0
- package/lib/typescript/src/specs/RNMBXRasterArraySourceNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts +25 -0
- package/lib/typescript/src/specs/RNMBXRasterParticleLayerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/utils/MapboxStyles.d.ts +44 -2
- package/lib/typescript/src/utils/MapboxStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/styleMap.d.ts.map +1 -1
- package/package.json +19 -2
- package/plugin/build/withMapbox.js +1 -1
- package/plugin/src/withMapbox.ts +13 -3
- package/rnmapbox-maps.podspec +1 -1
- package/src/Mapbox.native.ts +5 -0
- package/src/RNMBXModule.ts +1 -4
- package/src/components/CameraGestureObserver.tsx +37 -0
- package/src/components/PointAnnotation.tsx +2 -2
- package/src/components/RasterArraySource.tsx +134 -0
- package/src/components/RasterParticleLayer.tsx +117 -0
- package/src/modules/offline/offlineManagerLegacy.ts +14 -0
- package/src/specs/RNMBXCameraGestureObserverNativeComponent.ts +28 -0
- package/src/specs/RNMBXRasterArraySourceNativeComponent.ts +22 -0
- package/src/specs/RNMBXRasterParticleLayerNativeComponent.ts +39 -0
- package/src/utils/MapboxStyles.ts +47 -1
- package/src/utils/styleMap.ts +10 -0
|
@@ -248,18 +248,16 @@ public class RNMBXPointAnnotation : RNMBXInteractiveElement {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
// MARK: -
|
|
252
|
-
|
|
253
|
-
public override func addToMap(_ map: RNMBXMapView, style: Style) {
|
|
254
|
-
super.addToMap(map, style: style)
|
|
255
|
-
self.map = map
|
|
251
|
+
// MARK: - RNMBXMapAndMapViewComponent
|
|
252
|
+
|
|
253
|
+
public override func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
254
|
+
super.addToMap(map, mapView: mapView, style: style)
|
|
256
255
|
addIfPossible()
|
|
257
256
|
}
|
|
258
257
|
|
|
259
|
-
public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
258
|
+
public override func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
260
259
|
removeIfAdded()
|
|
261
|
-
|
|
262
|
-
return true
|
|
260
|
+
return super.removeFromMap(map, mapView: mapView, reason: reason)
|
|
263
261
|
}
|
|
264
262
|
|
|
265
263
|
// MARK: - RNMBXInteractiveElement
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
+
#import "RNMBXViewResolver.h"
|
|
3
4
|
|
|
4
5
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
6
|
#import "rnmapbox_maps_specs.h"
|
|
@@ -9,9 +10,9 @@
|
|
|
9
10
|
|
|
10
11
|
@interface RNMBXPointAnnotationModule : NSObject
|
|
11
12
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
-
<NativeRNMBXPointAnnotationModuleSpec>
|
|
13
|
+
<NativeRNMBXPointAnnotationModuleSpec, RNMBXViewResolverDelegate>
|
|
13
14
|
#else
|
|
14
|
-
<RCTBridgeModule>
|
|
15
|
+
<RCTBridgeModule, RNMBXViewResolverDelegate>
|
|
15
16
|
#endif
|
|
16
17
|
|
|
17
18
|
@end
|
|
@@ -27,22 +27,14 @@ RCT_EXPORT_MODULE();
|
|
|
27
27
|
|
|
28
28
|
- (void)withPointAnnotation:(nonnull NSNumber*)viewRef block:(void (^)(RNMBXPointAnnotation *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
RNMBXPointAnnotation *view = [uiManager viewForReactTag:viewRef];
|
|
39
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
40
|
-
if (view != nil) {
|
|
41
|
-
block(view);
|
|
42
|
-
} else {
|
|
43
|
-
reject(methodName, [NSString stringWithFormat:@"Unknown reactTag: %@", viewRef], nil);
|
|
44
|
-
}
|
|
45
|
-
}];
|
|
30
|
+
[RNMBXViewResolver withViewRef:viewRef
|
|
31
|
+
delegate:self
|
|
32
|
+
expectedClass:[RNMBXPointAnnotation class]
|
|
33
|
+
block:^(UIView *view) {
|
|
34
|
+
block((RNMBXPointAnnotation *)view);
|
|
35
|
+
}
|
|
36
|
+
reject:reject
|
|
37
|
+
methodName:methodName];
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#if RNMBX_11
|
|
2
|
+
@_spi(Experimental) import MapboxMaps
|
|
3
|
+
|
|
4
|
+
@objc
|
|
5
|
+
public class RNMBXRasterArraySource : RNMBXSource {
|
|
6
|
+
typealias SourceType = RasterArraySource
|
|
7
|
+
|
|
8
|
+
@objc public var url: String? = nil
|
|
9
|
+
|
|
10
|
+
@objc public var tileUrlTemplates: [String]? = nil
|
|
11
|
+
|
|
12
|
+
@objc public var minZoomLevel: NSNumber?
|
|
13
|
+
@objc public var maxZoomLevel: NSNumber?
|
|
14
|
+
@objc public var tileSize: NSNumber?
|
|
15
|
+
|
|
16
|
+
@objc public var sourceBounds: [NSNumber]? = nil
|
|
17
|
+
|
|
18
|
+
override func makeSource() -> Source
|
|
19
|
+
{
|
|
20
|
+
// Note: tileSize and bounds are read-only after initialization in RasterArraySource
|
|
21
|
+
// They can only be set via the constructor or are derived from the source
|
|
22
|
+
var result = RasterArraySource(id: self.id)
|
|
23
|
+
if let url = url {
|
|
24
|
+
result.url = url
|
|
25
|
+
} else {
|
|
26
|
+
result.tiles = tileUrlTemplates
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if let minZoomLevel = minZoomLevel {
|
|
30
|
+
result.minzoom = minZoomLevel.doubleValue
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if let maxZoomLevel = maxZoomLevel {
|
|
34
|
+
result.maxzoom = maxZoomLevel.doubleValue
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Note: tileSize and bounds are read-only properties in RasterArraySource
|
|
38
|
+
// and cannot be set directly. They are either:
|
|
39
|
+
// - Derived from the TileJSON when using url
|
|
40
|
+
// - Use default values when using tiles
|
|
41
|
+
// If custom values are needed, they should be included in the TileJSON response
|
|
42
|
+
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
#import <React/RCTUIManager.h>
|
|
6
|
+
#import <React/RCTViewComponentView.h>
|
|
7
|
+
|
|
8
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
9
|
+
|
|
10
|
+
@interface RNMBXRasterArraySourceComponentView : RCTViewComponentView
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_END
|
|
14
|
+
|
|
15
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import "RNMBXRasterArraySourceComponentView.h"
|
|
4
|
+
#import "RNMBXFabricHelpers.h"
|
|
5
|
+
|
|
6
|
+
#import <React/RCTConversions.h>
|
|
7
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
8
|
+
|
|
9
|
+
#import <react/renderer/components/rnmapbox_maps_specs/ComponentDescriptors.h>
|
|
10
|
+
#import <react/renderer/components/rnmapbox_maps_specs/EventEmitters.h>
|
|
11
|
+
#import <react/renderer/components/rnmapbox_maps_specs/Props.h>
|
|
12
|
+
#import <react/renderer/components/rnmapbox_maps_specs/RCTComponentViewHelpers.h>
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
@interface RNMBXRasterArraySourceComponentView () <RCTRNMBXRasterArraySourceViewProtocol>
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
#if RNMBX_11
|
|
20
|
+
|
|
21
|
+
@implementation RNMBXRasterArraySourceComponentView {
|
|
22
|
+
RNMBXRasterArraySource *_view;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
26
|
+
+ (void)load
|
|
27
|
+
{
|
|
28
|
+
[super load];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
32
|
+
{
|
|
33
|
+
if (self = [super initWithFrame:frame]) {
|
|
34
|
+
static const auto defaultProps = std::make_shared<const RNMBXRasterArraySourceProps>();
|
|
35
|
+
_props = defaultProps;
|
|
36
|
+
[self prepareView];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return self;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)prepareView
|
|
43
|
+
{
|
|
44
|
+
_view = [[RNMBXRasterArraySource alloc] init];
|
|
45
|
+
self.contentView = _view;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void)prepareForRecycle
|
|
49
|
+
{
|
|
50
|
+
[super prepareForRecycle];
|
|
51
|
+
[self prepareView];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
55
|
+
{
|
|
56
|
+
if ([childComponentView isKindOfClass:[RCTViewComponentView class]]) {
|
|
57
|
+
[_view insertReactSubviewInternal:((RCTViewComponentView *)childComponentView).contentView at:index];
|
|
58
|
+
} else {
|
|
59
|
+
RCTLogError(@"Tried to add view that is not RCTViewComponentView: %@", childComponentView);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
|
|
64
|
+
{
|
|
65
|
+
if ([childComponentView isKindOfClass:[RCTViewComponentView class]]) {
|
|
66
|
+
[_view removeReactSubviewInternal:((RCTViewComponentView *)childComponentView).contentView];
|
|
67
|
+
} else {
|
|
68
|
+
RCTLogError(@"Tried to remove view that is not RCTViewComponentView: %@", childComponentView);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#pragma mark - RCTComponentViewProtocol
|
|
73
|
+
|
|
74
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
75
|
+
{
|
|
76
|
+
return concreteComponentDescriptorProvider<RNMBXRasterArraySourceComponentDescriptor>();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
80
|
+
{
|
|
81
|
+
const auto &newProps = static_cast<const RNMBXRasterArraySourceProps &>(*props);
|
|
82
|
+
id idx = RNMBXConvertFollyDynamicToId(newProps.id);
|
|
83
|
+
if (idx != nil) {
|
|
84
|
+
_view.id = idx;
|
|
85
|
+
}
|
|
86
|
+
id existing = RNMBXConvertFollyDynamicToId(newProps.existing);
|
|
87
|
+
if (existing != nil) {
|
|
88
|
+
_view.existing = existing;
|
|
89
|
+
}
|
|
90
|
+
id url = RNMBXConvertFollyDynamicToId(newProps.url);
|
|
91
|
+
if (url != nil) {
|
|
92
|
+
_view.url = url;
|
|
93
|
+
}
|
|
94
|
+
id tileUrlTemplates = RNMBXConvertFollyDynamicToId(newProps.tileUrlTemplates);
|
|
95
|
+
if (tileUrlTemplates != nil) {
|
|
96
|
+
_view.tileUrlTemplates = tileUrlTemplates;
|
|
97
|
+
}
|
|
98
|
+
id minZoomLevel = RNMBXConvertFollyDynamicToId(newProps.minZoomLevel);
|
|
99
|
+
if (minZoomLevel != nil) {
|
|
100
|
+
_view.minZoomLevel = minZoomLevel;
|
|
101
|
+
}
|
|
102
|
+
id maxZoomLevel = RNMBXConvertFollyDynamicToId(newProps.maxZoomLevel);
|
|
103
|
+
if (maxZoomLevel != nil) {
|
|
104
|
+
_view.maxZoomLevel = maxZoomLevel;
|
|
105
|
+
}
|
|
106
|
+
id tileSize = RNMBXConvertFollyDynamicToId(newProps.tileSize);
|
|
107
|
+
if (tileSize != nil) {
|
|
108
|
+
_view.tileSize = tileSize;
|
|
109
|
+
}
|
|
110
|
+
id sourceBounds = RNMBXConvertFollyDynamicToId(newProps.sourceBounds);
|
|
111
|
+
if (sourceBounds != nil) {
|
|
112
|
+
_view.sourceBounds = sourceBounds;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[super updateProps:props oldProps:oldProps];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@end
|
|
119
|
+
|
|
120
|
+
#else // !RNMBX_11
|
|
121
|
+
|
|
122
|
+
// RasterArraySource is only available in Mapbox v11+
|
|
123
|
+
// Provide a stub implementation for v10 builds
|
|
124
|
+
|
|
125
|
+
@implementation RNMBXRasterArraySourceComponentView
|
|
126
|
+
|
|
127
|
+
+ (void)load
|
|
128
|
+
{
|
|
129
|
+
[super load];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
133
|
+
{
|
|
134
|
+
if (self = [super initWithFrame:frame]) {
|
|
135
|
+
static const auto defaultProps = std::make_shared<const RNMBXRasterArraySourceProps>();
|
|
136
|
+
_props = defaultProps;
|
|
137
|
+
}
|
|
138
|
+
return self;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
142
|
+
{
|
|
143
|
+
return concreteComponentDescriptorProvider<RNMBXRasterArraySourceComponentDescriptor>();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
147
|
+
{
|
|
148
|
+
[super updateProps:props oldProps:oldProps];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@end
|
|
152
|
+
|
|
153
|
+
#endif // RNMBX_11
|
|
154
|
+
|
|
155
|
+
Class<RCTComponentViewProtocol> RNMBXRasterArraySourceCls(void)
|
|
156
|
+
{
|
|
157
|
+
return RNMBXRasterArraySourceComponentView.class;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import MapboxMaps
|
|
3
|
+
|
|
4
|
+
#if RNMBX_11
|
|
5
|
+
@objc(RNMBXRasterArraySourceViewManager)
|
|
6
|
+
class RNMBXRasterArraySourceViewManager : RCTViewManager {
|
|
7
|
+
@objc
|
|
8
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override func view() -> UIView! {
|
|
13
|
+
return RNMBXRasterArraySource()
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
#endif
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#if RNMBX_11
|
|
2
|
+
@_spi(Experimental) import MapboxMaps
|
|
3
|
+
|
|
4
|
+
@objc(RNMBXRasterParticleLayer)
|
|
5
|
+
public class RNMBXRasterParticleLayer: RNMBXLayer {
|
|
6
|
+
typealias LayerType = RasterParticleLayer
|
|
7
|
+
|
|
8
|
+
override func makeLayer(style: Style) throws -> Layer {
|
|
9
|
+
var layer = LayerType(id: self.id!, source: sourceID!)
|
|
10
|
+
layer.source = sourceID
|
|
11
|
+
return layer
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// @{codepart-replace-start(LayerPropsCommon.codepart-swift.ejs,{layerType:"RasterParticle"})}
|
|
15
|
+
func setCommonOptions(_ layer: inout RasterParticleLayer) -> Bool {
|
|
16
|
+
var changed = false
|
|
17
|
+
|
|
18
|
+
#if RNMBX_11
|
|
19
|
+
if let sourceLayerID = sourceLayerID {
|
|
20
|
+
layer.sourceLayer = sourceLayerID
|
|
21
|
+
changed = true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if let sourceID = sourceID {
|
|
25
|
+
if !(existingLayer && sourceID == DEFAULT_SOURCE_ID) && hasSource() {
|
|
26
|
+
layer.source = sourceID
|
|
27
|
+
changed = true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if let filter = filter, filter.count > 0 {
|
|
32
|
+
do {
|
|
33
|
+
let data = try JSONSerialization.data(withJSONObject: filter, options: .prettyPrinted)
|
|
34
|
+
let decodedExpression = try JSONDecoder().decode(Expression.self, from: data)
|
|
35
|
+
layer.filter = decodedExpression
|
|
36
|
+
changed = true
|
|
37
|
+
} catch {
|
|
38
|
+
Logger.log(level: .error, message: "parsing filters failed for layer \(optional: id): \(error.localizedDescription)")
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
return changed
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override func setOptions(_ layer: inout Layer) {
|
|
47
|
+
super.setOptions(&layer)
|
|
48
|
+
if var actualLayer = layer as? LayerType {
|
|
49
|
+
if self.setCommonOptions(&actualLayer) {
|
|
50
|
+
layer = actualLayer
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
Logger.log(level: .error, message: "Expected layer type to be RasterParticle but was \(type(of: layer))")
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override func apply(style : Style) throws {
|
|
58
|
+
try style.updateLayer(withId: id, type: LayerType.self) { (layer : inout RasterParticleLayer) in
|
|
59
|
+
if self.styleLayer != nil {
|
|
60
|
+
self.setOptions(&self.styleLayer!)
|
|
61
|
+
}
|
|
62
|
+
if let styleLayer = self.styleLayer as? LayerType {
|
|
63
|
+
layer = styleLayer
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// @{codepart-replace-end}
|
|
68
|
+
|
|
69
|
+
override func addStyles() {
|
|
70
|
+
if let style : Style = self.style,
|
|
71
|
+
let reactStyle = reactStyle {
|
|
72
|
+
let styler = RNMBXStyle(style: self.style!)
|
|
73
|
+
styler.bridge = self.bridge
|
|
74
|
+
|
|
75
|
+
if var styleLayer = self.styleLayer as? LayerType {
|
|
76
|
+
styler.rasterParticleLayer(
|
|
77
|
+
layer: &styleLayer,
|
|
78
|
+
reactStyle: reactStyle,
|
|
79
|
+
oldReactStyle: oldReatStyle,
|
|
80
|
+
applyUpdater:{ (updater) in logged("RNMBXRasterParticleLayer.updateLayer") {
|
|
81
|
+
try style.updateLayer(withId: self.id, type: LayerType.self) { (layer: inout LayerType) in updater(&layer) }
|
|
82
|
+
}},
|
|
83
|
+
isValid: { return self.isAddedToMap() }
|
|
84
|
+
)
|
|
85
|
+
self.styleLayer = styleLayer
|
|
86
|
+
} else {
|
|
87
|
+
fatalError("[xxx] layer is not raster particle layer?!!! \(optional: self.styleLayer)")
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
func isAddedToMap() -> Bool {
|
|
93
|
+
return true
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override func layerType() -> Layer.Type {
|
|
97
|
+
return LayerType.self
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import <UIKit/UIKit.h>
|
|
4
|
+
|
|
5
|
+
#import <React/RCTUIManager.h>
|
|
6
|
+
#import <React/RCTViewComponentView.h>
|
|
7
|
+
|
|
8
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
9
|
+
|
|
10
|
+
@interface RNMBXRasterParticleLayerComponentView : RCTViewComponentView
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_END
|
|
14
|
+
|
|
15
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
2
|
+
|
|
3
|
+
#import "RNMBXRasterParticleLayerComponentView.h"
|
|
4
|
+
#import "RNMBXFabricHelpers.h"
|
|
5
|
+
|
|
6
|
+
#import <React/RCTConversions.h>
|
|
7
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
8
|
+
#import <React/RCTBridge+Private.h>
|
|
9
|
+
|
|
10
|
+
#import <react/renderer/components/rnmapbox_maps_specs/ComponentDescriptors.h>
|
|
11
|
+
#import <react/renderer/components/rnmapbox_maps_specs/EventEmitters.h>
|
|
12
|
+
#import <react/renderer/components/rnmapbox_maps_specs/Props.h>
|
|
13
|
+
#import <react/renderer/components/rnmapbox_maps_specs/RCTComponentViewHelpers.h>
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
|
|
17
|
+
@interface RNMBXRasterParticleLayerComponentView () <RCTRNMBXRasterParticleLayerViewProtocol>
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
#if RNMBX_11
|
|
21
|
+
|
|
22
|
+
@implementation RNMBXRasterParticleLayerComponentView {
|
|
23
|
+
RNMBXRasterParticleLayer *_view;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
27
|
+
+ (void)load
|
|
28
|
+
{
|
|
29
|
+
[super load];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
33
|
+
{
|
|
34
|
+
if (self = [super initWithFrame:frame]) {
|
|
35
|
+
static const auto defaultProps = std::make_shared<const RNMBXRasterParticleLayerProps>();
|
|
36
|
+
_props = defaultProps;
|
|
37
|
+
[self prepareView];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return self;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (void)prepareView
|
|
44
|
+
{
|
|
45
|
+
_view = [[RNMBXRasterParticleLayer alloc] init];
|
|
46
|
+
_view.bridge = [RCTBridge currentBridge];
|
|
47
|
+
self.contentView = _view;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#pragma mark - RCTComponentViewProtocol
|
|
51
|
+
|
|
52
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
53
|
+
{
|
|
54
|
+
return concreteComponentDescriptorProvider<RNMBXRasterParticleLayerComponentDescriptor>();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
58
|
+
{
|
|
59
|
+
const auto &newProps = static_cast<const RNMBXRasterParticleLayerProps &>(*props);
|
|
60
|
+
RNMBXSetCommonLayerProps(newProps, _view);
|
|
61
|
+
|
|
62
|
+
[super updateProps:props oldProps:oldProps];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
- (void)prepareForRecycle
|
|
66
|
+
{
|
|
67
|
+
[super prepareForRecycle];
|
|
68
|
+
[self prepareView];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@end
|
|
72
|
+
|
|
73
|
+
#else // !RNMBX_11
|
|
74
|
+
|
|
75
|
+
@implementation RNMBXRasterParticleLayerComponentView
|
|
76
|
+
|
|
77
|
+
+ (void)load
|
|
78
|
+
{
|
|
79
|
+
[super load];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
83
|
+
{
|
|
84
|
+
if (self = [super initWithFrame:frame]) {
|
|
85
|
+
static const auto defaultProps = std::make_shared<const RNMBXRasterParticleLayerProps>();
|
|
86
|
+
_props = defaultProps;
|
|
87
|
+
}
|
|
88
|
+
return self;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
92
|
+
{
|
|
93
|
+
return concreteComponentDescriptorProvider<RNMBXRasterParticleLayerComponentDescriptor>();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
|
|
97
|
+
{
|
|
98
|
+
[super updateProps:props oldProps:oldProps];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@end
|
|
102
|
+
|
|
103
|
+
#endif // RNMBX_11
|
|
104
|
+
|
|
105
|
+
Class<RCTComponentViewProtocol> RNMBXRasterParticleLayerCls(void)
|
|
106
|
+
{
|
|
107
|
+
return RNMBXRasterParticleLayerComponentView.class;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
#if RNMBX_11
|
|
4
|
+
@objc(RNMBXRasterParticleLayerViewManager)
|
|
5
|
+
class RNMBXRasterParticleLayerViewManager: RCTViewManager {
|
|
6
|
+
@objc
|
|
7
|
+
override static func requiresMainQueueSetup() -> Bool {
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
override func view() -> UIView! {
|
|
12
|
+
let layer = RNMBXRasterParticleLayer()
|
|
13
|
+
layer.bridge = self.bridge
|
|
14
|
+
return layer
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
#endif
|
|
@@ -55,15 +55,16 @@ public class RNMBXShapeSource : RNMBXSource {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
|
|
59
|
+
public override func addToMap(_ map: RNMBXMapView, mapView: MapView, style: Style) {
|
|
60
|
+
super.addToMap(map, mapView:mapView, style: style)
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
public override func removeFromMap(_ map: RNMBXMapView, reason: RemovalReason) -> Bool {
|
|
63
|
+
public override func removeFromMap(_ map: RNMBXMapView, mapView: MapView, reason: RemovalReason) -> Bool {
|
|
63
64
|
if (reason == .ViewRemoval) {
|
|
64
65
|
shapeAnimator?.unsubscribe(consumer: self)
|
|
65
66
|
}
|
|
66
|
-
return super.removeFromMap(map, reason: reason)
|
|
67
|
+
return super.removeFromMap(map, mapView:mapView, reason: reason)
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
@objc public var cluster : NSNumber?
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
+
#import "RNMBXViewResolver.h"
|
|
3
4
|
|
|
4
5
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
5
6
|
#import "rnmapbox_maps_specs.h"
|
|
@@ -9,9 +10,9 @@
|
|
|
9
10
|
|
|
10
11
|
@interface RNMBXShapeSourceModule : NSObject
|
|
11
12
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
12
|
-
<NativeRNMBXShapeSourceModuleSpec>
|
|
13
|
+
<NativeRNMBXShapeSourceModuleSpec, RNMBXViewResolverDelegate>
|
|
13
14
|
#else
|
|
14
|
-
<RCTBridgeModule>
|
|
15
|
+
<RCTBridgeModule, RNMBXViewResolverDelegate>
|
|
15
16
|
#endif
|
|
16
17
|
|
|
17
18
|
@end
|
|
@@ -27,22 +27,14 @@ RCT_EXPORT_MODULE();
|
|
|
27
27
|
|
|
28
28
|
- (void)withShapeSource:(nonnull NSNumber*)viewRef block:(void (^)(RNMBXShapeSource *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
|
|
29
29
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
RNMBXShapeSource *view = [uiManager viewForReactTag:viewRef];
|
|
39
|
-
#endif // RCT_NEW_ARCH_ENABLED
|
|
40
|
-
if (view != nil) {
|
|
41
|
-
block(view);
|
|
42
|
-
} else {
|
|
43
|
-
reject(methodName, [NSString stringWithFormat:@"Unknown reactTag: %@", viewRef], nil);
|
|
44
|
-
}
|
|
45
|
-
}];
|
|
30
|
+
[RNMBXViewResolver withViewRef:viewRef
|
|
31
|
+
delegate:self
|
|
32
|
+
expectedClass:[RNMBXShapeSource class]
|
|
33
|
+
block:^(UIView *view) {
|
|
34
|
+
block((RNMBXShapeSource *)view);
|
|
35
|
+
}
|
|
36
|
+
reject:reject
|
|
37
|
+
methodName:methodName];
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
|