@maplibre/maplibre-react-native 9.1.0 → 10.0.0-alpha.2
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 +18 -0
- package/android/rctmgl/build.gradle +7 -7
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/LocationManager.java +2 -2
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLOfflineModule.java +21 -26
- 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 -7
- 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 +518 -1272
- package/docs/location.md +6 -0
- package/docs/snapshotManager.md +3 -3
- 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} +129 -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 +35 -27
- package/plugin/build/withMapLibre.js +18 -3
- package/scripts/autogenHelpers/globals.js +1 -1
- package/scripts/autogenerate.js +14 -6
- package/scripts/download-style-spec.sh +1 -1
- 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 +1 -10
- package/tsconfig.json +20 -61
- package/index.d.ts +0 -955
- 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 -372
- 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.2",
|
|
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,64 +28,77 @@
|
|
|
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": "^4.1.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",
|
|
62
|
-
"@sinonjs/fake-timers": "^
|
|
68
|
+
"@sinonjs/fake-timers": "^11.1.0",
|
|
63
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",
|
|
64
76
|
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
|
65
|
-
"@typescript-eslint/parser": "^
|
|
77
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
66
78
|
"babel-jest": "^29.6.0",
|
|
67
79
|
"documentation": "^14.0.0",
|
|
68
80
|
"ejs": "^3.1.3",
|
|
69
|
-
"ejs-lint": "^
|
|
70
|
-
"eslint": "^8.
|
|
81
|
+
"ejs-lint": "^2.0.0",
|
|
82
|
+
"eslint": "^8.45.0",
|
|
71
83
|
"eslint-config-prettier": "^8.1.0",
|
|
72
84
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
73
85
|
"eslint-plugin-fp": "^2.3.0",
|
|
74
86
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
75
|
-
"eslint-plugin-import": "2.
|
|
87
|
+
"eslint-plugin-import": "2.28.1",
|
|
76
88
|
"eslint-plugin-jest": "^27.1.7",
|
|
77
|
-
"eslint-plugin-prettier": "^
|
|
89
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
78
90
|
"eslint-plugin-react": "^7.31.11",
|
|
79
91
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
80
92
|
"eslint-plugin-react-native": "^4.0.0",
|
|
81
|
-
"expo-module-scripts": "^3.0
|
|
82
|
-
"husky": "
|
|
93
|
+
"expo-module-scripts": "^3.1.0",
|
|
94
|
+
"husky": "^8.0.3",
|
|
83
95
|
"jest": "^29.6.0",
|
|
84
96
|
"jest-cli": "^29.6.0",
|
|
85
|
-
"lint-staged": "^
|
|
97
|
+
"lint-staged": "^14.0.1",
|
|
86
98
|
"metro-react-native-babel-preset": "^0.76.7",
|
|
87
99
|
"node-dir": "0.1.17",
|
|
88
|
-
"
|
|
100
|
+
"pinst": "^3.0.0",
|
|
101
|
+
"prettier": "^3.0.3",
|
|
89
102
|
"prop-types": "^15.8.1",
|
|
90
103
|
"react": "^18.2.0",
|
|
91
104
|
"react-docgen": "rnmapbox/react-docgen#rnmapbox-dist",
|
|
@@ -109,13 +122,8 @@
|
|
|
109
122
|
"fixtures"
|
|
110
123
|
]
|
|
111
124
|
},
|
|
112
|
-
"husky": {
|
|
113
|
-
"hooks": {
|
|
114
|
-
"pre-commit": "lint-staged && npm run generate"
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
125
|
"lint-staged": {
|
|
118
126
|
"*.{js,jsx,ts,tsx}": "yarn lint"
|
|
119
127
|
},
|
|
120
|
-
"packageManager": "yarn@3.
|
|
128
|
+
"packageManager": "yarn@3.6.1"
|
|
121
129
|
}
|
|
@@ -96,16 +96,31 @@ 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
|
}
|
|
106
107
|
return project;
|
|
107
108
|
}
|
|
108
109
|
exports.setExcludedArchitectures = setExcludedArchitectures;
|
|
110
|
+
const withoutSignatures = config => {
|
|
111
|
+
const shellScript = `if [ "$XCODE_VERSION_MAJOR" = "1500" ]; then
|
|
112
|
+
echo "Remove signature files (Xcode 15 workaround)";
|
|
113
|
+
rm -rf "$CONFIGURATION_BUILD_DIR/Mapbox.xcframework-ios.signature";
|
|
114
|
+
fi`;
|
|
115
|
+
return (0, config_plugins_1.withXcodeProject)(config, async (config) => {
|
|
116
|
+
const xcodeProject = config.modResults;
|
|
117
|
+
xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Remove signature files (Xcode 15 workaround)', null, {
|
|
118
|
+
shellPath: '/bin/sh',
|
|
119
|
+
shellScript,
|
|
120
|
+
});
|
|
121
|
+
return config;
|
|
122
|
+
});
|
|
123
|
+
};
|
|
109
124
|
const withExcludedSimulatorArchitectures = c => {
|
|
110
125
|
return (0, config_plugins_1.withXcodeProject)(c, config => {
|
|
111
126
|
config.modResults = setExcludedArchitectures(config.modResults);
|
|
@@ -113,7 +128,7 @@ const withExcludedSimulatorArchitectures = c => {
|
|
|
113
128
|
});
|
|
114
129
|
};
|
|
115
130
|
const withMapLibre = config => {
|
|
116
|
-
config = withExcludedSimulatorArchitectures(config);
|
|
131
|
+
config = withoutSignatures(withExcludedSimulatorArchitectures(config));
|
|
117
132
|
return withCocoaPodsInstallerBlocks(config);
|
|
118
133
|
};
|
|
119
134
|
exports.default = (0, config_plugins_1.createRunOncePlugin)(withMapLibre, pkg.name, pkg.version);
|
|
@@ -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');
|