@rnmapbox/maps 10.0.0-beta.33 → 10.0.0-beta.35
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 +2 -2
- package/.nvmrc +1 -1
- package/README-v10.md +1 -1
- package/README.md +31 -26
- package/android/install.md +1 -1
- package/android/rctmgl/build.gradle +1 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +8 -3
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerView.kt +15 -6
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerViewManager.kt +40 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerViewWrapper.kt +8 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerViewWrapperManager.kt +21 -0
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +26 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +5 -5
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/modules/RCTMGLModule.kt +1 -0
- package/docs/Annotation.md +8 -8
- package/docs/Annotations.md +14 -12
- package/docs/Atmosphere.md +76 -76
- package/docs/BackgroundLayer.md +44 -44
- package/docs/Callout.md +4 -4
- package/docs/Camera.md +124 -6
- package/docs/CircleLayer.md +129 -129
- package/docs/CustomHttpHeaders.md +12 -14
- package/docs/FillExtrusionLayer.md +120 -120
- package/docs/FillLayer.md +83 -83
- package/docs/HeadingIndicator.md +3 -3
- package/docs/HeatmapLayer.md +58 -58
- package/docs/ImageSource.md +4 -3
- package/docs/Images.md +3 -3
- package/docs/Light.md +45 -45
- package/docs/LineLayer.md +166 -166
- package/docs/Logger.md +8 -9
- package/docs/MapView.md +32 -32
- package/docs/MapboxGL.md +26 -27
- package/docs/MarkerView.md +11 -6
- package/docs/NativeUserLocation.md +3 -3
- package/docs/OfflineManager.md +35 -33
- package/docs/PointAnnotation.md +12 -6
- package/docs/RasterDemSource.md +3 -3
- package/docs/RasterLayer.md +99 -99
- package/docs/RasterSource.md +5 -3
- package/docs/ShapeSource.md +17 -16
- package/docs/SkyLayer.md +69 -69
- package/docs/Style.md +5 -3
- package/docs/StyleSheet.md +74 -278
- package/docs/SymbolLayer.md +454 -454
- package/docs/Terrain.md +6 -6
- package/docs/UserLocation.md +8 -8
- package/docs/VectorSource.md +9 -8
- package/docs/docs.json +196 -28
- package/docs/snapshotManager.md +7 -5
- package/index.d.ts +30 -26
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +14 -5
- package/ios/RCTMGL-v10/RCTMGLMarkerView.swift +28 -14
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapper.swift +24 -0
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapperManager.m +8 -0
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapperManager.swift +14 -0
- package/ios/install.md +25 -14
- package/javascript/{utils/animated → classes}/AnimatedCoordinatesArray.js +1 -1
- package/javascript/{utils/animated → classes}/AnimatedExtractCoordinateFromArray.js +3 -1
- package/javascript/{utils/animated → classes}/AnimatedPoint.js +0 -0
- package/javascript/{utils/animated → classes}/AnimatedRouteCoordinatesArray.js +3 -1
- package/javascript/{utils/animated → classes}/AnimatedShape.js +9 -3
- package/javascript/classes/index.d.ts +5 -0
- package/javascript/classes/index.js +5 -0
- package/javascript/components/Callout.js +1 -1
- package/javascript/components/Camera.tsx +5 -1
- package/javascript/components/Images.js +1 -1
- package/javascript/components/MapView.js +3 -4
- package/javascript/components/MarkerView.tsx +125 -0
- package/javascript/components/PointAnnotation.d.ts +13 -0
- package/javascript/components/RasterDemSource.js +1 -1
- package/javascript/components/RasterSource.js +1 -1
- package/javascript/components/ShapeSource.js +4 -4
- package/javascript/components/Style.js +1 -1
- package/javascript/components/annotations/Annotation.js +3 -3
- package/javascript/index.js +27 -14
- package/javascript/types/index.ts +1 -1
- package/javascript/utils/BridgeValue.ts +89 -0
- package/javascript/utils/StyleValue.ts +21 -10
- package/javascript/utils/animated/Animated.js +0 -11
- package/javascript/utils/deprecation.js +0 -1
- package/javascript/utils/geoUtils.d.ts +10 -0
- package/javascript/utils/index.d.ts +6 -0
- package/package.json +16 -13
- package/plugin/build/withMapbox.js +0 -2
- package/plugin/install.md +13 -6
- package/rnmapbox-maps.podspec +1 -1
- package/scripts/autogenHelpers/DocJSONBuilder.js +43 -4
- package/scripts/autogenHelpers/globals.js +0 -2
- package/scripts/autogenerate.js +1 -2
- package/scripts/templates/component.md.ejs +25 -25
- package/tsconfig.json +1 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLMarkerViewManager.java +0 -45
- package/javascript/components/MarkerView.js +0 -91
- package/javascript/utils/BridgeValue.js +0 -81
package/javascript/index.js
CHANGED
|
@@ -29,11 +29,13 @@ import offlineManager from './modules/offline/offlineManager';
|
|
|
29
29
|
import snapshotManager from './modules/snapshot/snapshotManager';
|
|
30
30
|
import MarkerView from './components/MarkerView';
|
|
31
31
|
import Animated from './utils/animated/Animated';
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
import {
|
|
33
|
+
AnimatedCoordinatesArray,
|
|
34
|
+
AnimatedExtractCoordinateFromArray,
|
|
35
|
+
AnimatedPoint,
|
|
36
|
+
AnimatedRouteCoordinatesArray,
|
|
37
|
+
AnimatedShape,
|
|
38
|
+
} from './classes';
|
|
37
39
|
import Style from './components/Style';
|
|
38
40
|
import Logger from './utils/Logger';
|
|
39
41
|
import { requestAndroidLocationPermissions } from './requestAndroidLocationPermissions';
|
|
@@ -53,6 +55,15 @@ MapboxGL.UserLocation = UserLocation;
|
|
|
53
55
|
MapboxGL.Camera = Camera;
|
|
54
56
|
MapboxGL.Style = Style;
|
|
55
57
|
|
|
58
|
+
// classes
|
|
59
|
+
MapboxGL.AnimatedPoint = AnimatedPoint;
|
|
60
|
+
MapboxGL.AnimatedMapPoint = AnimatedPoint; // For backwards compatibiilty.
|
|
61
|
+
MapboxGL.AnimatedShape = AnimatedShape;
|
|
62
|
+
MapboxGL.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
|
|
63
|
+
MapboxGL.AnimatedExtractCoordinateFromArray =
|
|
64
|
+
AnimatedExtractCoordinateFromArray;
|
|
65
|
+
MapboxGL.AnimatedRouteCoordinatesArray = AnimatedRouteCoordinatesArray;
|
|
66
|
+
|
|
56
67
|
// annotations
|
|
57
68
|
MapboxGL.Annotation = Annotation;
|
|
58
69
|
MapboxGL.MarkerView = MarkerView;
|
|
@@ -86,18 +97,17 @@ MapboxGL.snapshotManager = snapshotManager;
|
|
|
86
97
|
|
|
87
98
|
// animated
|
|
88
99
|
MapboxGL.Animated = Animated;
|
|
100
|
+
MapboxGL.Animated.RouteCoordinatesArray = AnimatedRouteCoordinatesArray; // For backwards compatibiilty.
|
|
101
|
+
MapboxGL.Animated.ExtractCoordinateFromArray =
|
|
102
|
+
AnimatedExtractCoordinateFromArray; // For backwards compatibiilty.
|
|
89
103
|
|
|
90
104
|
// utils
|
|
91
|
-
MapboxGL.AnimatedPoint = AnimatedMapPoint;
|
|
92
|
-
MapboxGL.AnimatedCoordinatesArray = AnimatedCoordinatesArray;
|
|
93
|
-
MapboxGL.AnimatedExtractCoordinateFromArray =
|
|
94
|
-
AnimatedExtractCoordinateFromArray;
|
|
95
|
-
MapboxGL.AnimatedRouteCoordinatesArray = AnimatedRouteCoordinatesArray;
|
|
96
|
-
MapboxGL.AnimatedShape = AnimatedShape;
|
|
97
105
|
MapboxGL.Logger = Logger;
|
|
98
106
|
|
|
99
107
|
const { LineJoin } = MapboxGL;
|
|
100
108
|
|
|
109
|
+
const AnimatedMapPoint = AnimatedPoint; // For backwards compatibiilty.
|
|
110
|
+
|
|
101
111
|
export {
|
|
102
112
|
MapView,
|
|
103
113
|
Light,
|
|
@@ -124,12 +134,15 @@ export {
|
|
|
124
134
|
BackgroundLayer,
|
|
125
135
|
Terrain,
|
|
126
136
|
Atmosphere,
|
|
137
|
+
AnimatedCoordinatesArray,
|
|
138
|
+
AnimatedExtractCoordinateFromArray,
|
|
139
|
+
AnimatedPoint,
|
|
140
|
+
AnimatedMapPoint,
|
|
141
|
+
AnimatedRouteCoordinatesArray,
|
|
142
|
+
AnimatedShape,
|
|
127
143
|
locationManager,
|
|
128
144
|
offlineManager,
|
|
129
145
|
snapshotManager,
|
|
130
|
-
AnimatedMapPoint,
|
|
131
|
-
AnimatedCoordinatesArray,
|
|
132
|
-
AnimatedShape,
|
|
133
146
|
Animated,
|
|
134
147
|
LineJoin,
|
|
135
148
|
Logger,
|
|
@@ -31,7 +31,7 @@ export interface AnimatedPoint extends GeoJsonObject {
|
|
|
31
31
|
coordinates: (Animated.Value | number)[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface
|
|
34
|
+
export interface AnimatedShape extends GeoJsonObject {
|
|
35
35
|
readonly type: 'LineString';
|
|
36
36
|
coordinates: (Animated.Value | number)[][];
|
|
37
37
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { isBoolean, isNumber, isString } from './index';
|
|
2
|
+
|
|
3
|
+
export type RawValueType =
|
|
4
|
+
| string
|
|
5
|
+
| number
|
|
6
|
+
| boolean
|
|
7
|
+
| RawValueType[]
|
|
8
|
+
| { [key: string]: RawValueType };
|
|
9
|
+
|
|
10
|
+
export type StyleValueJSON =
|
|
11
|
+
| { type: 'boolean'; value: boolean }
|
|
12
|
+
| { type: 'number'; value: number }
|
|
13
|
+
| { type: 'string'; value: string }
|
|
14
|
+
| { type: 'hashmap'; value: object }
|
|
15
|
+
| { type: 'array'; value: unknown[] };
|
|
16
|
+
|
|
17
|
+
type StyleValueTypes = 'boolean' | 'number' | 'string' | 'hashmap' | 'array';
|
|
18
|
+
|
|
19
|
+
export default class BridgeValue {
|
|
20
|
+
rawValue: RawValueType;
|
|
21
|
+
|
|
22
|
+
constructor(rawValue: RawValueType) {
|
|
23
|
+
this.rawValue = rawValue;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get type(): StyleValueTypes {
|
|
27
|
+
if (Array.isArray(this.rawValue)) {
|
|
28
|
+
return 'array';
|
|
29
|
+
}
|
|
30
|
+
if (isBoolean(this.rawValue)) {
|
|
31
|
+
return 'boolean';
|
|
32
|
+
}
|
|
33
|
+
if (isNumber(this.rawValue)) {
|
|
34
|
+
return 'number';
|
|
35
|
+
}
|
|
36
|
+
if (isString(this.rawValue)) {
|
|
37
|
+
return 'string';
|
|
38
|
+
}
|
|
39
|
+
if (this.rawValue && typeof this.rawValue === 'object') {
|
|
40
|
+
return 'hashmap';
|
|
41
|
+
}
|
|
42
|
+
throw new Error(
|
|
43
|
+
`[type - ${this.rawValue}] BridgeValue must be a primitive/array/object`,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get value() {
|
|
48
|
+
const { type } = this;
|
|
49
|
+
|
|
50
|
+
let value;
|
|
51
|
+
|
|
52
|
+
if (type === 'array') {
|
|
53
|
+
value = [];
|
|
54
|
+
|
|
55
|
+
const rawValue = this.rawValue as RawValueType[];
|
|
56
|
+
for (const innerRawValue of rawValue) {
|
|
57
|
+
const bridgeValue = new BridgeValue(innerRawValue);
|
|
58
|
+
value.push(bridgeValue.toJSON());
|
|
59
|
+
}
|
|
60
|
+
} else if (type === 'hashmap') {
|
|
61
|
+
value = [];
|
|
62
|
+
|
|
63
|
+
const rawValue = this.rawValue as { [key: string]: RawValueType };
|
|
64
|
+
const stringKeys = Object.keys(rawValue);
|
|
65
|
+
for (const stringKey of stringKeys) {
|
|
66
|
+
value.push([
|
|
67
|
+
new BridgeValue(stringKey).toJSON(),
|
|
68
|
+
new BridgeValue(rawValue[stringKey]).toJSON(),
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
} else if (type === 'boolean' || type === 'number' || type === 'string') {
|
|
72
|
+
value = this.rawValue;
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`[value - ${this.rawValue}] BridgeValue must be a primitive/array/object`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
toJSON(formatter?: <T>(arg0: T) => T): StyleValueJSON {
|
|
83
|
+
return {
|
|
84
|
+
type: this.type,
|
|
85
|
+
value:
|
|
86
|
+
typeof formatter === 'function' ? formatter(this.value) : this.value,
|
|
87
|
+
} as StyleValueJSON;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Image,
|
|
3
|
+
ImageResolvedAssetSource,
|
|
4
|
+
processColor,
|
|
5
|
+
ProcessedColorValue,
|
|
6
|
+
} from 'react-native';
|
|
2
7
|
|
|
3
8
|
import { getStyleType } from './styleMap';
|
|
4
|
-
import BridgeValue
|
|
9
|
+
import BridgeValue, {
|
|
10
|
+
type StyleValueJSON,
|
|
11
|
+
type RawValueType,
|
|
12
|
+
} from './BridgeValue';
|
|
5
13
|
import { AllLayerStyleProps } from './MapboxStyles';
|
|
6
14
|
|
|
7
|
-
type StyleValueArray = { type: 'array'; value: [any] };
|
|
8
|
-
type StyleValueNumber = { type: 'number'; value: number };
|
|
9
|
-
type StyleValueString = { type: 'string'; value: string };
|
|
10
|
-
|
|
11
15
|
export type StyleValue = {
|
|
12
16
|
styletype: string;
|
|
13
|
-
stylevalue:
|
|
17
|
+
stylevalue: StyleValueJSON;
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
export function transformStyle(
|
|
@@ -24,12 +28,19 @@ export function transformStyle(
|
|
|
24
28
|
const styleProps = Object.keys(style) as Array<keyof typeof style>;
|
|
25
29
|
for (const styleProp of styleProps) {
|
|
26
30
|
const styleType = getStyleType(styleProp);
|
|
27
|
-
let rawStyle:
|
|
31
|
+
let rawStyle: RawValueType = style[styleProp];
|
|
28
32
|
|
|
29
33
|
if (styleType === 'color' && typeof rawStyle === 'string') {
|
|
30
|
-
|
|
34
|
+
const color = processColor(rawStyle);
|
|
35
|
+
if (color === null || color === undefined || typeof color === 'symbol') {
|
|
36
|
+
console.error(`RNMapbox: Invalid color value: ${rawStyle} using red`);
|
|
37
|
+
rawStyle = 'ff0000';
|
|
38
|
+
} else {
|
|
39
|
+
rawStyle = color;
|
|
40
|
+
}
|
|
31
41
|
} else if (styleType === 'image' && typeof rawStyle === 'number') {
|
|
32
|
-
rawStyle =
|
|
42
|
+
rawStyle =
|
|
43
|
+
(Image.resolveAssetSource(rawStyle) as unknown as RawValueType) || {};
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
const bridgeValue = new BridgeValue(rawStyle);
|
|
@@ -10,11 +10,6 @@ import SymbolLayer from '../../components/SymbolLayer';
|
|
|
10
10
|
import RasterLayer from '../../components/RasterLayer';
|
|
11
11
|
import BackgroundLayer from '../../components/BackgroundLayer';
|
|
12
12
|
|
|
13
|
-
import AnimatedShape from './AnimatedShape';
|
|
14
|
-
import AnimatedCoordinatesArray from './AnimatedCoordinatesArray';
|
|
15
|
-
import AnimatedExtractCoordinateFromArray from './AnimatedExtractCoordinateFromArray';
|
|
16
|
-
import AnimatedRouteCoordinatesArray from './AnimatedRouteCoordinatesArray';
|
|
17
|
-
|
|
18
13
|
const Animated = {
|
|
19
14
|
// sources
|
|
20
15
|
ShapeSource: RNAnimated.createAnimatedComponent(ShapeSource),
|
|
@@ -28,12 +23,6 @@ const Animated = {
|
|
|
28
23
|
SymbolLayer: RNAnimated.createAnimatedComponent(SymbolLayer),
|
|
29
24
|
RasterLayer: RNAnimated.createAnimatedComponent(RasterLayer),
|
|
30
25
|
BackgroundLayer: RNAnimated.createAnimatedComponent(BackgroundLayer),
|
|
31
|
-
|
|
32
|
-
// values
|
|
33
|
-
CoordinatesArray: AnimatedCoordinatesArray,
|
|
34
|
-
RouteCoordinatesArray: AnimatedRouteCoordinatesArray,
|
|
35
|
-
Shape: AnimatedShape,
|
|
36
|
-
ExtractCoordinateFromArray: AnimatedExtractCoordinateFromArray,
|
|
37
26
|
};
|
|
38
27
|
|
|
39
28
|
export default Animated;
|
|
@@ -12,7 +12,6 @@ export function copyPropertiesAsDeprecated(
|
|
|
12
12
|
const result = newObject;
|
|
13
13
|
for (const [key, value] of Object.entries(origObject)) {
|
|
14
14
|
if (!newObject[key]) {
|
|
15
|
-
// eslint-disable-next-line fp/no-mutating-methods
|
|
16
15
|
Object.defineProperty(result, key, {
|
|
17
16
|
get() {
|
|
18
17
|
onDeprecatedCalled(key);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function makeLatLngBounds<G = Geometry, P = Properties>(
|
|
2
|
+
northEastCoordinates: Position[],
|
|
3
|
+
southWestCoordinates: Position[],
|
|
4
|
+
): FeatureCollection<G, P>;
|
|
5
|
+
|
|
6
|
+
export function makePoint<P = Properties>(
|
|
7
|
+
coordinates: Position,
|
|
8
|
+
properties?: P,
|
|
9
|
+
options?: PositionsOptions,
|
|
10
|
+
): Feature<GeoJSON.Point, P>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnmapbox/maps",
|
|
3
3
|
"description": "A Mapbox react native module for creating custom maps",
|
|
4
|
-
"version": "10.0.0-beta.
|
|
4
|
+
"version": "10.0.0-beta.35",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -36,18 +36,21 @@
|
|
|
36
36
|
"prepare": "husky install"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
+
"expo": "*",
|
|
40
|
+
"mapbox-gl": "^ 2.9.0",
|
|
39
41
|
"prop-types": ">=15.5.8",
|
|
40
42
|
"react": ">=16.6.1",
|
|
41
|
-
"react-native": ">=0.59.9"
|
|
42
|
-
"mapbox-gl": "^ 2.9.0"
|
|
43
|
+
"react-native": ">=0.59.9"
|
|
43
44
|
},
|
|
44
45
|
"peerDependenciesMeta": {
|
|
46
|
+
"expo": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
45
49
|
"mapbox-gl": {
|
|
46
50
|
"optional": true
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
"dependencies": {
|
|
50
|
-
"@expo/config-plugins": "^4.0.3",
|
|
51
54
|
"@mapbox/geo-viewport": ">= 0.4.0",
|
|
52
55
|
"@turf/along": "6.5.0",
|
|
53
56
|
"@turf/distance": "6.5.0",
|
|
@@ -65,34 +68,34 @@
|
|
|
65
68
|
"@babel/runtime": "7.17.2",
|
|
66
69
|
"@react-native-community/eslint-config": "^3.0.1",
|
|
67
70
|
"@sinonjs/fake-timers": "^8.0.1",
|
|
68
|
-
"@testing-library/react-native": "^
|
|
71
|
+
"@testing-library/react-native": "^11.0.0",
|
|
69
72
|
"@types/mapbox-gl": "^2.7.5",
|
|
70
73
|
"@types/react-native": ">=0.59.9",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
72
|
-
"@typescript-eslint/parser": "^5.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
75
|
+
"@typescript-eslint/parser": "^5.36.2",
|
|
73
76
|
"babel-jest": "^27.5.1",
|
|
74
77
|
"documentation": "13.2.5",
|
|
75
78
|
"ejs": "^3.1.3",
|
|
76
79
|
"ejs-lint": "^1.1.0",
|
|
77
|
-
"eslint": "^
|
|
80
|
+
"eslint": "^8.23.0",
|
|
78
81
|
"eslint-config-prettier": "^8.5.0",
|
|
79
|
-
"eslint-plugin-
|
|
80
|
-
"eslint-plugin-fp": "^2.3.0",
|
|
82
|
+
"eslint-plugin-ft-flow": "^2.0.1",
|
|
81
83
|
"eslint-plugin-import": "2.25.3",
|
|
84
|
+
"eslint-plugin-jest": "^27.0.1",
|
|
82
85
|
"expo-module-scripts": "^2.0.0",
|
|
83
86
|
"husky": "^8.0.1",
|
|
84
87
|
"jest": "27.5.1",
|
|
85
88
|
"jest-cli": "27.5.1",
|
|
86
89
|
"lint-staged": "^12.1.2",
|
|
90
|
+
"mapbox-gl": "^2.9.0",
|
|
87
91
|
"metro-react-native-babel-preset": "0.71.1",
|
|
88
92
|
"node-dir": "0.1.17",
|
|
89
93
|
"prettier": "2.6.2",
|
|
90
94
|
"react": "17.0.2",
|
|
91
|
-
"react-docgen": "
|
|
95
|
+
"react-docgen": "rnmapbox/react-docgen#rnmapbox-dist",
|
|
92
96
|
"react-native": "0.67.0",
|
|
93
97
|
"react-test-renderer": "17.0.2",
|
|
94
|
-
"typescript": "^4.
|
|
95
|
-
"mapbox-gl": "^ 2.9.0"
|
|
98
|
+
"typescript": "^4.8.0"
|
|
96
99
|
},
|
|
97
100
|
"jest": {
|
|
98
101
|
"preset": "react-native",
|
|
@@ -150,7 +150,6 @@ const withAndroidPropertiesDownloadToken = (config, { RNMapboxMapsDownloadToken
|
|
|
150
150
|
}
|
|
151
151
|
return true;
|
|
152
152
|
});
|
|
153
|
-
// eslint-disable-next-line fp/no-mutating-methods
|
|
154
153
|
config.modResults.push({
|
|
155
154
|
type: 'property',
|
|
156
155
|
key,
|
|
@@ -173,7 +172,6 @@ const withAndroidPropertiesImpl2 = (config, { RNMapboxMapsImpl }) => {
|
|
|
173
172
|
}
|
|
174
173
|
return true;
|
|
175
174
|
});
|
|
176
|
-
// eslint-disable-next-line fp/no-mutating-methods
|
|
177
175
|
config.modResults.push({
|
|
178
176
|
type: 'property',
|
|
179
177
|
key: key,
|
package/plugin/install.md
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
# Expo
|
|
1
|
+
# Expo Installation
|
|
2
2
|
|
|
3
|
-
> This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).
|
|
3
|
+
> :warning: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).
|
|
4
4
|
|
|
5
|
-
First install the package with
|
|
5
|
+
First install the package with [`expo`](https://docs.expo.io/workflow/expo-cli/#expo-install), [`yarn`or `npm`](../README.md#step-1---install-package).
|
|
6
6
|
|
|
7
|
+
Install the latest release:
|
|
7
8
|
```sh
|
|
8
|
-
expo install rnmapbox/maps
|
|
9
|
+
expo install @rnmapbox/maps
|
|
9
10
|
```
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Installing other versions
|
|
13
|
+
Replace `@rnmapbox/maps` with the following to install other versions:
|
|
14
|
+
- `rnmapbox/maps#main` installs the latest source from git
|
|
15
|
+
|
|
16
|
+
## Plugin Configuration
|
|
17
|
+
|
|
18
|
+
After installing this package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.{json,config.js,config.ts}`:
|
|
12
19
|
|
|
13
20
|
```json
|
|
14
21
|
{
|
|
@@ -36,7 +43,7 @@ For `mapbox` or `mapbox-gl` you'll need to provide `RNMapboxMapsDownloadToken` a
|
|
|
36
43
|
[
|
|
37
44
|
"@rnmapbox/maps",
|
|
38
45
|
{
|
|
39
|
-
"RNMapboxMapsImpl": "
|
|
46
|
+
"RNMapboxMapsImpl": "mapbox",
|
|
40
47
|
"RNMapboxMapsDownloadToken": "sk.ey...qg"
|
|
41
48
|
}
|
|
42
49
|
]
|
package/rnmapbox-maps.podspec
CHANGED
|
@@ -20,7 +20,7 @@ require 'json'
|
|
|
20
20
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
21
21
|
|
|
22
22
|
## Warning: these lines are scanned by autogenerate.js
|
|
23
|
-
rnMapboxMapsDefaultMapboxVersion = '~> 10.
|
|
23
|
+
rnMapboxMapsDefaultMapboxVersion = '~> 10.8.1'
|
|
24
24
|
rnMapboxMapsDefaultMapboxGLVersion = '~> 5.9.0'
|
|
25
25
|
rnMapboxMapsDefaultMapLibreVersion = 'exactVersion 5.12.1'
|
|
26
26
|
|
|
@@ -143,6 +143,42 @@ class DocJSONBuilder {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
function tsTypeDescType(tsType) {
|
|
147
|
+
if (!tsType?.name) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (tsType.name === 'signature') {
|
|
152
|
+
const { properties } = tsType.signature;
|
|
153
|
+
const value = properties.map((kv) => {
|
|
154
|
+
return mapProp(
|
|
155
|
+
mapNestedProp({ ...kv.value, description: kv.description }),
|
|
156
|
+
kv.key,
|
|
157
|
+
false,
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
return { name: 'shape', value };
|
|
161
|
+
/*
|
|
162
|
+
if (tsType.raw.length < 200) {
|
|
163
|
+
return `${tsType.raw
|
|
164
|
+
.replace(/(\n|\s)/g, '')
|
|
165
|
+
.replace(/(\|)/g, '\\|')}`;
|
|
166
|
+
} else {
|
|
167
|
+
return 'FIX ME FORMAT BIG OBJECT';
|
|
168
|
+
} */
|
|
169
|
+
} else if (tsType.name === 'union') {
|
|
170
|
+
if (tsType.raw) {
|
|
171
|
+
// Props
|
|
172
|
+
return tsType.raw.replace(/\|/g, '\\|');
|
|
173
|
+
} else if (tsType.elements) {
|
|
174
|
+
// Methods
|
|
175
|
+
return tsType.elements.map((e) => e.name).join(' \\| ');
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
return tsType.name;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
146
182
|
function mapProp(propMeta, propName, array) {
|
|
147
183
|
let result = {};
|
|
148
184
|
if (!array) {
|
|
@@ -151,7 +187,7 @@ class DocJSONBuilder {
|
|
|
151
187
|
required: propMeta.required || false,
|
|
152
188
|
type:
|
|
153
189
|
propMeta.type?.name ||
|
|
154
|
-
|
|
190
|
+
tsTypeDescType(propMeta.tsType) ||
|
|
155
191
|
'FIX ME UNKNOWN TYPE',
|
|
156
192
|
default: !propMeta.defaultValue
|
|
157
193
|
? 'none'
|
|
@@ -167,7 +203,7 @@ class DocJSONBuilder {
|
|
|
167
203
|
}
|
|
168
204
|
result.type =
|
|
169
205
|
(propMeta.type && propMeta.type.name) ||
|
|
170
|
-
|
|
206
|
+
tsTypeDescType(propMeta.tsType) ||
|
|
171
207
|
'FIX ME UNKNOWN TYPE';
|
|
172
208
|
if (propMeta.defaultValue) {
|
|
173
209
|
result.default = propMeta.defaultValue.value.replace(/\n/g, '');
|
|
@@ -276,9 +312,12 @@ class DocJSONBuilder {
|
|
|
276
312
|
return;
|
|
277
313
|
}
|
|
278
314
|
|
|
279
|
-
let
|
|
280
|
-
|
|
315
|
+
let parsedComponents = docgen.parse(content, {
|
|
316
|
+
babelOptions: {
|
|
317
|
+
filename: fileName,
|
|
318
|
+
},
|
|
281
319
|
});
|
|
320
|
+
let [parsed] = parsedComponents;
|
|
282
321
|
fileName = fileName.replace(fileExtensionsRegex, '');
|
|
283
322
|
parsed.fileNameWithExt = fileNameWithExt;
|
|
284
323
|
results[fileName] = parsed;
|
package/scripts/autogenerate.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable fp/no-mutating-methods */
|
|
2
1
|
require('./autogenHelpers/globals');
|
|
3
2
|
|
|
4
3
|
const fs = require('fs');
|
|
@@ -498,7 +497,7 @@ async function generate() {
|
|
|
498
497
|
});
|
|
499
498
|
|
|
500
499
|
// autogenerate expo plugin
|
|
501
|
-
execSync('yarn build:plugin');
|
|
500
|
+
execSync('yarn build:plugin', { stdio: 'inherit' });
|
|
502
501
|
outputPaths.push('plugin/build');
|
|
503
502
|
|
|
504
503
|
// autogenerate docs
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
const component = locals.component;
|
|
3
3
|
-%>
|
|
4
4
|
<!-- This file was autogenerated from <%- component.fileNameWithExt %> do not modify -->
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
# <MapboxGL.<%- component.name %> />
|
|
6
|
+
<%- component.description %>
|
|
7
7
|
|
|
8
8
|
<%_ if (component.props && component.props.length) { _%>
|
|
9
|
-
|
|
9
|
+
## props
|
|
10
10
|
| Prop | Type | Default | Required | Description |
|
|
11
11
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
12
12
|
<%- propMarkdownTableRows(component) %>
|
|
13
13
|
<%_ } _%>
|
|
14
14
|
|
|
15
15
|
<%_ if (component.methods && component.methods.length) { _%>
|
|
16
|
-
|
|
16
|
+
## methods
|
|
17
17
|
<%_ for (let method of component.methods) { _%>
|
|
18
|
-
|
|
18
|
+
### <%- getMarkdownMethodSignature(method) %>
|
|
19
19
|
|
|
20
20
|
<%- replaceNewLine(method.description) %>
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
#### arguments
|
|
23
23
|
| Name | Type | Required | Description |
|
|
24
24
|
| ---- | :--: | :------: | :----------: |
|
|
25
25
|
<%- methodMarkdownTableRow(method) %>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<%_ } _%>
|
|
30
30
|
|
|
31
31
|
<%_ if (component.styles && component.styles.length) { _%>
|
|
32
|
-
|
|
32
|
+
## styles
|
|
33
33
|
|
|
34
34
|
<%_ for (let i = 0; i < component.styles.length; i++) { _%>
|
|
35
35
|
<%
|
|
@@ -41,80 +41,80 @@ const style = component.styles[i];
|
|
|
41
41
|
<%_ for (let style of component.styles) { _%>
|
|
42
42
|
___
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
### <%- style.name %>
|
|
45
45
|
Name: `<%- style.name %>`
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
### Description
|
|
48
48
|
<%- style.description %>
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
### Type
|
|
51
51
|
`<%- style.type %>`
|
|
52
52
|
<%_ if (exists(style.default)) { _%>
|
|
53
|
-
|
|
53
|
+
### Default Value
|
|
54
54
|
`<%= getStyleDefaultValue(style) %>`
|
|
55
55
|
<%_ } _%>
|
|
56
56
|
|
|
57
57
|
<%_ if (style.type === 'enum') { _%>
|
|
58
|
-
|
|
58
|
+
### Supported Values
|
|
59
59
|
<%_ for (var i = 0; i < style.values.length; i++) { _%>
|
|
60
60
|
**<%- style.values[i].value %>** - <%- style.values[i].doc %><br />
|
|
61
61
|
<%_ } _%>
|
|
62
62
|
|
|
63
63
|
<%_ } _%>
|
|
64
64
|
<%_ if (exists(style.units)) { _%>
|
|
65
|
-
|
|
65
|
+
### Units
|
|
66
66
|
`<%- style.units %>`
|
|
67
67
|
|
|
68
68
|
<%_ } _%>
|
|
69
69
|
<%_ if (exists(style.minimum)) { _%>
|
|
70
|
-
|
|
70
|
+
### Minimum
|
|
71
71
|
`<%- style.minimum %>`
|
|
72
72
|
|
|
73
73
|
<%_ } _%>
|
|
74
74
|
|
|
75
75
|
<%_ if (exists(style.maximum)) { _%>
|
|
76
|
-
|
|
76
|
+
### Maximum
|
|
77
77
|
`<%- style.maximum %>`
|
|
78
78
|
|
|
79
79
|
<%_ } _%>
|
|
80
80
|
<%_ if (style.requires.length) { _%>
|
|
81
|
-
|
|
81
|
+
### Requires
|
|
82
82
|
`<%- style.requires.join(', ') %>`
|
|
83
83
|
|
|
84
84
|
<%_ } _%>
|
|
85
85
|
<%_ if (style.disabledBy.length) { _%>
|
|
86
|
-
|
|
86
|
+
### Disabled By
|
|
87
87
|
`<%- style.disabledBy.join(', ') %>`
|
|
88
88
|
|
|
89
89
|
<%_ } _%>
|
|
90
90
|
<%_ if (style.allowedFunctionTypes.length) { _%>
|
|
91
|
-
|
|
91
|
+
### Supported Style Functions
|
|
92
92
|
`<%- style.allowedFunctionTypes.join(', ') %>`
|
|
93
93
|
<%_ } _%>
|
|
94
94
|
<%_ if (style.expression) { _%>
|
|
95
|
-
|
|
95
|
+
### Expression
|
|
96
96
|
|
|
97
97
|
Parameters: `<%- (style.expression.parameters || []).join(', ') %>`
|
|
98
98
|
<%_ } _%>
|
|
99
99
|
<%_ if (style.transition) { _%>
|
|
100
100
|
___
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
### Name
|
|
103
103
|
|
|
104
104
|
`<%- style.name %>Transition`
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
### Description
|
|
107
107
|
|
|
108
|
-
The transition affecting any changes to this layer’s <%- style.name %>
|
|
108
|
+
The transition affecting any changes to this layer’s <%- style.name %> property.
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
### Type
|
|
111
111
|
|
|
112
112
|
`{ duration, delay }`
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
### Units
|
|
115
115
|
`milliseconds`
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
### Default Value
|
|
118
118
|
`{duration: 300, delay: 0}`
|
|
119
119
|
|
|
120
120
|
<%_ } %>
|