@maplibre/maplibre-react-native 9.0.1 → 10.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -2
- package/.husky/pre-commit +5 -0
- package/.yarn/plugins/@yarnpkg/plugin-typescript.cjs +9 -0
- package/.yarn/sdks/eslint/bin/eslint.js +20 -0
- package/.yarn/sdks/eslint/lib/api.js +20 -0
- package/.yarn/sdks/eslint/package.json +6 -0
- package/.yarn/sdks/integrations.yml +5 -0
- package/.yarn/sdks/prettier/index.js +20 -0
- package/.yarn/sdks/prettier/package.json +6 -0
- package/.yarn/sdks/typescript/bin/tsc +20 -0
- package/.yarn/sdks/typescript/bin/tsserver +20 -0
- package/.yarn/sdks/typescript/lib/tsc.js +20 -0
- package/.yarn/sdks/typescript/lib/tsserver.js +225 -0
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +225 -0
- package/.yarn/sdks/typescript/lib/typescript.js +20 -0
- package/.yarn/sdks/typescript/package.json +6 -0
- package/CHANGELOG.md +15 -1
- package/android/build.gradle +2 -2
- package/android/rctmgl/build.gradle +2 -4
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.java +14 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.java +26 -0
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ClusterPropertyEntry.java +13 -0
- package/docs/Annotation.md +8 -9
- package/docs/BackgroundLayer.md +2 -10
- package/docs/Callout.md +5 -5
- package/docs/Camera.md +18 -47
- package/docs/CircleLayer.md +2 -10
- package/docs/FillExtrusionLayer.md +2 -10
- package/docs/FillLayer.md +2 -10
- package/docs/HeatmapLayer.md +2 -10
- package/docs/ImageSource.md +3 -2
- package/docs/Images.md +5 -3
- package/docs/Light.md +1 -1
- package/docs/LineLayer.md +2 -10
- package/docs/MapView.md +53 -37
- package/docs/MarkerView.md +4 -2
- package/docs/NativeUserLocation.md +2 -2
- package/docs/PointAnnotation.md +5 -8
- package/docs/RasterLayer.md +2 -10
- package/docs/RasterSource.md +3 -2
- package/docs/ShapeSource.md +12 -6
- package/docs/Style.md +1 -1
- package/docs/SymbolLayer.md +3 -10
- package/docs/UserLocation.md +8 -10
- package/docs/VectorSource.md +6 -5
- package/docs/coordinates.md +6 -0
- package/docs/docs.json +561 -1308
- package/docs/location.md +6 -0
- package/docs/snapshotManager.md +3 -3
- package/ios/RCTMGL/RCTMGLShapeSource.h +1 -0
- package/ios/RCTMGL/RCTMGLShapeSource.m +14 -0
- package/ios/RCTMGL/RCTMGLShapeSourceManager.m +1 -0
- package/ios/RCTMGL.xcodeproj/project.pbxproj +1 -0
- package/javascript/@types/assets.d.ts +4 -0
- package/javascript/MGLModule.ts +37 -0
- package/javascript/Maplibre.ts +65 -0
- package/javascript/components/AbstractLayer.tsx +107 -0
- package/javascript/components/AbstractSource.tsx +27 -0
- package/javascript/components/BackgroundLayer.tsx +43 -0
- package/javascript/components/{Callout.js → Callout.tsx} +67 -65
- package/javascript/components/{Camera.js → Camera.tsx} +266 -251
- package/javascript/components/CircleLayer.tsx +46 -0
- package/javascript/components/FillExtrusionLayer.tsx +47 -0
- package/javascript/components/FillLayer.tsx +41 -0
- package/javascript/components/{HeadingIndicator.js → HeadingIndicator.tsx} +8 -8
- package/javascript/components/HeatmapLayer.tsx +44 -0
- package/javascript/components/ImageSource.tsx +78 -0
- package/javascript/components/Images.tsx +134 -0
- package/javascript/components/Light.tsx +67 -0
- package/javascript/components/LineLayer.tsx +42 -0
- package/javascript/components/{MapView.js → MapView.tsx} +365 -354
- package/javascript/components/MarkerView.tsx +104 -0
- package/javascript/components/{NativeBridgeComponent.js → NativeBridgeComponent.tsx} +44 -13
- package/javascript/components/NativeUserLocation.tsx +33 -0
- package/javascript/components/PointAnnotation.tsx +221 -0
- package/javascript/components/RasterLayer.tsx +41 -0
- package/javascript/components/RasterSource.tsx +117 -0
- package/javascript/components/ShapeSource.tsx +383 -0
- package/javascript/components/{Style.js → Style.tsx} +132 -38
- package/javascript/components/SymbolLayer.tsx +72 -0
- package/javascript/components/{UserLocation.js → UserLocation.tsx} +111 -110
- package/javascript/components/VectorSource.tsx +207 -0
- package/javascript/components/annotations/Annotation.tsx +134 -0
- package/javascript/index.ts +4 -0
- package/javascript/modules/location/{locationManager.js → locationManager.ts} +71 -10
- package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +20 -4
- package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +23 -7
- package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +81 -24
- package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +43 -6
- package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +5 -5
- package/javascript/requestAndroidLocationPermissions.ts +29 -0
- package/javascript/types/BaseProps.ts +5 -0
- package/javascript/types/OnPressEvent.ts +13 -0
- package/javascript/types/index.ts +7 -0
- package/javascript/utils/BridgeValue.ts +90 -0
- package/javascript/utils/{Logger.js → Logger.ts} +37 -18
- package/javascript/utils/MaplibreStyles.d.ts +1486 -0
- package/javascript/utils/StyleValue.ts +49 -0
- package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +134 -0
- package/javascript/utils/animated/AnimatedCoordinatesArray.ts +112 -0
- package/javascript/utils/animated/{AnimatedExtractCoordinateFromArray.js → AnimatedExtractCoordinateFromArray.ts} +5 -5
- package/javascript/utils/animated/{AnimatedPoint.js → AnimatedPoint.ts} +20 -12
- package/javascript/utils/animated/{AnimatedRouteCoordinatesArray.js → AnimatedRouteCoordinatesArray.ts} +39 -14
- package/javascript/utils/animated/{AnimatedShape.js → AnimatedShape.ts} +31 -10
- package/javascript/utils/{deprecation.js → deprecation.ts} +9 -6
- package/javascript/utils/filterUtils.ts +9 -0
- package/javascript/utils/geoUtils.ts +79 -0
- package/javascript/utils/{index.js → index.ts} +44 -24
- package/javascript/utils/styleMap.ts +264 -0
- package/package.json +43 -34
- package/plugin/build/withMapLibre.js +3 -2
- package/scripts/autogenHelpers/globals.js +1 -1
- package/scripts/autogenerate.js +14 -6
- package/scripts/templates/MaplibreStyles.ts.ejs +99 -0
- package/scripts/templates/index.d.ts.ejs +71 -42
- package/scripts/templates/{styleMap.js.ejs → styleMap.ts.ejs} +3 -33
- package/setup-jest.js +3 -10
- package/tsconfig.json +20 -61
- package/index.d.ts +0 -954
- package/javascript/components/AbstractLayer.js +0 -75
- package/javascript/components/AbstractSource.js +0 -15
- package/javascript/components/BackgroundLayer.js +0 -97
- package/javascript/components/CircleLayer.js +0 -101
- package/javascript/components/FillExtrusionLayer.js +0 -98
- package/javascript/components/FillLayer.js +0 -94
- package/javascript/components/HeatmapLayer.js +0 -99
- package/javascript/components/ImageSource.js +0 -82
- package/javascript/components/Images.js +0 -119
- package/javascript/components/Light.js +0 -47
- package/javascript/components/LineLayer.js +0 -94
- package/javascript/components/MarkerView.js +0 -87
- package/javascript/components/NativeUserLocation.js +0 -41
- package/javascript/components/PointAnnotation.js +0 -216
- package/javascript/components/RasterLayer.js +0 -95
- package/javascript/components/RasterSource.js +0 -124
- package/javascript/components/ShapeSource.js +0 -357
- package/javascript/components/SymbolLayer.js +0 -120
- package/javascript/components/VectorSource.js +0 -200
- package/javascript/components/annotations/Annotation.js +0 -122
- package/javascript/index.js +0 -149
- package/javascript/utils/BridgeValue.js +0 -81
- package/javascript/utils/animated/AnimatedCoordinatesArray.js +0 -191
- package/javascript/utils/filterUtils.js +0 -7
- package/javascript/utils/geoUtils.js +0 -73
- package/javascript/utils/styleMap.js +0 -1932
- /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
featureCollection,
|
|
3
|
+
point,
|
|
4
|
+
feature,
|
|
5
|
+
lineString,
|
|
6
|
+
Id,
|
|
7
|
+
Properties,
|
|
8
|
+
} from '@turf/helpers';
|
|
9
|
+
import distance from '@turf/distance';
|
|
10
|
+
import along from '@turf/along';
|
|
11
|
+
import geoViewport from '@mapbox/geo-viewport';
|
|
12
|
+
|
|
13
|
+
const VECTOR_TILE_SIZE = 512;
|
|
14
|
+
|
|
15
|
+
export const makePoint = point;
|
|
16
|
+
|
|
17
|
+
export const makeLineString = lineString;
|
|
18
|
+
|
|
19
|
+
export function makeLatLngBounds(
|
|
20
|
+
northEastCoordinates: GeoJSON.Position,
|
|
21
|
+
southWestCoordinates: GeoJSON.Position,
|
|
22
|
+
): GeoJSON.FeatureCollection {
|
|
23
|
+
return featureCollection([
|
|
24
|
+
point(northEastCoordinates),
|
|
25
|
+
point(southWestCoordinates),
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const makeFeature = feature;
|
|
30
|
+
|
|
31
|
+
export function makeFeatureCollection(
|
|
32
|
+
features: GeoJSON.Feature[] = [],
|
|
33
|
+
options?: {bbox?: GeoJSON.BBox; id?: Id},
|
|
34
|
+
): GeoJSON.FeatureCollection {
|
|
35
|
+
return featureCollection(features, options);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function addToFeatureCollection<T extends GeoJSON.Geometry>(
|
|
39
|
+
newFeatureCollection: GeoJSON.FeatureCollection<T, Properties>,
|
|
40
|
+
newFeature: GeoJSON.Feature<T, Properties>,
|
|
41
|
+
): GeoJSON.FeatureCollection<T, Properties> {
|
|
42
|
+
return {
|
|
43
|
+
...newFeatureCollection,
|
|
44
|
+
features: [...newFeatureCollection.features, newFeature],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const calculateDistance = distance;
|
|
49
|
+
|
|
50
|
+
export const pointAlongLine = along;
|
|
51
|
+
|
|
52
|
+
export function getOrCalculateVisibleRegion(
|
|
53
|
+
coord: [number, number] | {lon: number; lat: number},
|
|
54
|
+
zoomLevel: number,
|
|
55
|
+
width: number,
|
|
56
|
+
height: number,
|
|
57
|
+
nativeRegion: {properties: {visibleBounds: [number, number][]}},
|
|
58
|
+
): {ne: [number, number]; sw: [number, number]} {
|
|
59
|
+
const region = {
|
|
60
|
+
ne: [0, 0] as [number, number],
|
|
61
|
+
sw: [0, 0] as [number, number],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (!nativeRegion || !Array.isArray(nativeRegion.properties.visibleBounds)) {
|
|
65
|
+
const bounds = geoViewport.bounds(
|
|
66
|
+
coord,
|
|
67
|
+
zoomLevel,
|
|
68
|
+
[width, height],
|
|
69
|
+
VECTOR_TILE_SIZE,
|
|
70
|
+
);
|
|
71
|
+
region.ne = [bounds[3], bounds[2]];
|
|
72
|
+
region.sw = [bounds[1], bounds[0]];
|
|
73
|
+
} else {
|
|
74
|
+
region.ne = nativeRegion.properties.visibleBounds[0];
|
|
75
|
+
region.sw = nativeRegion.properties.visibleBounds[1];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return region;
|
|
79
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React, {Component, ReactElement} from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
NativeModules,
|
|
5
|
+
findNodeHandle,
|
|
6
|
+
Platform,
|
|
7
|
+
ImageSourcePropType,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
function getAndroidManagerInstance(module: string): any {
|
|
7
11
|
const haveViewManagerConfig =
|
|
8
12
|
NativeModules.UIManager && NativeModules.UIManager.getViewManagerConfig;
|
|
9
13
|
return haveViewManagerConfig
|
|
@@ -11,48 +15,61 @@ function getAndroidManagerInstance(module) {
|
|
|
11
15
|
: NativeModules.UIManager[module];
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function getIosManagerInstance(module) {
|
|
18
|
+
function getIosManagerInstance(module: string): any {
|
|
15
19
|
return NativeModules[getIOSModuleName(module)];
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
export function isAndroid() {
|
|
22
|
+
export function isAndroid(): boolean {
|
|
21
23
|
return Platform.OS === 'android';
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
export function existenceChange(cur, next) {
|
|
26
|
+
export function existenceChange(cur: boolean, next: boolean): boolean {
|
|
25
27
|
if (!cur && !next) {
|
|
26
28
|
return false;
|
|
27
29
|
}
|
|
28
30
|
return (!cur && next) || (cur && !next);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
export function isFunction(fn) {
|
|
33
|
+
export function isFunction(fn: unknown): fn is boolean {
|
|
32
34
|
return typeof fn === 'function';
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
export function isNumber(num) {
|
|
37
|
+
export function isNumber(num: unknown): num is number {
|
|
36
38
|
return typeof num === 'number' && !Number.isNaN(num);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
export function isUndefined(obj) {
|
|
41
|
+
export function isUndefined(obj: unknown): obj is undefined {
|
|
40
42
|
return typeof obj === 'undefined';
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
export function isString(str) {
|
|
45
|
+
export function isString(str: unknown): str is string {
|
|
44
46
|
return typeof str === 'string';
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
export function isBoolean(bool) {
|
|
49
|
+
export function isBoolean(bool: unknown): bool is boolean {
|
|
48
50
|
return typeof bool === 'boolean';
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
export function isPrimitive(
|
|
53
|
+
export function isPrimitive(
|
|
54
|
+
value: unknown,
|
|
55
|
+
): value is string | number | boolean {
|
|
52
56
|
return isString(value) || isNumber(value) || isBoolean(value);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
export
|
|
59
|
+
export type NativeArg =
|
|
60
|
+
| string
|
|
61
|
+
| number
|
|
62
|
+
| boolean
|
|
63
|
+
| null
|
|
64
|
+
| {[k: string]: NativeArg}
|
|
65
|
+
| NativeArg[];
|
|
66
|
+
|
|
67
|
+
export function runNativeCommand<ReturnType = NativeArg>(
|
|
68
|
+
module: string,
|
|
69
|
+
name: string,
|
|
70
|
+
nativeRef: Component,
|
|
71
|
+
args: NativeArg[] = [],
|
|
72
|
+
): ReturnType {
|
|
56
73
|
const handle = findNodeHandle(nativeRef);
|
|
57
74
|
if (!handle) {
|
|
58
75
|
throw new Error(`Could not find handle for native ref ${module}.${name}`);
|
|
@@ -77,9 +94,12 @@ export function runNativeCommand(module, name, nativeRef, args = []) {
|
|
|
77
94
|
return managerInstance[name](handle, ...args);
|
|
78
95
|
}
|
|
79
96
|
|
|
80
|
-
export function cloneReactChildrenWithProps(
|
|
97
|
+
export function cloneReactChildrenWithProps(
|
|
98
|
+
children: Parameters<typeof React.Children.map>[0],
|
|
99
|
+
propsToAdd: {[key: string]: string} = {},
|
|
100
|
+
): ReactElement[] | undefined {
|
|
81
101
|
if (!children) {
|
|
82
|
-
return
|
|
102
|
+
return undefined;
|
|
83
103
|
}
|
|
84
104
|
|
|
85
105
|
let foundChildren = null;
|
|
@@ -96,18 +116,18 @@ export function cloneReactChildrenWithProps(children, propsToAdd = {}) {
|
|
|
96
116
|
);
|
|
97
117
|
}
|
|
98
118
|
|
|
99
|
-
export function resolveImagePath(imageRef) {
|
|
100
|
-
const res = resolveAssetSource(imageRef);
|
|
119
|
+
export function resolveImagePath(imageRef: ImageSourcePropType): string {
|
|
120
|
+
const res = Image.resolveAssetSource(imageRef);
|
|
101
121
|
return res.uri;
|
|
102
122
|
}
|
|
103
123
|
|
|
104
|
-
export function getIOSModuleName(moduleName) {
|
|
124
|
+
export function getIOSModuleName(moduleName: string): string {
|
|
105
125
|
if (moduleName.startsWith('RCT')) {
|
|
106
126
|
return moduleName.substring(3);
|
|
107
127
|
}
|
|
108
128
|
return moduleName;
|
|
109
129
|
}
|
|
110
130
|
|
|
111
|
-
export function toJSONString(json = '') {
|
|
131
|
+
export function toJSONString(json: object | string = ''): string {
|
|
112
132
|
return JSON.stringify(json);
|
|
113
133
|
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// DO NOT MODIFY
|
|
3
|
+
// THIS FILE IS AUTOGENERATED
|
|
4
|
+
|
|
5
|
+
import {isAndroid} from './index';
|
|
6
|
+
|
|
7
|
+
export const StyleTypes = {
|
|
8
|
+
Constant: 'constant',
|
|
9
|
+
Color: 'color',
|
|
10
|
+
Transition: 'transition',
|
|
11
|
+
Translation: 'translation',
|
|
12
|
+
Function: 'function',
|
|
13
|
+
Image: 'image',
|
|
14
|
+
Enum: 'enum',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function getStyleType(styleProp: keyof typeof styleExtras): string {
|
|
18
|
+
if (!isAndroid() && styleExtras[styleProp]) {
|
|
19
|
+
return styleExtras[styleProp].iosType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (styleMap[styleProp]) {
|
|
23
|
+
return styleMap[styleProp];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
throw new Error(`${styleProp} is not a valid MapLibre layer style`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const styleMap = {
|
|
30
|
+
fillSortKey: StyleTypes.Constant,
|
|
31
|
+
fillAntialias: StyleTypes.Constant,
|
|
32
|
+
fillOpacity: StyleTypes.Constant,
|
|
33
|
+
fillOpacityTransition: StyleTypes.Transition,
|
|
34
|
+
fillColor: StyleTypes.Color,
|
|
35
|
+
fillColorTransition: StyleTypes.Transition,
|
|
36
|
+
fillOutlineColor: StyleTypes.Color,
|
|
37
|
+
fillOutlineColorTransition: StyleTypes.Transition,
|
|
38
|
+
fillTranslate: StyleTypes.Translation,
|
|
39
|
+
fillTranslateTransition: StyleTypes.Transition,
|
|
40
|
+
fillTranslateAnchor: StyleTypes.Enum,
|
|
41
|
+
fillPattern: StyleTypes.Image,
|
|
42
|
+
fillPatternTransition: StyleTypes.Transition,
|
|
43
|
+
|
|
44
|
+
lineCap: StyleTypes.Enum,
|
|
45
|
+
lineJoin: StyleTypes.Enum,
|
|
46
|
+
lineMiterLimit: StyleTypes.Constant,
|
|
47
|
+
lineRoundLimit: StyleTypes.Constant,
|
|
48
|
+
lineSortKey: StyleTypes.Constant,
|
|
49
|
+
lineOpacity: StyleTypes.Constant,
|
|
50
|
+
lineOpacityTransition: StyleTypes.Transition,
|
|
51
|
+
lineColor: StyleTypes.Color,
|
|
52
|
+
lineColorTransition: StyleTypes.Transition,
|
|
53
|
+
lineTranslate: StyleTypes.Translation,
|
|
54
|
+
lineTranslateTransition: StyleTypes.Transition,
|
|
55
|
+
lineTranslateAnchor: StyleTypes.Enum,
|
|
56
|
+
lineWidth: StyleTypes.Constant,
|
|
57
|
+
lineWidthTransition: StyleTypes.Transition,
|
|
58
|
+
lineGapWidth: StyleTypes.Constant,
|
|
59
|
+
lineGapWidthTransition: StyleTypes.Transition,
|
|
60
|
+
lineOffset: StyleTypes.Constant,
|
|
61
|
+
lineOffsetTransition: StyleTypes.Transition,
|
|
62
|
+
lineBlur: StyleTypes.Constant,
|
|
63
|
+
lineBlurTransition: StyleTypes.Transition,
|
|
64
|
+
lineDasharray: StyleTypes.Constant,
|
|
65
|
+
lineDasharrayTransition: StyleTypes.Transition,
|
|
66
|
+
linePattern: StyleTypes.Image,
|
|
67
|
+
linePatternTransition: StyleTypes.Transition,
|
|
68
|
+
lineGradient: StyleTypes.Color,
|
|
69
|
+
|
|
70
|
+
symbolPlacement: StyleTypes.Enum,
|
|
71
|
+
symbolSpacing: StyleTypes.Constant,
|
|
72
|
+
symbolAvoidEdges: StyleTypes.Constant,
|
|
73
|
+
symbolSortKey: StyleTypes.Constant,
|
|
74
|
+
symbolZOrder: StyleTypes.Enum,
|
|
75
|
+
iconAllowOverlap: StyleTypes.Constant,
|
|
76
|
+
iconIgnorePlacement: StyleTypes.Constant,
|
|
77
|
+
iconOptional: StyleTypes.Constant,
|
|
78
|
+
iconRotationAlignment: StyleTypes.Enum,
|
|
79
|
+
iconSize: StyleTypes.Constant,
|
|
80
|
+
iconTextFit: StyleTypes.Enum,
|
|
81
|
+
iconTextFitPadding: StyleTypes.Constant,
|
|
82
|
+
iconImage: StyleTypes.Image,
|
|
83
|
+
iconRotate: StyleTypes.Constant,
|
|
84
|
+
iconPadding: StyleTypes.Constant,
|
|
85
|
+
iconKeepUpright: StyleTypes.Constant,
|
|
86
|
+
iconOffset: StyleTypes.Constant,
|
|
87
|
+
iconAnchor: StyleTypes.Enum,
|
|
88
|
+
iconPitchAlignment: StyleTypes.Enum,
|
|
89
|
+
textPitchAlignment: StyleTypes.Enum,
|
|
90
|
+
textRotationAlignment: StyleTypes.Enum,
|
|
91
|
+
textField: StyleTypes.Constant,
|
|
92
|
+
textFont: StyleTypes.Constant,
|
|
93
|
+
textSize: StyleTypes.Constant,
|
|
94
|
+
textMaxWidth: StyleTypes.Constant,
|
|
95
|
+
textLineHeight: StyleTypes.Constant,
|
|
96
|
+
textLetterSpacing: StyleTypes.Constant,
|
|
97
|
+
textJustify: StyleTypes.Enum,
|
|
98
|
+
textRadialOffset: StyleTypes.Constant,
|
|
99
|
+
textVariableAnchor: StyleTypes.Constant,
|
|
100
|
+
textAnchor: StyleTypes.Enum,
|
|
101
|
+
textMaxAngle: StyleTypes.Constant,
|
|
102
|
+
textWritingMode: StyleTypes.Constant,
|
|
103
|
+
textRotate: StyleTypes.Constant,
|
|
104
|
+
textPadding: StyleTypes.Constant,
|
|
105
|
+
textKeepUpright: StyleTypes.Constant,
|
|
106
|
+
textTransform: StyleTypes.Enum,
|
|
107
|
+
textOffset: StyleTypes.Constant,
|
|
108
|
+
textAllowOverlap: StyleTypes.Constant,
|
|
109
|
+
textIgnorePlacement: StyleTypes.Constant,
|
|
110
|
+
textOptional: StyleTypes.Constant,
|
|
111
|
+
iconOpacity: StyleTypes.Constant,
|
|
112
|
+
iconOpacityTransition: StyleTypes.Transition,
|
|
113
|
+
iconColor: StyleTypes.Color,
|
|
114
|
+
iconColorTransition: StyleTypes.Transition,
|
|
115
|
+
iconHaloColor: StyleTypes.Color,
|
|
116
|
+
iconHaloColorTransition: StyleTypes.Transition,
|
|
117
|
+
iconHaloWidth: StyleTypes.Constant,
|
|
118
|
+
iconHaloWidthTransition: StyleTypes.Transition,
|
|
119
|
+
iconHaloBlur: StyleTypes.Constant,
|
|
120
|
+
iconHaloBlurTransition: StyleTypes.Transition,
|
|
121
|
+
iconTranslate: StyleTypes.Translation,
|
|
122
|
+
iconTranslateTransition: StyleTypes.Transition,
|
|
123
|
+
iconTranslateAnchor: StyleTypes.Enum,
|
|
124
|
+
textOpacity: StyleTypes.Constant,
|
|
125
|
+
textOpacityTransition: StyleTypes.Transition,
|
|
126
|
+
textColor: StyleTypes.Color,
|
|
127
|
+
textColorTransition: StyleTypes.Transition,
|
|
128
|
+
textHaloColor: StyleTypes.Color,
|
|
129
|
+
textHaloColorTransition: StyleTypes.Transition,
|
|
130
|
+
textHaloWidth: StyleTypes.Constant,
|
|
131
|
+
textHaloWidthTransition: StyleTypes.Transition,
|
|
132
|
+
textHaloBlur: StyleTypes.Constant,
|
|
133
|
+
textHaloBlurTransition: StyleTypes.Transition,
|
|
134
|
+
textTranslate: StyleTypes.Translation,
|
|
135
|
+
textTranslateTransition: StyleTypes.Transition,
|
|
136
|
+
textTranslateAnchor: StyleTypes.Enum,
|
|
137
|
+
|
|
138
|
+
circleSortKey: StyleTypes.Constant,
|
|
139
|
+
circleRadius: StyleTypes.Constant,
|
|
140
|
+
circleRadiusTransition: StyleTypes.Transition,
|
|
141
|
+
circleColor: StyleTypes.Color,
|
|
142
|
+
circleColorTransition: StyleTypes.Transition,
|
|
143
|
+
circleBlur: StyleTypes.Constant,
|
|
144
|
+
circleBlurTransition: StyleTypes.Transition,
|
|
145
|
+
circleOpacity: StyleTypes.Constant,
|
|
146
|
+
circleOpacityTransition: StyleTypes.Transition,
|
|
147
|
+
circleTranslate: StyleTypes.Translation,
|
|
148
|
+
circleTranslateTransition: StyleTypes.Transition,
|
|
149
|
+
circleTranslateAnchor: StyleTypes.Enum,
|
|
150
|
+
circlePitchScale: StyleTypes.Enum,
|
|
151
|
+
circlePitchAlignment: StyleTypes.Enum,
|
|
152
|
+
circleStrokeWidth: StyleTypes.Constant,
|
|
153
|
+
circleStrokeWidthTransition: StyleTypes.Transition,
|
|
154
|
+
circleStrokeColor: StyleTypes.Color,
|
|
155
|
+
circleStrokeColorTransition: StyleTypes.Transition,
|
|
156
|
+
circleStrokeOpacity: StyleTypes.Constant,
|
|
157
|
+
circleStrokeOpacityTransition: StyleTypes.Transition,
|
|
158
|
+
|
|
159
|
+
heatmapRadius: StyleTypes.Constant,
|
|
160
|
+
heatmapRadiusTransition: StyleTypes.Transition,
|
|
161
|
+
heatmapWeight: StyleTypes.Constant,
|
|
162
|
+
heatmapIntensity: StyleTypes.Constant,
|
|
163
|
+
heatmapIntensityTransition: StyleTypes.Transition,
|
|
164
|
+
heatmapColor: StyleTypes.Color,
|
|
165
|
+
heatmapOpacity: StyleTypes.Constant,
|
|
166
|
+
heatmapOpacityTransition: StyleTypes.Transition,
|
|
167
|
+
|
|
168
|
+
fillExtrusionOpacity: StyleTypes.Constant,
|
|
169
|
+
fillExtrusionOpacityTransition: StyleTypes.Transition,
|
|
170
|
+
fillExtrusionColor: StyleTypes.Color,
|
|
171
|
+
fillExtrusionColorTransition: StyleTypes.Transition,
|
|
172
|
+
fillExtrusionTranslate: StyleTypes.Translation,
|
|
173
|
+
fillExtrusionTranslateTransition: StyleTypes.Transition,
|
|
174
|
+
fillExtrusionTranslateAnchor: StyleTypes.Enum,
|
|
175
|
+
fillExtrusionPattern: StyleTypes.Image,
|
|
176
|
+
fillExtrusionPatternTransition: StyleTypes.Transition,
|
|
177
|
+
fillExtrusionHeight: StyleTypes.Constant,
|
|
178
|
+
fillExtrusionHeightTransition: StyleTypes.Transition,
|
|
179
|
+
fillExtrusionBase: StyleTypes.Constant,
|
|
180
|
+
fillExtrusionBaseTransition: StyleTypes.Transition,
|
|
181
|
+
|
|
182
|
+
rasterOpacity: StyleTypes.Constant,
|
|
183
|
+
rasterOpacityTransition: StyleTypes.Transition,
|
|
184
|
+
rasterHueRotate: StyleTypes.Constant,
|
|
185
|
+
rasterHueRotateTransition: StyleTypes.Transition,
|
|
186
|
+
rasterBrightnessMin: StyleTypes.Constant,
|
|
187
|
+
rasterBrightnessMinTransition: StyleTypes.Transition,
|
|
188
|
+
rasterBrightnessMax: StyleTypes.Constant,
|
|
189
|
+
rasterBrightnessMaxTransition: StyleTypes.Transition,
|
|
190
|
+
rasterSaturation: StyleTypes.Constant,
|
|
191
|
+
rasterSaturationTransition: StyleTypes.Transition,
|
|
192
|
+
rasterContrast: StyleTypes.Constant,
|
|
193
|
+
rasterContrastTransition: StyleTypes.Transition,
|
|
194
|
+
rasterResampling: StyleTypes.Enum,
|
|
195
|
+
rasterFadeDuration: StyleTypes.Constant,
|
|
196
|
+
|
|
197
|
+
hillshadeIlluminationDirection: StyleTypes.Constant,
|
|
198
|
+
hillshadeIlluminationAnchor: StyleTypes.Enum,
|
|
199
|
+
hillshadeExaggeration: StyleTypes.Constant,
|
|
200
|
+
hillshadeExaggerationTransition: StyleTypes.Transition,
|
|
201
|
+
hillshadeShadowColor: StyleTypes.Color,
|
|
202
|
+
hillshadeShadowColorTransition: StyleTypes.Transition,
|
|
203
|
+
hillshadeHighlightColor: StyleTypes.Color,
|
|
204
|
+
hillshadeHighlightColorTransition: StyleTypes.Transition,
|
|
205
|
+
hillshadeAccentColor: StyleTypes.Color,
|
|
206
|
+
hillshadeAccentColorTransition: StyleTypes.Transition,
|
|
207
|
+
|
|
208
|
+
backgroundColor: StyleTypes.Color,
|
|
209
|
+
backgroundColorTransition: StyleTypes.Transition,
|
|
210
|
+
backgroundPattern: StyleTypes.Image,
|
|
211
|
+
backgroundPatternTransition: StyleTypes.Transition,
|
|
212
|
+
backgroundOpacity: StyleTypes.Constant,
|
|
213
|
+
backgroundOpacityTransition: StyleTypes.Transition,
|
|
214
|
+
|
|
215
|
+
anchor: StyleTypes.Enum,
|
|
216
|
+
position: StyleTypes.Constant,
|
|
217
|
+
positionTransition: StyleTypes.Transition,
|
|
218
|
+
color: StyleTypes.Color,
|
|
219
|
+
colorTransition: StyleTypes.Transition,
|
|
220
|
+
intensity: StyleTypes.Constant,
|
|
221
|
+
intensityTransition: StyleTypes.Transition,
|
|
222
|
+
|
|
223
|
+
visibility: StyleTypes.Constant,
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export const styleExtras = {
|
|
227
|
+
// padding
|
|
228
|
+
iconTextFitPadding: {
|
|
229
|
+
iosType: 'edgeinsets',
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
// offsets
|
|
233
|
+
iconOffset: {
|
|
234
|
+
iosType: 'vector',
|
|
235
|
+
},
|
|
236
|
+
textOffset: {
|
|
237
|
+
iosType: 'vector',
|
|
238
|
+
},
|
|
239
|
+
lineOffset: {
|
|
240
|
+
iosType: 'vector',
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// translates
|
|
244
|
+
fillTranslate: {
|
|
245
|
+
iosType: 'vector',
|
|
246
|
+
},
|
|
247
|
+
lineTranslate: {
|
|
248
|
+
iosType: 'vector',
|
|
249
|
+
},
|
|
250
|
+
iconTranslate: {
|
|
251
|
+
iosType: 'vector',
|
|
252
|
+
},
|
|
253
|
+
textTranslate: {
|
|
254
|
+
iosType: 'vector',
|
|
255
|
+
},
|
|
256
|
+
circleTranslate: {
|
|
257
|
+
iosType: 'vector',
|
|
258
|
+
},
|
|
259
|
+
fillExtrusionTranslate: {
|
|
260
|
+
iosType: 'vector',
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export default styleMap;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-react-native",
|
|
3
3
|
"description": "A MapLibre GL Native plugin for creating maps in React Native",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "10.0.0-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"author": "MapLibre",
|
|
9
|
-
"main": "./javascript/index.
|
|
9
|
+
"main": "./javascript/index.ts",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"maps",
|
|
12
12
|
"ios",
|
|
@@ -28,68 +28,82 @@
|
|
|
28
28
|
"unittest:single": "jest --testNamePattern",
|
|
29
29
|
"lint": "eslint .",
|
|
30
30
|
"lint:fix": "eslint . --fix",
|
|
31
|
-
"prepack": "yarn build:plugin",
|
|
31
|
+
"prepack": "pinst --disable && yarn build:plugin",
|
|
32
32
|
"test:plugin": "jest plugin",
|
|
33
33
|
"build:plugin": "tsc --build plugin",
|
|
34
|
-
"lint:plugin": "eslint plugin/src/*"
|
|
34
|
+
"lint:plugin": "eslint plugin/src/*",
|
|
35
|
+
"_postinstall": "husky install",
|
|
36
|
+
"postpack": "pinst --enable"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@expo/config-plugins": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
35
42
|
},
|
|
36
43
|
"peerDependencies": {
|
|
37
|
-
"
|
|
44
|
+
"@expo/config-plugins": ">=7",
|
|
38
45
|
"react": ">=16.6.1",
|
|
39
46
|
"react-native": ">=0.59.9"
|
|
40
47
|
},
|
|
41
48
|
"dependencies": {
|
|
42
|
-
"@expo/config-plugins": "^4.0.3",
|
|
43
49
|
"@mapbox/geo-viewport": ">= 0.4.0",
|
|
44
50
|
"@turf/along": "6.5.0",
|
|
45
51
|
"@turf/distance": "6.5.0",
|
|
46
52
|
"@turf/helpers": "6.5.0",
|
|
47
53
|
"@turf/length": "6.5.0",
|
|
48
54
|
"@turf/nearest-point-on-line": "6.5.0",
|
|
49
|
-
"@types/geojson": "^7946.0.
|
|
50
|
-
"@types/
|
|
51
|
-
"debounce": "^1.2.0"
|
|
52
|
-
"deprecated-react-native-prop-types": "^2.3.0"
|
|
55
|
+
"@types/geojson": "^7946.0.10",
|
|
56
|
+
"@types/react-native": "0.67.8",
|
|
57
|
+
"debounce": "^1.2.0"
|
|
53
58
|
},
|
|
54
59
|
"devDependencies": {
|
|
55
60
|
"@babel/core": "^7.20.5",
|
|
56
|
-
"@babel/eslint-parser": "^7.
|
|
61
|
+
"@babel/eslint-parser": "^7.22.9",
|
|
57
62
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
58
63
|
"@babel/runtime": "7.17.2",
|
|
64
|
+
"@expo/config-plugins": "^7.2.5",
|
|
59
65
|
"@react-native-community/eslint-config": "^3.0.1",
|
|
60
66
|
"@react-native-community/eslint-plugin": "^1.3.0",
|
|
61
|
-
"@
|
|
67
|
+
"@react-native/metro-config": "^0.72.7",
|
|
68
|
+
"@sinonjs/fake-timers": "^11.1.0",
|
|
62
69
|
"@testing-library/react-native": "^8.0.0",
|
|
70
|
+
"@tsconfig/node14": "14.1.0",
|
|
71
|
+
"@types/debounce": "^1.2.1",
|
|
72
|
+
"@types/jest": "^27.4.1",
|
|
73
|
+
"@types/mapbox__geo-viewport": "^0.4.1",
|
|
74
|
+
"@types/node": "^18.11.18",
|
|
75
|
+
"@types/react": "^18.2.15",
|
|
63
76
|
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
|
64
|
-
"@typescript-eslint/parser": "^
|
|
65
|
-
"babel-jest": "^
|
|
77
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
78
|
+
"babel-jest": "^29.6.0",
|
|
66
79
|
"documentation": "^14.0.0",
|
|
67
80
|
"ejs": "^3.1.3",
|
|
68
|
-
"ejs-lint": "^
|
|
69
|
-
"eslint": "^8.
|
|
81
|
+
"ejs-lint": "^2.0.0",
|
|
82
|
+
"eslint": "^8.45.0",
|
|
70
83
|
"eslint-config-prettier": "^8.1.0",
|
|
71
84
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
72
85
|
"eslint-plugin-fp": "^2.3.0",
|
|
73
86
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
74
|
-
"eslint-plugin-import": "2.
|
|
87
|
+
"eslint-plugin-import": "2.28.1",
|
|
75
88
|
"eslint-plugin-jest": "^27.1.7",
|
|
76
|
-
"eslint-plugin-prettier": "^
|
|
89
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
77
90
|
"eslint-plugin-react": "^7.31.11",
|
|
78
91
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
79
92
|
"eslint-plugin-react-native": "^4.0.0",
|
|
80
|
-
"expo-module-scripts": "^3.0
|
|
81
|
-
"husky": "
|
|
82
|
-
"jest": "^
|
|
83
|
-
"jest-cli": "^
|
|
84
|
-
"lint-staged": "^
|
|
85
|
-
"metro-react-native-babel-preset": "^0.
|
|
93
|
+
"expo-module-scripts": "^3.1.0",
|
|
94
|
+
"husky": "^8.0.3",
|
|
95
|
+
"jest": "^29.6.0",
|
|
96
|
+
"jest-cli": "^29.6.0",
|
|
97
|
+
"lint-staged": "^14.0.1",
|
|
98
|
+
"metro-react-native-babel-preset": "^0.76.7",
|
|
86
99
|
"node-dir": "0.1.17",
|
|
87
|
-
"
|
|
100
|
+
"pinst": "^3.0.0",
|
|
101
|
+
"prettier": "^3.0.3",
|
|
88
102
|
"prop-types": "^15.8.1",
|
|
89
|
-
"react": "^18.
|
|
103
|
+
"react": "^18.2.0",
|
|
90
104
|
"react-docgen": "rnmapbox/react-docgen#rnmapbox-dist",
|
|
91
|
-
"react-native": "0.
|
|
92
|
-
"react-test-renderer": "^18.
|
|
105
|
+
"react-native": "0.72.1",
|
|
106
|
+
"react-test-renderer": "^18.2.0",
|
|
93
107
|
"standard": "*",
|
|
94
108
|
"typescript": "^4.4.3"
|
|
95
109
|
},
|
|
@@ -108,13 +122,8 @@
|
|
|
108
122
|
"fixtures"
|
|
109
123
|
]
|
|
110
124
|
},
|
|
111
|
-
"husky": {
|
|
112
|
-
"hooks": {
|
|
113
|
-
"pre-commit": "lint-staged && npm run generate"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
125
|
"lint-staged": {
|
|
117
126
|
"*.{js,jsx,ts,tsx}": "yarn lint"
|
|
118
127
|
},
|
|
119
|
-
"packageManager": "yarn@3.
|
|
128
|
+
"packageManager": "yarn@3.6.1"
|
|
120
129
|
}
|
|
@@ -96,10 +96,11 @@ function setExcludedArchitectures(project) {
|
|
|
96
96
|
const configurations = project.pbxXCBuildConfigurationSection();
|
|
97
97
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
98
|
// @ts-ignore
|
|
99
|
-
for (const { buildSettings } of Object.values(configurations || {})) {
|
|
99
|
+
for (const { name, buildSettings } of Object.values(configurations || {})) {
|
|
100
100
|
// Guessing that this is the best way to emulate Xcode.
|
|
101
101
|
// Using `project.addToBuildSettings` modifies too many targets.
|
|
102
|
-
if (
|
|
102
|
+
if (name === 'Release' &&
|
|
103
|
+
typeof buildSettings?.PRODUCT_NAME !== 'undefined') {
|
|
103
104
|
buildSettings['"EXCLUDED_ARCHS[sdk=iphonesimulator*]"'] = '"arm64"';
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -265,7 +265,7 @@ global.getEnums = function (layers) {
|
|
|
265
265
|
global.dtsInterfaceType = function (prop) {
|
|
266
266
|
let propTypes = [];
|
|
267
267
|
|
|
268
|
-
if (prop.name.indexOf('Translate') !== -1) {
|
|
268
|
+
if (prop.name.indexOf('Translate') !== -1 && prop.type != 'enum') {
|
|
269
269
|
propTypes.push('Translation');
|
|
270
270
|
} else if (prop.type === 'color') {
|
|
271
271
|
propTypes.push('string');
|