@maplibre/maplibre-react-native 11.0.0-alpha.7 → 11.0.0-alpha.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/MapLibreReactNative.podspec +1 -1
- package/android/build.gradle +0 -3
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +43 -0
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.kt +71 -0
- package/android/src/main/java/org/maplibre/reactnative/components/annotation/MLRNPointAnnotation.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.kt +203 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.kt +109 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.kt +60 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.kt +409 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.kt +69 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraModule.kt +34 -0
- package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraEasing.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/components/images/MLRNImages.java +1 -2
- package/android/src/main/java/org/maplibre/reactnative/components/location/LocationComponentManager.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.kt +23 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.kt +23 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.kt +1338 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.kt +187 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewModule.kt +159 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.kt +26 -0
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/LayerSourceInfo.kt +74 -0
- package/android/src/main/java/org/maplibre/reactnative/components/styles/layers/MLRNLayer.java +1 -5
- package/android/src/main/java/org/maplibre/reactnative/components/styles/light/MLRNLight.java +1 -6
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +2 -9
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNSource.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/events/AbstractEvent.java +2 -5
- package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.kt +18 -0
- package/android/src/main/java/org/maplibre/reactnative/events/MapClickEvent.java +4 -0
- package/android/src/main/java/org/maplibre/reactnative/events/MapPressEvent.kt +27 -0
- package/android/src/main/java/org/maplibre/reactnative/events/TrackUserLocationChangeEvent.kt +24 -0
- package/android/src/main/java/org/maplibre/reactnative/events/constants/EventKeys.java +0 -1
- package/android/src/main/java/org/maplibre/reactnative/events/constants/EventTypes.java +0 -19
- package/android/src/main/java/org/maplibre/reactnative/location/LocationManager.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/location/TrackUserLocationMode.kt +43 -0
- package/android/src/main/java/org/maplibre/reactnative/location/{UserTrackingState.java → TrackUserLocationState.java} +1 -1
- package/android/src/main/java/org/maplibre/reactnative/location/UserLocation.java +1 -1
- package/android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java +1 -49
- package/android/src/main/java/org/maplibre/reactnative/utils/ConvertUtils.java +2 -9
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.kt +322 -0
- package/android/src/main/java/org/maplibre/reactnative/utils/ReactTagResolver.kt +85 -0
- package/ios/MLRNCallout.h +1 -1
- package/ios/MLRNEvent.m +3 -1
- package/ios/MLRNEventTypes.h +10 -31
- package/ios/MLRNEventTypes.m +10 -30
- package/ios/MLRNImages.h +1 -1
- package/ios/MLRNImages.m +1 -1
- package/ios/MLRNLayer.h +1 -1
- package/ios/MLRNLayer.m +2 -2
- package/ios/MLRNLight.h +2 -1
- package/ios/MLRNLocationModule.m +2 -2
- package/ios/MLRNMapTouchEvent.h +2 -1
- package/ios/MLRNMapTouchEvent.m +12 -10
- package/ios/MLRNModule.m +5 -52
- package/ios/MLRNNativeUserLocation.m +0 -1
- package/ios/MLRNOfflineModule.h +2 -2
- package/ios/MLRNOfflineModule.m +9 -9
- package/ios/MLRNPointAnnotation.h +1 -1
- package/ios/MLRNShapeSource.h +1 -1
- package/ios/MLRNSource.h +3 -1
- package/ios/MLRNStyle.m +20 -20
- package/ios/MLRNUtils.h +17 -2
- package/ios/MLRNUtils.m +25 -2
- package/ios/components/camera/CameraEasing.h +8 -0
- package/ios/{CameraStop.h → components/camera/CameraStop.h} +10 -6
- package/ios/components/camera/CameraStop.m +75 -0
- package/ios/{CameraUpdateItem.m → components/camera/CameraUpdateItem.m} +45 -46
- package/ios/components/camera/MLRNCamera.h +26 -0
- package/ios/components/camera/MLRNCamera.m +195 -0
- package/ios/components/camera/MLRNCameraComponentView.h +18 -0
- package/ios/components/camera/MLRNCameraComponentView.mm +192 -0
- package/ios/components/camera/MLRNCameraManager.h +11 -0
- package/ios/components/camera/MLRNCameraManager.m +20 -0
- package/ios/components/camera/MLRNCameraModule.h +4 -0
- package/ios/components/camera/MLRNCameraModule.mm +111 -0
- package/ios/{MLRNMapView.h → components/map-view/MLRNMapView.h} +42 -20
- package/ios/components/map-view/MLRNMapView.m +809 -0
- package/ios/components/map-view/MLRNMapViewComponentView.h +18 -0
- package/ios/components/map-view/MLRNMapViewComponentView.mm +400 -0
- package/ios/components/map-view/MLRNMapViewManager.h +70 -0
- package/ios/components/map-view/MLRNMapViewManager.m +163 -0
- package/ios/components/map-view/MLRNMapViewModule.h +4 -0
- package/ios/components/map-view/MLRNMapViewModule.mm +249 -0
- package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.mm +0 -1
- package/lib/commonjs/MLRNModule.js +1 -3
- package/lib/commonjs/MLRNModule.js.map +1 -1
- package/lib/commonjs/components/Annotation.js +1 -13
- package/lib/commonjs/components/Annotation.js.map +1 -1
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +2 -21
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +3 -26
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/commonjs/components/camera/Camera.js +97 -0
- package/lib/commonjs/components/camera/Camera.js.map +1 -0
- package/lib/commonjs/components/camera/CameraNativeComponent.ts +61 -0
- package/lib/commonjs/components/camera/NativeCameraModule.js +11 -0
- package/lib/commonjs/components/camera/NativeCameraModule.js.map +1 -0
- package/lib/commonjs/components/map-view/MapView.js +115 -0
- package/lib/commonjs/components/map-view/MapView.js.map +1 -0
- package/lib/commonjs/components/map-view/MapViewNativeComponent.ts +96 -0
- package/lib/commonjs/components/map-view/NativeMapViewModule.js +9 -0
- package/lib/commonjs/components/map-view/NativeMapViewModule.js.map +1 -0
- package/lib/commonjs/index.js +246 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js +2 -2
- package/lib/commonjs/modules/snapshot/NativeSnapshotModule.js.map +1 -1
- package/lib/commonjs/modules/snapshot/SnapshotManager.js +3 -2
- package/lib/commonjs/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/commonjs/types/Bounds.js +2 -0
- package/lib/commonjs/types/{OnPressEvent.js.map → Bounds.js.map} +1 -1
- package/lib/commonjs/types/PressEvent.js +2 -0
- package/lib/{module/types/OnPressEvent.js.map → commonjs/types/PressEvent.js.map} +1 -1
- package/lib/commonjs/types/ViewPadding.js +2 -0
- package/lib/commonjs/types/{MapLibreRNEvent.js.map → ViewPadding.js.map} +1 -1
- package/lib/commonjs/types/codegen/UnsafeMixed.js +2 -0
- package/lib/commonjs/types/codegen/UnsafeMixed.js.map +1 -0
- package/lib/commonjs/utils/index.js +0 -11
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/MLRNModule.js +0 -1
- package/lib/module/MLRNModule.js.map +1 -1
- package/lib/module/components/Annotation.js +2 -14
- package/lib/module/components/Annotation.js.map +1 -1
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/ShapeSource.js +3 -22
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/VectorSource.js +4 -27
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/module/components/camera/Camera.js +92 -0
- package/lib/module/components/camera/Camera.js.map +1 -0
- package/lib/module/components/camera/CameraNativeComponent.ts +61 -0
- package/lib/module/components/camera/NativeCameraModule.js +10 -0
- package/lib/module/components/camera/NativeCameraModule.js.map +1 -0
- package/lib/module/components/map-view/MapView.js +110 -0
- package/lib/module/components/map-view/MapView.js.map +1 -0
- package/lib/module/components/map-view/MapViewNativeComponent.ts +96 -0
- package/lib/module/components/map-view/NativeMapViewModule.js +5 -0
- package/lib/module/components/map-view/NativeMapViewModule.js.map +1 -0
- package/lib/module/index.js +30 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/snapshot/NativeSnapshotModule.js +1 -1
- package/lib/module/modules/snapshot/NativeSnapshotModule.js.map +1 -1
- package/lib/module/modules/snapshot/SnapshotManager.js +1 -1
- package/lib/module/modules/snapshot/SnapshotManager.js.map +1 -1
- package/lib/module/types/Bounds.js +2 -0
- package/lib/module/types/{MapLibreRNEvent.js.map → Bounds.js.map} +1 -1
- package/lib/module/types/PressEvent.js +2 -0
- package/lib/module/types/PressEvent.js.map +1 -0
- package/lib/module/types/ViewPadding.js +2 -0
- package/lib/module/types/ViewPadding.js.map +1 -0
- package/lib/module/types/codegen/UnsafeMixed.js +2 -0
- package/lib/module/types/codegen/UnsafeMixed.js.map +1 -0
- package/lib/module/utils/index.js +0 -9
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/MLRNModule.d.ts +1 -7
- package/lib/typescript/commonjs/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Annotation.d.ts +3 -3
- package/lib/typescript/commonjs/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts +1 -2
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +2 -5
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts +3 -2
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts +180 -0
- package/lib/typescript/commonjs/src/components/camera/Camera.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts +37 -0
- package/lib/typescript/commonjs/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts +27 -0
- package/lib/typescript/commonjs/src/components/camera/NativeCameraModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts +323 -0
- package/lib/typescript/commonjs/src/components/map-view/MapView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
- package/lib/typescript/commonjs/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts +45 -0
- package/lib/typescript/commonjs/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +41 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/Bounds.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/Bounds.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts +16 -0
- package/lib/typescript/commonjs/src/types/PressEvent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/ViewPadding.d.ts +7 -0
- package/lib/typescript/commonjs/src/types/ViewPadding.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts +10 -0
- package/lib/typescript/commonjs/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts +1 -3
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/MLRNModule.d.ts +1 -7
- package/lib/typescript/module/src/MLRNModule.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Annotation.d.ts +3 -3
- package/lib/typescript/module/src/components/Annotation.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Images.d.ts +1 -2
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +2 -5
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts +3 -2
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/camera/Camera.d.ts +180 -0
- package/lib/typescript/module/src/components/camera/Camera.d.ts.map +1 -0
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts +37 -0
- package/lib/typescript/module/src/components/camera/CameraNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts +27 -0
- package/lib/typescript/module/src/components/camera/NativeCameraModule.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/MapView.d.ts +323 -0
- package/lib/typescript/module/src/components/map-view/MapView.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts +69 -0
- package/lib/typescript/module/src/components/map-view/MapViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts +45 -0
- package/lib/typescript/module/src/components/map-view/NativeMapViewModule.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +41 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts +2 -1
- package/lib/typescript/module/src/modules/snapshot/NativeSnapshotModule.d.ts.map +1 -1
- package/lib/typescript/module/src/types/Bounds.d.ts +2 -0
- package/lib/typescript/module/src/types/Bounds.d.ts.map +1 -0
- package/lib/typescript/module/src/types/PressEvent.d.ts +16 -0
- package/lib/typescript/module/src/types/PressEvent.d.ts.map +1 -0
- package/lib/typescript/module/src/types/ViewPadding.d.ts +7 -0
- package/lib/typescript/module/src/types/ViewPadding.d.ts.map +1 -0
- package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts +10 -0
- package/lib/typescript/module/src/types/codegen/UnsafeMixed.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/index.d.ts +1 -3
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/package.json +38 -28
- package/src/MLRNModule.ts +0 -10
- package/src/components/Annotation.tsx +8 -23
- package/src/components/Images.tsx +2 -4
- package/src/components/ShapeSource.tsx +18 -31
- package/src/components/VectorSource.tsx +5 -28
- package/src/components/camera/Camera.tsx +311 -0
- package/src/components/camera/CameraNativeComponent.ts +61 -0
- package/src/components/camera/NativeCameraModule.ts +39 -0
- package/src/components/map-view/MapView.tsx +582 -0
- package/src/components/map-view/MapViewNativeComponent.ts +96 -0
- package/src/components/map-view/NativeMapViewModule.ts +83 -0
- package/src/index.ts +86 -1
- package/src/modules/snapshot/NativeSnapshotModule.ts +1 -2
- package/src/modules/snapshot/SnapshotManager.ts +1 -1
- package/src/types/Bounds.ts +1 -0
- package/src/types/PressEvent.ts +19 -0
- package/src/types/ViewPadding.ts +6 -0
- package/src/types/codegen/UnsafeMixed.ts +9 -0
- package/src/utils/index.ts +1 -14
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEvent.java +0 -35
- package/android/src/main/java/org/maplibre/reactnative/components/AbstractEventEmitter.java +0 -80
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraStop.java +0 -245
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateItem.java +0 -121
- package/android/src/main/java/org/maplibre/reactnative/components/camera/CameraUpdateQueue.java +0 -68
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCamera.java +0 -519
- package/android/src/main/java/org/maplibre/reactnative/components/camera/MLRNCameraManager.java +0 -101
- package/android/src/main/java/org/maplibre/reactnative/components/camera/constants/CameraMode.java +0 -18
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/LayerSourceInfo.java +0 -59
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapView.java +0 -13
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNAndroidTextureMapViewManager.java +0 -27
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapView.java +0 -1521
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/MLRNMapViewManager.java +0 -342
- package/android/src/main/java/org/maplibre/reactnative/components/mapview/helpers/CameraChangeTracker.java +0 -37
- package/android/src/main/java/org/maplibre/reactnative/events/MapChangeEvent.java +0 -43
- package/android/src/main/java/org/maplibre/reactnative/events/MapUserTrackingModeEvent.java +0 -32
- package/android/src/main/java/org/maplibre/reactnative/location/UserLocationVerticalAlignment.java +0 -7
- package/android/src/main/java/org/maplibre/reactnative/location/UserTrackingMode.java +0 -59
- package/android/src/main/java/org/maplibre/reactnative/utils/GeoJSONUtils.java +0 -310
- package/ios/CameraMode.h +0 -10
- package/ios/CameraMode.m +0 -10
- package/ios/CameraStop.m +0 -73
- package/ios/MLRNCamera.h +0 -29
- package/ios/MLRNCamera.m +0 -236
- package/ios/MLRNCameraManager.h +0 -5
- package/ios/MLRNCameraManager.m +0 -39
- package/ios/MLRNMapView.m +0 -497
- package/ios/MLRNMapViewManager.h +0 -9
- package/ios/MLRNMapViewManager.m +0 -604
- package/lib/commonjs/MapLibreRN.js +0 -266
- package/lib/commonjs/MapLibreRN.js.map +0 -1
- package/lib/commonjs/components/Camera.js +0 -333
- package/lib/commonjs/components/Camera.js.map +0 -1
- package/lib/commonjs/components/MapView.js +0 -449
- package/lib/commonjs/components/MapView.js.map +0 -1
- package/lib/commonjs/hooks/useNativeRef.js +0 -14
- package/lib/commonjs/hooks/useNativeRef.js.map +0 -1
- package/lib/commonjs/types/CameraMode.js +0 -14
- package/lib/commonjs/types/CameraMode.js.map +0 -1
- package/lib/commonjs/types/MapLibreRNEvent.js +0 -6
- package/lib/commonjs/types/OnPressEvent.js +0 -2
- package/lib/module/MapLibreRN.js +0 -33
- package/lib/module/MapLibreRN.js.map +0 -1
- package/lib/module/components/Camera.js +0 -328
- package/lib/module/components/Camera.js.map +0 -1
- package/lib/module/components/MapView.js +0 -444
- package/lib/module/components/MapView.js.map +0 -1
- package/lib/module/hooks/useNativeRef.js +0 -10
- package/lib/module/hooks/useNativeRef.js.map +0 -1
- package/lib/module/types/CameraMode.js +0 -10
- package/lib/module/types/CameraMode.js.map +0 -1
- package/lib/module/types/MapLibreRNEvent.js +0 -4
- package/lib/module/types/OnPressEvent.js +0 -2
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +0 -41
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +0 -134
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +0 -223
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts +0 -8
- package/lib/typescript/commonjs/src/hooks/useNativeRef.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/CameraMode.d.ts +0 -7
- package/lib/typescript/commonjs/src/types/CameraMode.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts +0 -6
- package/lib/typescript/commonjs/src/types/MapLibreRNEvent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts +0 -12
- package/lib/typescript/commonjs/src/types/OnPressEvent.d.ts.map +0 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +0 -41
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +0 -1
- package/lib/typescript/module/src/components/Camera.d.ts +0 -134
- package/lib/typescript/module/src/components/Camera.d.ts.map +0 -1
- package/lib/typescript/module/src/components/MapView.d.ts +0 -223
- package/lib/typescript/module/src/components/MapView.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts +0 -8
- package/lib/typescript/module/src/hooks/useNativeRef.d.ts.map +0 -1
- package/lib/typescript/module/src/types/CameraMode.d.ts +0 -7
- package/lib/typescript/module/src/types/CameraMode.d.ts.map +0 -1
- package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts +0 -6
- package/lib/typescript/module/src/types/MapLibreRNEvent.d.ts.map +0 -1
- package/lib/typescript/module/src/types/OnPressEvent.d.ts +0 -12
- package/lib/typescript/module/src/types/OnPressEvent.d.ts.map +0 -1
- package/src/MapLibreRN.ts +0 -75
- package/src/components/Camera.tsx +0 -568
- package/src/components/MapView.tsx +0 -838
- package/src/hooks/useNativeRef.ts +0 -14
- package/src/types/CameraMode.ts +0 -6
- package/src/types/MapLibreRNEvent.ts +0 -7
- package/src/types/OnPressEvent.ts +0 -11
- /package/ios/{CameraUpdateItem.h → components/camera/CameraUpdateItem.h} +0 -0
- /package/ios/{CameraUpdateQueue.h → components/camera/CameraUpdateQueue.h} +0 -0
- /package/ios/{CameraUpdateQueue.m → components/camera/CameraUpdateQueue.m} +0 -0
- /package/ios/{MLRNSnapshotModule → modules/snapshot}/MLRNSnapshotModule.h +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#import <React/RCTUIManager.h>
|
|
5
|
+
#import <React/RCTViewComponentView.h>
|
|
6
|
+
|
|
7
|
+
#ifndef MLRNMapViewComponentView_h
|
|
8
|
+
#define MLRNMapViewComponentView_h
|
|
9
|
+
|
|
10
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
11
|
+
|
|
12
|
+
@interface MLRNMapViewComponentView : RCTViewComponentView
|
|
13
|
+
|
|
14
|
+
@end
|
|
15
|
+
|
|
16
|
+
NS_ASSUME_NONNULL_END
|
|
17
|
+
|
|
18
|
+
#endif
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
#import "MLRNMapViewComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/MapLibreReactNativeSpec/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/MapLibreReactNativeSpec/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/MapLibreReactNativeSpec/Props.h>
|
|
6
|
+
#import <react/renderer/components/MapLibreReactNativeSpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
9
|
+
|
|
10
|
+
#import <React/RCTConversions.h>
|
|
11
|
+
#import "MLRNMapView.h"
|
|
12
|
+
|
|
13
|
+
using namespace facebook::react;
|
|
14
|
+
|
|
15
|
+
struct PressEvent {
|
|
16
|
+
double longitude;
|
|
17
|
+
double latitude;
|
|
18
|
+
double locationX;
|
|
19
|
+
double locationY;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
PressEvent createPressEvent(NSDictionary *dict) {
|
|
23
|
+
PressEvent result;
|
|
24
|
+
|
|
25
|
+
result.longitude = [dict[@"properties"][@"longitude"] doubleValue];
|
|
26
|
+
result.latitude = [dict[@"properties"][@"latitude"] doubleValue];
|
|
27
|
+
result.locationX = [dict[@"properties"][@"locationX"] doubleValue];
|
|
28
|
+
result.locationY = [dict[@"properties"][@"locationY"] doubleValue];
|
|
29
|
+
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
struct ViewState {
|
|
34
|
+
double longitude;
|
|
35
|
+
double latitude;
|
|
36
|
+
double zoom;
|
|
37
|
+
double bearing;
|
|
38
|
+
double pitch;
|
|
39
|
+
folly::dynamic bounds;
|
|
40
|
+
bool animated;
|
|
41
|
+
bool userInteraction;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
ViewState createViewState(NSDictionary *dict) {
|
|
45
|
+
ViewState result;
|
|
46
|
+
|
|
47
|
+
result.longitude = [dict[@"longitude"] doubleValue];
|
|
48
|
+
result.latitude = [dict[@"latitude"] doubleValue];
|
|
49
|
+
result.zoom = [dict[@"zoom"] doubleValue];
|
|
50
|
+
result.bearing = [dict[@"bearing"] doubleValue];
|
|
51
|
+
result.pitch = [dict[@"pitch"] doubleValue];
|
|
52
|
+
|
|
53
|
+
NSArray *boundsArray = dict[@"bounds"];
|
|
54
|
+
folly::dynamic bounds = folly::dynamic::array;
|
|
55
|
+
for (NSNumber *coordinate in boundsArray) {
|
|
56
|
+
bounds.push_back([coordinate doubleValue]);
|
|
57
|
+
}
|
|
58
|
+
result.bounds = bounds;
|
|
59
|
+
|
|
60
|
+
result.animated = [dict[@"animated"] boolValue];
|
|
61
|
+
result.userInteraction = [dict[@"userInteraction"] boolValue];
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// MARK: - MLRNMapViewComponentView
|
|
67
|
+
|
|
68
|
+
@interface MLRNMapViewComponentView () <RCTMLRNMapViewViewProtocol>
|
|
69
|
+
|
|
70
|
+
@end
|
|
71
|
+
|
|
72
|
+
@implementation MLRNMapViewComponentView {
|
|
73
|
+
MLRNMapView *_view;
|
|
74
|
+
CGRect _frame;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
+ (BOOL)shouldBeRecycled {
|
|
78
|
+
return NO;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
82
|
+
if (self = [super initWithFrame:frame]) {
|
|
83
|
+
static const auto defaultProps = std::make_shared<const MLRNMapViewProps>();
|
|
84
|
+
_props = defaultProps;
|
|
85
|
+
_frame = frame;
|
|
86
|
+
[self prepareView];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return self;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
- (void)prepareView {
|
|
93
|
+
_view = [[MLRNMapView alloc] initWithFrame:_frame];
|
|
94
|
+
|
|
95
|
+
// Capture weak self reference to prevent retain cycle
|
|
96
|
+
__weak __typeof__(self) weakSelf = self;
|
|
97
|
+
|
|
98
|
+
[_view setReactOnPress:^(NSDictionary *event) {
|
|
99
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
100
|
+
|
|
101
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
102
|
+
PressEvent pressEvent = createPressEvent(event);
|
|
103
|
+
|
|
104
|
+
facebook::react::MLRNMapViewEventEmitter::OnPress eventStruct{
|
|
105
|
+
pressEvent.longitude, pressEvent.latitude, pressEvent.locationX, pressEvent.locationY};
|
|
106
|
+
|
|
107
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
108
|
+
strongSelf->_eventEmitter)
|
|
109
|
+
->onPress(eventStruct);
|
|
110
|
+
}
|
|
111
|
+
}];
|
|
112
|
+
|
|
113
|
+
[_view setReactOnLongPress:^(NSDictionary *event) {
|
|
114
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
115
|
+
|
|
116
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
117
|
+
PressEvent pressEvent = createPressEvent(event);
|
|
118
|
+
|
|
119
|
+
facebook::react::MLRNMapViewEventEmitter::OnLongPress eventStruct{
|
|
120
|
+
pressEvent.longitude, pressEvent.latitude, pressEvent.locationX, pressEvent.locationY};
|
|
121
|
+
|
|
122
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
123
|
+
strongSelf->_eventEmitter)
|
|
124
|
+
->onLongPress(eventStruct);
|
|
125
|
+
}
|
|
126
|
+
}];
|
|
127
|
+
|
|
128
|
+
[_view setReactOnRegionWillChange:^(NSDictionary *event) {
|
|
129
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
130
|
+
|
|
131
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
132
|
+
ViewState viewState = createViewState(event);
|
|
133
|
+
|
|
134
|
+
facebook::react::MLRNMapViewEventEmitter::OnRegionWillChange eventStruct{
|
|
135
|
+
viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
|
|
136
|
+
viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
|
|
137
|
+
|
|
138
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
139
|
+
strongSelf->_eventEmitter)
|
|
140
|
+
->onRegionWillChange(eventStruct);
|
|
141
|
+
}
|
|
142
|
+
}];
|
|
143
|
+
[_view setReactOnRegionIsChanging:^(NSDictionary *event) {
|
|
144
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
145
|
+
|
|
146
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
147
|
+
ViewState viewState = createViewState(event);
|
|
148
|
+
|
|
149
|
+
facebook::react::MLRNMapViewEventEmitter::OnRegionIsChanging eventStruct{
|
|
150
|
+
viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
|
|
151
|
+
viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
|
|
152
|
+
|
|
153
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
154
|
+
strongSelf->_eventEmitter)
|
|
155
|
+
->onRegionIsChanging(eventStruct);
|
|
156
|
+
}
|
|
157
|
+
}];
|
|
158
|
+
[_view setReactOnRegionDidChange:^(NSDictionary *event) {
|
|
159
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
160
|
+
|
|
161
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
162
|
+
ViewState viewState = createViewState(event);
|
|
163
|
+
|
|
164
|
+
facebook::react::MLRNMapViewEventEmitter::OnRegionDidChange eventStruct{
|
|
165
|
+
viewState.longitude, viewState.latitude, viewState.zoom, viewState.bearing,
|
|
166
|
+
viewState.pitch, viewState.bounds, viewState.animated, viewState.userInteraction};
|
|
167
|
+
|
|
168
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
169
|
+
strongSelf->_eventEmitter)
|
|
170
|
+
->onRegionDidChange(eventStruct);
|
|
171
|
+
}
|
|
172
|
+
}];
|
|
173
|
+
|
|
174
|
+
[_view setReactOnWillStartLoadingMap:^(NSDictionary *event) {
|
|
175
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
176
|
+
|
|
177
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
178
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
179
|
+
strongSelf->_eventEmitter)
|
|
180
|
+
->onWillStartLoadingMap({});
|
|
181
|
+
}
|
|
182
|
+
}];
|
|
183
|
+
[_view setReactOnDidFinishLoadingMap:^(NSDictionary *event) {
|
|
184
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
185
|
+
|
|
186
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
187
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
188
|
+
strongSelf->_eventEmitter)
|
|
189
|
+
->onDidFinishLoadingMap({});
|
|
190
|
+
}
|
|
191
|
+
}];
|
|
192
|
+
[_view setReactOnDidFailLoadingMap:^(NSDictionary *event) {
|
|
193
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
194
|
+
|
|
195
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
196
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
197
|
+
strongSelf->_eventEmitter)
|
|
198
|
+
->onDidFailLoadingMap({});
|
|
199
|
+
}
|
|
200
|
+
}];
|
|
201
|
+
|
|
202
|
+
[_view setReactOnWillStartRenderingFrame:^(NSDictionary *event) {
|
|
203
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
204
|
+
|
|
205
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
206
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
207
|
+
strongSelf->_eventEmitter)
|
|
208
|
+
->onWillStartRenderingFrame({});
|
|
209
|
+
}
|
|
210
|
+
}];
|
|
211
|
+
[_view setReactOnDidFinishRenderingFrame:^(NSDictionary *event) {
|
|
212
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
213
|
+
|
|
214
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
215
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
216
|
+
strongSelf->_eventEmitter)
|
|
217
|
+
->onDidFinishRenderingFrame({});
|
|
218
|
+
}
|
|
219
|
+
}];
|
|
220
|
+
[_view setReactOnDidFinishRenderingFrameFully:^(NSDictionary *event) {
|
|
221
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
222
|
+
|
|
223
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
224
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
225
|
+
strongSelf->_eventEmitter)
|
|
226
|
+
->onDidFinishRenderingFrameFully({});
|
|
227
|
+
}
|
|
228
|
+
}];
|
|
229
|
+
|
|
230
|
+
[_view setReactOnWillStartRenderingMap:^(NSDictionary *event) {
|
|
231
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
232
|
+
|
|
233
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
234
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
235
|
+
strongSelf->_eventEmitter)
|
|
236
|
+
->onWillStartRenderingMap({});
|
|
237
|
+
}
|
|
238
|
+
}];
|
|
239
|
+
[_view setReactOnDidFinishRenderingMap:^(NSDictionary *event) {
|
|
240
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
241
|
+
|
|
242
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
243
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
244
|
+
strongSelf->_eventEmitter)
|
|
245
|
+
->onDidFinishRenderingMap({});
|
|
246
|
+
}
|
|
247
|
+
}];
|
|
248
|
+
[_view setReactOnDidFinishRenderingMapFully:^(NSDictionary *event) {
|
|
249
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
250
|
+
|
|
251
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
252
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
253
|
+
strongSelf->_eventEmitter)
|
|
254
|
+
->onDidFinishRenderingMapFully({});
|
|
255
|
+
}
|
|
256
|
+
}];
|
|
257
|
+
|
|
258
|
+
[_view setReactOnDidFinishLoadingStyle:^(NSDictionary *event) {
|
|
259
|
+
__typeof__(self) strongSelf = weakSelf;
|
|
260
|
+
|
|
261
|
+
if (strongSelf != nullptr && strongSelf->_eventEmitter != nullptr) {
|
|
262
|
+
std::dynamic_pointer_cast<const facebook::react::MLRNMapViewEventEmitter>(
|
|
263
|
+
strongSelf->_eventEmitter)
|
|
264
|
+
->onDidFinishLoadingStyle({});
|
|
265
|
+
}
|
|
266
|
+
}];
|
|
267
|
+
|
|
268
|
+
self.contentView = _view;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
- (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
272
|
+
index:(NSInteger)index {
|
|
273
|
+
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] &&
|
|
274
|
+
((RCTViewComponentView *)childComponentView).contentView) {
|
|
275
|
+
[_view addToMap:((RCTViewComponentView *)childComponentView).contentView];
|
|
276
|
+
}
|
|
277
|
+
[super mountChildComponentView:childComponentView index:index + 1];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView
|
|
281
|
+
index:(NSInteger)index {
|
|
282
|
+
if ([childComponentView isKindOfClass:[RCTViewComponentView class]] &&
|
|
283
|
+
((RCTViewComponentView *)childComponentView).contentView) {
|
|
284
|
+
[_view removeFromMap:((RCTViewComponentView *)childComponentView).contentView];
|
|
285
|
+
}
|
|
286
|
+
[super unmountChildComponentView:childComponentView index:index + 1];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
#pragma mark - RCTComponentViewProtocol
|
|
290
|
+
|
|
291
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps {
|
|
292
|
+
const auto &oldViewProps = *std::static_pointer_cast<MLRNMapViewProps const>(_props);
|
|
293
|
+
const auto &newViewProps = *std::static_pointer_cast<MLRNMapViewProps const>(props);
|
|
294
|
+
|
|
295
|
+
if (oldViewProps.mapStyle != newViewProps.mapStyle) {
|
|
296
|
+
NSString *mapStyle = [NSString stringWithCString:newViewProps.mapStyle.c_str()
|
|
297
|
+
encoding:NSUTF8StringEncoding];
|
|
298
|
+
[_view setReactMapStyle:mapStyle];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (oldViewProps.contentInset.top != newViewProps.contentInset.top ||
|
|
302
|
+
oldViewProps.contentInset.right != newViewProps.contentInset.right ||
|
|
303
|
+
oldViewProps.contentInset.bottom != newViewProps.contentInset.bottom ||
|
|
304
|
+
oldViewProps.contentInset.left != newViewProps.contentInset.left) {
|
|
305
|
+
NSDictionary *contentInset = @{
|
|
306
|
+
@"top" : @(newViewProps.contentInset.top),
|
|
307
|
+
@"right" : @(newViewProps.contentInset.right),
|
|
308
|
+
@"bottom" : @(newViewProps.contentInset.bottom),
|
|
309
|
+
@"left" : @(newViewProps.contentInset.left)
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
[_view setReactContentInset:contentInset];
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (oldViewProps.preferredFramesPerSecond != newViewProps.preferredFramesPerSecond) {
|
|
316
|
+
[_view setReactPreferredFramesPerSecond:newViewProps.preferredFramesPerSecond];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (oldViewProps.dragPan != newViewProps.dragPan) {
|
|
320
|
+
[_view setReactScrollEnabled:newViewProps.dragPan];
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (oldViewProps.touchAndDoubleTapZoom != newViewProps.touchAndDoubleTapZoom) {
|
|
324
|
+
[_view setReactZoomEnabled:newViewProps.touchAndDoubleTapZoom];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (oldViewProps.touchRotate != newViewProps.touchRotate) {
|
|
328
|
+
[_view setReactRotateEnabled:newViewProps.touchRotate];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (oldViewProps.touchPitch != newViewProps.touchPitch) {
|
|
332
|
+
[_view setPitchEnabled:newViewProps.touchPitch];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (oldViewProps.tintColor != newViewProps.tintColor) {
|
|
336
|
+
[_view setTintColor:RCTUIColorFromSharedColor(newViewProps.tintColor)];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (oldViewProps.attribution != newViewProps.attribution) {
|
|
340
|
+
[_view setReactAttributionEnabled:newViewProps.attribution];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (oldViewProps.attributionPosition.top != newViewProps.attributionPosition.top ||
|
|
344
|
+
oldViewProps.attributionPosition.right != newViewProps.attributionPosition.right ||
|
|
345
|
+
oldViewProps.attributionPosition.bottom != newViewProps.attributionPosition.bottom ||
|
|
346
|
+
oldViewProps.attributionPosition.left != newViewProps.attributionPosition.left) {
|
|
347
|
+
NSDictionary *attributionPosition = @{
|
|
348
|
+
@"top" : @(newViewProps.attributionPosition.top),
|
|
349
|
+
@"right" : @(newViewProps.attributionPosition.right),
|
|
350
|
+
@"bottom" : @(newViewProps.attributionPosition.bottom),
|
|
351
|
+
@"left" : @(newViewProps.attributionPosition.left)
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
[_view setReactAttributionPosition:attributionPosition];
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (oldViewProps.logo != newViewProps.logo) {
|
|
358
|
+
[_view setReactLogoEnabled:newViewProps.logo];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (oldViewProps.logoPosition.top != newViewProps.logoPosition.top ||
|
|
362
|
+
oldViewProps.logoPosition.right != newViewProps.logoPosition.right ||
|
|
363
|
+
oldViewProps.logoPosition.bottom != newViewProps.logoPosition.bottom ||
|
|
364
|
+
oldViewProps.logoPosition.left != newViewProps.logoPosition.left) {
|
|
365
|
+
NSDictionary *logoPosition = @{
|
|
366
|
+
@"top" : @(newViewProps.logoPosition.top),
|
|
367
|
+
@"right" : @(newViewProps.logoPosition.right),
|
|
368
|
+
@"bottom" : @(newViewProps.logoPosition.bottom),
|
|
369
|
+
@"left" : @(newViewProps.logoPosition.left)
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
[_view setReactLogoPosition:logoPosition];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (oldViewProps.compass != newViewProps.compass) {
|
|
376
|
+
[_view setReactCompassEnabled:newViewProps.compass];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (oldViewProps.compassPosition.top != newViewProps.compassPosition.top ||
|
|
380
|
+
oldViewProps.compassPosition.right != newViewProps.compassPosition.right ||
|
|
381
|
+
oldViewProps.compassPosition.bottom != newViewProps.compassPosition.bottom ||
|
|
382
|
+
oldViewProps.compassPosition.left != newViewProps.compassPosition.left) {
|
|
383
|
+
NSDictionary *compassPosition = @{
|
|
384
|
+
@"top" : @(newViewProps.compassPosition.top),
|
|
385
|
+
@"right" : @(newViewProps.compassPosition.right),
|
|
386
|
+
@"bottom" : @(newViewProps.compassPosition.bottom),
|
|
387
|
+
@"left" : @(newViewProps.compassPosition.left)
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
[_view setReactCompassPosition:compassPosition];
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
[super updateProps:props oldProps:oldProps];
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
397
|
+
return concreteComponentDescriptorProvider<MLRNMapViewComponentDescriptor>();
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
@end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#import <MapLibre/MapLibre.h>
|
|
2
|
+
#import "ViewManager.h"
|
|
3
|
+
|
|
4
|
+
@interface MLRNMapViewManager : ViewManager <MLNMapViewDelegate>
|
|
5
|
+
|
|
6
|
+
+ (void)getCenter:(MLRNMapView *_Nonnull)view
|
|
7
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
8
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
9
|
+
|
|
10
|
+
+ (void)getZoom:(MLRNMapView *_Nonnull)view
|
|
11
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
12
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
13
|
+
|
|
14
|
+
+ (void)getBearing:(MLRNMapView *_Nonnull)view
|
|
15
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
16
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
17
|
+
|
|
18
|
+
+ (void)getPitch:(MLRNMapView *_Nonnull)view
|
|
19
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
20
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
21
|
+
|
|
22
|
+
+ (void)getBounds:(MLRNMapView *_Nonnull)view
|
|
23
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
24
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
25
|
+
|
|
26
|
+
+ (void)getViewState:(MLRNMapView *_Nonnull)view
|
|
27
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
28
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
29
|
+
|
|
30
|
+
+ (void)project:(MLRNMapView *_Nonnull)view
|
|
31
|
+
coordinate:(CLLocationCoordinate2D)coordinate
|
|
32
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
33
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
34
|
+
|
|
35
|
+
+ (void)unproject:(MLRNMapView *_Nonnull)view
|
|
36
|
+
point:(CGPoint)point
|
|
37
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
38
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
39
|
+
|
|
40
|
+
+ (void)takeSnap:(MLRNMapView *_Nonnull)view
|
|
41
|
+
writeToDisk:(BOOL)writeToDisk
|
|
42
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
43
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
44
|
+
|
|
45
|
+
+ (void)queryRenderedFeaturesWithCoordinate:(MLRNMapView *_Nonnull)view
|
|
46
|
+
coordinate:(CLLocationCoordinate2D)coordinate
|
|
47
|
+
layerIds:(NSSet *_Nonnull)layerIds
|
|
48
|
+
predicate:(NSPredicate *_Nonnull)predicate
|
|
49
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
50
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
51
|
+
|
|
52
|
+
+ (void)queryRenderedFeaturesWithBounds:(MLRNMapView *_Nonnull)view
|
|
53
|
+
bounds:(MLNCoordinateBounds)bounds
|
|
54
|
+
layerIds:(NSSet *_Nonnull)layerIds
|
|
55
|
+
predicate:(NSPredicate *_Nonnull)predicate
|
|
56
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
57
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
58
|
+
|
|
59
|
+
+ (void)showAttribution:(MLRNMapView *_Nonnull)view
|
|
60
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
61
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
62
|
+
|
|
63
|
+
+ (void)setSourceVisibility:(MLRNMapView *_Nonnull)view
|
|
64
|
+
visible:(BOOL)visible
|
|
65
|
+
sourceId:(nonnull NSString *)sourceId
|
|
66
|
+
sourceLayerId:(nullable NSString *)sourceLayerId
|
|
67
|
+
resolve:(RCTPromiseResolveBlock _Nonnull)resolve
|
|
68
|
+
reject:(RCTPromiseRejectBlock _Nonnull)reject;
|
|
69
|
+
|
|
70
|
+
@end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#import <React/RCTUIManager.h>
|
|
2
|
+
|
|
3
|
+
#import "CameraStop.h"
|
|
4
|
+
#import "CameraUpdateQueue.h"
|
|
5
|
+
#import "FilterParser.h"
|
|
6
|
+
#import "MLRNEvent.h"
|
|
7
|
+
#import "MLRNEventTypes.h"
|
|
8
|
+
#import "MLRNImages.h"
|
|
9
|
+
#import "MLRNMapTouchEvent.h"
|
|
10
|
+
#import "MLRNMapView.h"
|
|
11
|
+
#import "MLRNMapViewManager.h"
|
|
12
|
+
#import "MLRNShapeSource.h"
|
|
13
|
+
#import "MLRNUserLocation.h"
|
|
14
|
+
#import "MLRNUtils.h"
|
|
15
|
+
|
|
16
|
+
@implementation MLRNMapViewManager
|
|
17
|
+
|
|
18
|
+
// MARK: - React View Methods
|
|
19
|
+
|
|
20
|
+
+ (void)getCenter:(MLRNMapView *)view
|
|
21
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
22
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
23
|
+
resolve(@{
|
|
24
|
+
@"longitude" : @(view.centerCoordinate.longitude),
|
|
25
|
+
@"latitude" : @(view.centerCoordinate.latitude)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
+ (void)getZoom:(MLRNMapView *)view
|
|
30
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
31
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
32
|
+
resolve(@(view.zoomLevel));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
+ (void)getBearing:(MLRNMapView *)view
|
|
36
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
37
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
38
|
+
resolve(@(view.camera.heading));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
+ (void)getPitch:(MLRNMapView *)view
|
|
42
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
43
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
44
|
+
resolve(@(view.camera.pitch));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
+ (void)getBounds:(MLRNMapView *)view
|
|
48
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
49
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
50
|
+
resolve([MLRNUtils fromCoordinateBounds:view.visibleCoordinateBounds]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
+ (void)getViewState:(MLRNMapView *)view
|
|
54
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
55
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
56
|
+
NSDictionary *center = @{
|
|
57
|
+
@"longitude" : @(view.centerCoordinate.longitude),
|
|
58
|
+
@"latitude" : @(view.centerCoordinate.latitude)
|
|
59
|
+
};
|
|
60
|
+
NSNumber *zoom = @(view.zoomLevel);
|
|
61
|
+
NSNumber *bearing = @(view.camera.heading);
|
|
62
|
+
NSNumber *pitch = @(view.camera.pitch);
|
|
63
|
+
NSArray *bounds = [MLRNUtils fromCoordinateBounds:view.visibleCoordinateBounds];
|
|
64
|
+
|
|
65
|
+
NSMutableDictionary *payload = [center mutableCopy];
|
|
66
|
+
payload[@"zoom"] = zoom;
|
|
67
|
+
payload[@"bearing"] = bearing;
|
|
68
|
+
payload[@"pitch"] = pitch;
|
|
69
|
+
payload[@"bounds"] = bounds;
|
|
70
|
+
|
|
71
|
+
resolve(payload);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
+ (CGPoint)project:(MLRNMapView *)view coordinate:(CLLocationCoordinate2D)coordinate {
|
|
75
|
+
CGPoint pointInView = [view convertCoordinate:coordinate toPointToView:view];
|
|
76
|
+
|
|
77
|
+
return pointInView;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
+ (void)project:(MLRNMapView *)view
|
|
81
|
+
coordinate:(CLLocationCoordinate2D)coordinate
|
|
82
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
83
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
84
|
+
CGPoint point = [self project:view coordinate:coordinate];
|
|
85
|
+
|
|
86
|
+
resolve(@[ @(point.x), @(point.y) ]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
+ (void)unproject:(MLRNMapView *)view
|
|
90
|
+
point:(CGPoint)point
|
|
91
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
92
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
93
|
+
CLLocationCoordinate2D coordinate = [view convertPoint:point toCoordinateFromView:view];
|
|
94
|
+
|
|
95
|
+
resolve(@[ @(coordinate.longitude), @(coordinate.latitude) ]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
+ (void)takeSnap:(MLRNMapView *)view
|
|
99
|
+
writeToDisk:(BOOL)writeToDisk
|
|
100
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
101
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
102
|
+
NSString *uri = [view takeSnap:writeToDisk];
|
|
103
|
+
resolve(uri);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
+ (void)queryRenderedFeaturesWithCoordinate:(MLRNMapView *)view
|
|
107
|
+
coordinate:(CLLocationCoordinate2D)coordinate
|
|
108
|
+
layerIds:(NSSet *)layerIds
|
|
109
|
+
predicate:(NSPredicate *)predicate
|
|
110
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
111
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
112
|
+
CGPoint point = [self project:view coordinate:coordinate];
|
|
113
|
+
|
|
114
|
+
NSArray<id<MLNFeature>> *shapes = [view visibleFeaturesAtPoint:point
|
|
115
|
+
inStyleLayersWithIdentifiers:layerIds
|
|
116
|
+
predicate:predicate];
|
|
117
|
+
|
|
118
|
+
NSMutableArray<NSDictionary *> *features = [[NSMutableArray alloc] init];
|
|
119
|
+
for (int i = 0; i < shapes.count; i++) {
|
|
120
|
+
[features addObject:shapes[i].geoJSONDictionary];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
resolve(@{@"type" : @"FeatureCollection", @"features" : features});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
+ (void)queryRenderedFeaturesWithBounds:(MLRNMapView *)view
|
|
127
|
+
bounds:(MLNCoordinateBounds)bounds
|
|
128
|
+
layerIds:(NSSet *)layerIds
|
|
129
|
+
predicate:(NSPredicate *)predicate
|
|
130
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
131
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
132
|
+
CGPoint swPoint = [self project:view coordinate:bounds.sw];
|
|
133
|
+
CGPoint nePoint = [self project:view coordinate:bounds.ne];
|
|
134
|
+
|
|
135
|
+
CGRect bbox = CGRectMake(swPoint.x, swPoint.y, nePoint.x - swPoint.x, nePoint.y - swPoint.y);
|
|
136
|
+
|
|
137
|
+
NSArray<id<MLNFeature>> *shapes = [view visibleFeaturesInRect:bbox
|
|
138
|
+
inStyleLayersWithIdentifiers:layerIds
|
|
139
|
+
predicate:predicate];
|
|
140
|
+
|
|
141
|
+
NSArray<NSDictionary *> *features = [MLRNUtils featuresToJSON:shapes];
|
|
142
|
+
|
|
143
|
+
resolve(@{@"type" : @"FeatureCollection", @"features" : features});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
+ (void)showAttribution:(MLRNMapView *)view
|
|
147
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
148
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
149
|
+
[view showAttribution:view];
|
|
150
|
+
resolve(nil);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
+ (void)setSourceVisibility:(MLRNMapView *)view
|
|
154
|
+
visible:(BOOL)visible
|
|
155
|
+
sourceId:(nonnull NSString *)sourceId
|
|
156
|
+
sourceLayerId:(nullable NSString *)sourceLayerId
|
|
157
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
158
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
159
|
+
[view setSourceVisibility:visible sourceId:sourceId sourceLayerId:sourceLayerId];
|
|
160
|
+
resolve(nil);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@end
|