@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
package/scripts/autogenerate.js
CHANGED
|
@@ -8,6 +8,7 @@ const ejs = require('ejs');
|
|
|
8
8
|
const {execSync} = require('child_process');
|
|
9
9
|
|
|
10
10
|
const prettier = require('prettier');
|
|
11
|
+
const prettierrc = require('../.prettierrc.js');
|
|
11
12
|
|
|
12
13
|
const styleSpecJSON = require('../style-spec/v8.json');
|
|
13
14
|
|
|
@@ -252,6 +253,9 @@ function isTranslate(attrName) {
|
|
|
252
253
|
|
|
253
254
|
function isAttrSupported(attr) {
|
|
254
255
|
const support = getAttributeSupport(attr['sdk-support']);
|
|
256
|
+
if (attr.private) {
|
|
257
|
+
return false
|
|
258
|
+
}
|
|
255
259
|
return support.basic.android && support.basic.ios;
|
|
256
260
|
}
|
|
257
261
|
|
|
@@ -321,9 +325,13 @@ async function generate() {
|
|
|
321
325
|
input: path.join(TMPL_PATH, 'RCTMGLStyle.h.ejs'),
|
|
322
326
|
output: path.join(IOS_OUTPUT_PATH, 'RCTMGLStyle.h'),
|
|
323
327
|
},
|
|
324
|
-
{
|
|
328
|
+
/*{
|
|
325
329
|
input: path.join(TMPL_PATH, 'index.d.ts.ejs'),
|
|
326
330
|
output: path.join(IOS_OUTPUT_PATH, 'index.d.ts'),
|
|
331
|
+
},*/
|
|
332
|
+
{
|
|
333
|
+
input: path.join(TMPL_PATH, 'MaplibreStyles.ts.ejs'),
|
|
334
|
+
output: path.join(JS_OUTPUT_PATH, 'MaplibreStyles.d.ts'),
|
|
327
335
|
},
|
|
328
336
|
{
|
|
329
337
|
input: path.join(TMPL_PATH, 'RCTMGLStyle.m.ejs'),
|
|
@@ -334,23 +342,23 @@ async function generate() {
|
|
|
334
342
|
output: path.join(ANDROID_OUTPUT_PATH, 'RCTMGLStyleFactory.java'),
|
|
335
343
|
},
|
|
336
344
|
{
|
|
337
|
-
input: path.join(TMPL_PATH, 'styleMap.
|
|
338
|
-
output: path.join(JS_OUTPUT_PATH, 'styleMap.
|
|
345
|
+
input: path.join(TMPL_PATH, 'styleMap.ts.ejs'),
|
|
346
|
+
output: path.join(JS_OUTPUT_PATH, 'styleMap.ts'),
|
|
339
347
|
},
|
|
340
348
|
];
|
|
341
349
|
const outputPaths = templateMappings.map(m => m.output);
|
|
342
350
|
|
|
343
351
|
// autogenerate code
|
|
344
|
-
templateMappings.
|
|
352
|
+
await Promise.all(templateMappings.map(async ({input, output}) => {
|
|
345
353
|
const filename = output.split('/').pop();
|
|
346
354
|
console.log(`Generating ${filename}`);
|
|
347
355
|
const tmpl = ejs.compile(fs.readFileSync(input, 'utf8'), {strict: true});
|
|
348
356
|
let results = tmpl({layers});
|
|
349
357
|
if (filename.endsWith('ts')) {
|
|
350
|
-
results = prettier.format(results, {filepath: filename});
|
|
358
|
+
results = await prettier.format(results, { ...prettierrc, filepath: filename});
|
|
351
359
|
}
|
|
352
360
|
fs.writeFileSync(output, results);
|
|
353
|
-
});
|
|
361
|
+
}));
|
|
354
362
|
|
|
355
363
|
// autogenerate docs
|
|
356
364
|
const docBuilder = new DocJSONBuilder(layers);
|
|
@@ -11,5 +11,5 @@ if [ -e "./${FILENAME}" ]; then
|
|
|
11
11
|
fi
|
|
12
12
|
|
|
13
13
|
echo "Fetching new style spec ${FILENAME}"
|
|
14
|
-
curl -sS https://raw.githubusercontent.com/maplibre/maplibre-
|
|
14
|
+
curl -sS https://raw.githubusercontent.com/maplibre/maplibre-style-spec/main/src/reference/${FILENAME} -o ${FILENAME}
|
|
15
15
|
cd ..
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const layers = locals.layers;
|
|
3
|
+
-%>
|
|
4
|
+
/* This file was generated from MapboxStyle.ts.ejs do not modify */
|
|
5
|
+
import { type ImageSourcePropType } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export type Translation = { x: number; y: number } | [number, number];
|
|
8
|
+
|
|
9
|
+
export interface Transition {
|
|
10
|
+
duration: number;
|
|
11
|
+
delay: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type FormattedString = string; /* TODO */
|
|
15
|
+
|
|
16
|
+
type ExpressionName =
|
|
17
|
+
// Types
|
|
18
|
+
| 'array' | 'boolean' | 'collator' | 'format' | 'image' | 'literal' | 'number' | 'number-format' | 'object' | 'string'
|
|
19
|
+
| 'to-boolean' | 'to-color' | 'to-number' | 'to-string' | 'typeof'
|
|
20
|
+
// Feature data
|
|
21
|
+
| 'accumulated' | 'feature-state' | 'geometry-type' | 'id' | 'line-progress' | 'properties'
|
|
22
|
+
// Lookup
|
|
23
|
+
| 'at' | 'get' | 'has' | 'in' | 'index-of' | 'length' | 'slice'
|
|
24
|
+
// Decision
|
|
25
|
+
| '!' | '!=' | '<' | '<=' | '==' | '>' | '>=' | 'all' | 'any' | 'case' | 'match' | 'coalesce' | 'within'
|
|
26
|
+
// Ramps, scales, curves
|
|
27
|
+
| 'interpolate' | 'interpolate-hcl' | 'interpolate-lab' | 'step'
|
|
28
|
+
// Variable binding
|
|
29
|
+
| 'let' | 'var'
|
|
30
|
+
// String
|
|
31
|
+
| 'concat' | 'downcase' | 'is-supported-script' | 'resolved-locale' | 'upcase'
|
|
32
|
+
// Color
|
|
33
|
+
| 'rgb' | 'rgba' | 'to-rgba'
|
|
34
|
+
// Math
|
|
35
|
+
| '-' | '*' | '/' | '%' | '^' | '+' | 'abs' | 'acos' | 'asin' | 'atan' | 'ceil' | 'cos' | 'distance' | 'e'
|
|
36
|
+
| 'floor' | 'ln' | 'ln2' | 'log10' | 'log2' | 'max' | 'min' | 'pi' | 'round' | 'sin' | 'sqrt' | 'tan'
|
|
37
|
+
// Zoom, Heatmap
|
|
38
|
+
| 'zoom' | 'heatmap-density';
|
|
39
|
+
|
|
40
|
+
type ExpressionField =
|
|
41
|
+
| string
|
|
42
|
+
| number
|
|
43
|
+
| boolean
|
|
44
|
+
| Expression
|
|
45
|
+
| ExpressionField[]
|
|
46
|
+
| { [key: string]: ExpressionField };
|
|
47
|
+
|
|
48
|
+
export type Expression = readonly [ExpressionName, ...ExpressionField[]];
|
|
49
|
+
|
|
50
|
+
export type FilterExpression = Expression;
|
|
51
|
+
|
|
52
|
+
type ExpressionParameters = 'zoom' | 'feature' | 'feature-state' | 'sky-radial-progress' | 'line-progress' | 'heatmap-density';
|
|
53
|
+
|
|
54
|
+
type ResolvedImageType = ImageSourcePropType | string;
|
|
55
|
+
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
|
+
export type Value<T, AllowedParameters extends ExpressionParameters[] = []> =
|
|
58
|
+
| T
|
|
59
|
+
| Expression;
|
|
60
|
+
|
|
61
|
+
<%_ for (let enumInfo of getEnums(layers)) { _%>
|
|
62
|
+
enum <%- pascelCase(enumInfo.name) %>Enum {
|
|
63
|
+
<%_ for (let k of Object.keys(enumInfo.values)) { _%>
|
|
64
|
+
/** <%- enumInfo.values[k].doc %> */
|
|
65
|
+
<%- pascelCase(k) %> = '<%- k %>',
|
|
66
|
+
<%_ } _%>
|
|
67
|
+
}
|
|
68
|
+
type <%- pascelCase(enumInfo.name) %>EnumValues = <%- Object.keys(enumInfo.values).map(k => `'${k}'`).join(' | ') %>;
|
|
69
|
+
<%_ } _%>
|
|
70
|
+
|
|
71
|
+
type Enum<EnumType, EnumValues> = EnumType | EnumValues;
|
|
72
|
+
|
|
73
|
+
<%_ for (let layer of layers) { _%>
|
|
74
|
+
export interface <%- pascelCase(layer.name) %>LayerStyleProps {
|
|
75
|
+
<%_ for (let prop of layer.properties) { _%>
|
|
76
|
+
/**
|
|
77
|
+
* <%- prop.doc.description %>
|
|
78
|
+
<%_ if (prop.doc.requires.length) { _%>
|
|
79
|
+
*
|
|
80
|
+
* @requires <%- prop.doc.requires.join(', ') %>
|
|
81
|
+
<%_ } _%>
|
|
82
|
+
<%_ if (prop.doc.disabledBy.length) { _%>
|
|
83
|
+
*
|
|
84
|
+
* @disabledBy <%- prop.doc.disabledBy.join(', ') %>
|
|
85
|
+
<%_ } _%>
|
|
86
|
+
*/
|
|
87
|
+
<%= prop.name %>?: <%- dtsInterfaceType(prop) %>
|
|
88
|
+
<%_ if (true && prop.transition) { %>
|
|
89
|
+
/**
|
|
90
|
+
* The transition affecting any changes to this layer’s <%= prop.name %> property.
|
|
91
|
+
*/
|
|
92
|
+
<%= prop.name %>Transition?: Transition,
|
|
93
|
+
<%_ } _%>
|
|
94
|
+
<%_ } _%>
|
|
95
|
+
|
|
96
|
+
};
|
|
97
|
+
<%_ } _%>
|
|
98
|
+
|
|
99
|
+
export type AllLayerStyleProps = <%- layers.map(l => `${pascelCase(l.name)}LayerStyleProps`).join("|") -%>;
|
|
@@ -1,56 +1,85 @@
|
|
|
1
1
|
<%
|
|
2
2
|
const layers = locals.layers;
|
|
3
3
|
-%>
|
|
4
|
-
/* eslint-disable */
|
|
5
4
|
// DO NOT MODIFY
|
|
6
5
|
// THIS FILE IS AUTOGENERATED
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { isAndroid } from './index';
|
|
8
|
+
|
|
9
|
+
export const StyleTypes = {
|
|
10
|
+
Constant: 'constant',
|
|
11
|
+
Color: 'color',
|
|
12
|
+
Transition: 'transition',
|
|
13
|
+
Translation: 'translation',
|
|
14
|
+
Function: 'function',
|
|
15
|
+
Image: 'image',
|
|
16
|
+
Enum: 'enum',
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface TransitionProps {
|
|
26
|
-
duration: number
|
|
27
|
-
delay: number,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type TranslationProps = { x: number, y: number } | number[]
|
|
31
|
-
|
|
32
|
-
<%_ for (let layer of layers) { _%>
|
|
33
|
-
export interface <%- camelCase(layer.name) _%>LayerStyleProps {
|
|
34
|
-
<%_ for (let prop of layer.properties) { %>
|
|
35
|
-
/**
|
|
36
|
-
* <%- prop.doc.description %>
|
|
37
|
-
<%_ if (prop.doc.requires.length) { _%>
|
|
38
|
-
*
|
|
39
|
-
* @requires <%- prop.doc.requires.join(', ') %>
|
|
19
|
+
const styleMap = {
|
|
20
|
+
<%_ for (let layer of layers) { _%>
|
|
21
|
+
<%_ for (let prop of layer.properties) { _%>
|
|
22
|
+
<%_ if (!['color', 'colorTransition', 'visibility'].includes(prop.name)) { _%>
|
|
23
|
+
<%= prop.name %>: <%- jsStyleType(prop) %>,
|
|
24
|
+
<%_ if (prop.transition) { _%>
|
|
25
|
+
<%= prop.name %>Transition: StyleTypes.Transition,
|
|
40
26
|
<%_ } _%>
|
|
41
|
-
<%_ if (prop.doc.disabledBy.length) { _%>
|
|
42
|
-
*
|
|
43
|
-
* @disabledBy <%- prop.doc.disabledBy.join(', ') %>
|
|
44
27
|
<%_ } _%>
|
|
45
|
-
*/
|
|
46
|
-
<%= prop.name %>: <%- dtsInterfaceType(prop) %>
|
|
47
|
-
<%_ if (prop.transition) { %>
|
|
48
|
-
/**
|
|
49
|
-
* The transition affecting any changes to this layer’s <%= prop.name %> property.
|
|
50
|
-
*/
|
|
51
|
-
<%= prop.name %>Transition: TransitionProps,
|
|
52
28
|
<%_ } _%>
|
|
29
|
+
|
|
53
30
|
<%_ } _%>
|
|
31
|
+
|
|
32
|
+
color: StyleTypes.Color,
|
|
33
|
+
colorTransition: StyleTypes.Transition,
|
|
34
|
+
visibility: StyleTypes.Constant,
|
|
54
35
|
};
|
|
55
36
|
|
|
56
|
-
|
|
37
|
+
export const styleExtras = {
|
|
38
|
+
// padding
|
|
39
|
+
iconTextFitPadding: {
|
|
40
|
+
iosType: 'edgeinsets',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// offsets
|
|
44
|
+
iconOffset: {
|
|
45
|
+
iosType: 'vector',
|
|
46
|
+
},
|
|
47
|
+
textOffset: {
|
|
48
|
+
iosType: 'vector',
|
|
49
|
+
},
|
|
50
|
+
lineOffset: {
|
|
51
|
+
iosType: 'vector',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// translates
|
|
55
|
+
fillTranslate: {
|
|
56
|
+
iosType: 'vector',
|
|
57
|
+
},
|
|
58
|
+
lineTranslate: {
|
|
59
|
+
iosType: 'vector',
|
|
60
|
+
},
|
|
61
|
+
iconTranslate: {
|
|
62
|
+
iosType: 'vector',
|
|
63
|
+
},
|
|
64
|
+
textTranslate: {
|
|
65
|
+
iosType: 'vector',
|
|
66
|
+
},
|
|
67
|
+
circleTranslate: {
|
|
68
|
+
iosType: 'vector',
|
|
69
|
+
},
|
|
70
|
+
fillExtrusionTranslate: {
|
|
71
|
+
iosType: 'vector',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export function getStyleType(styleProp: keyof typeof styleExtras) {
|
|
76
|
+
if (!isAndroid() && styleExtras[styleProp]) {
|
|
77
|
+
return styleExtras[styleProp].iosType;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (styleMap[styleProp]) {
|
|
81
|
+
return styleMap[styleProp];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
throw new Error(`${styleProp} is not a valid Mapbox layer style`);
|
|
85
|
+
}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
// DO NOT MODIFY
|
|
6
6
|
// THIS FILE IS AUTOGENERATED
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { IS_ANDROID } from './index';
|
|
8
|
+
import { isAndroid } from './index';
|
|
10
9
|
|
|
11
10
|
export const StyleTypes = {
|
|
12
11
|
Constant: 'constant',
|
|
@@ -18,8 +17,8 @@ export const StyleTypes = {
|
|
|
18
17
|
Enum: 'enum',
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
export function getStyleType(styleProp) {
|
|
22
|
-
if (!
|
|
20
|
+
export function getStyleType(styleProp: keyof typeof styleExtras): string {
|
|
21
|
+
if (!isAndroid() && styleExtras[styleProp]) {
|
|
23
22
|
return styleExtras[styleProp].iosType;
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -30,35 +29,6 @@ export function getStyleType(styleProp) {
|
|
|
30
29
|
throw new Error(`${styleProp} is not a valid MapLibre layer style`);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
<%_ for (let layer of layers) { _%>
|
|
34
|
-
export const <%- pascelCase(layer.name) _%>LayerStyleProp = PropTypes.shape({
|
|
35
|
-
<%_ for (let prop of layer.properties) { %>
|
|
36
|
-
/**
|
|
37
|
-
* <%- prop.doc.description %>
|
|
38
|
-
<%_ if (prop.doc.requires.length) { _%>
|
|
39
|
-
*
|
|
40
|
-
* @requires <%- prop.doc.requires.join(', ') %>
|
|
41
|
-
<%_ } _%>
|
|
42
|
-
<%_ if (prop.doc.disabledBy.length) { _%>
|
|
43
|
-
*
|
|
44
|
-
* @disabledBy <%- prop.doc.disabledBy.join(', ') %>
|
|
45
|
-
<%_ } _%>
|
|
46
|
-
*/
|
|
47
|
-
<%= prop.name %>: <%- jsDocReactProp(prop) %>,
|
|
48
|
-
<%_ if (prop.transition) { %>
|
|
49
|
-
/**
|
|
50
|
-
* The transition affecting any changes to this layer’s <%= prop.name %> property.
|
|
51
|
-
*/
|
|
52
|
-
<%= prop.name %>Transition: PropTypes.shape({
|
|
53
|
-
duration: PropTypes.number,
|
|
54
|
-
delay: PropTypes.number,
|
|
55
|
-
}),
|
|
56
|
-
<%_ } _%>
|
|
57
|
-
<%_ } _%>
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
<%_ } _%>
|
|
61
|
-
|
|
62
32
|
const styleMap = {
|
|
63
33
|
<%_ for (let layer of layers) { _%>
|
|
64
34
|
<%_ for (let prop of layer.properties) { _%>
|
package/setup-jest.js
CHANGED
|
@@ -15,16 +15,7 @@ NativeModules.MGLModule = {
|
|
|
15
15
|
'FollowWithCourse',
|
|
16
16
|
'FollowWithHeading',
|
|
17
17
|
]),
|
|
18
|
-
StyleURL: keyMirror([
|
|
19
|
-
'Street',
|
|
20
|
-
'Dark',
|
|
21
|
-
'Light',
|
|
22
|
-
'Outdoors',
|
|
23
|
-
'Satellite',
|
|
24
|
-
'SatelliteStreet',
|
|
25
|
-
'TrafficDay',
|
|
26
|
-
'TrafficNight',
|
|
27
|
-
]),
|
|
18
|
+
StyleURL: keyMirror(['Default']),
|
|
28
19
|
EventTypes: keyMirror([
|
|
29
20
|
'MapClick',
|
|
30
21
|
'MapLongClick',
|
package/tsconfig.json
CHANGED
|
@@ -1,65 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"jsx": "react-native",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
20
|
-
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
21
|
-
|
|
22
|
-
/* Strict Type-Checking Options */
|
|
23
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
24
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
25
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
26
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
27
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
28
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
29
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
30
|
-
|
|
31
|
-
/* Additional Checks */
|
|
32
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
33
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
34
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
35
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
36
|
-
|
|
37
|
-
/* Module Resolution Options */
|
|
38
|
-
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
39
|
-
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
40
|
-
"paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
41
|
-
"@maplibre/maplibre-react-native": ["../index.d.ts"],
|
|
42
|
-
"react": ["./node_modules/@types/react"],
|
|
43
|
-
"react-native": ["./node_modules/@types/react-native"],
|
|
44
|
-
},
|
|
45
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
46
|
-
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
47
|
-
// "types": [], /* Type declaration files to be included in compilation. */
|
|
48
|
-
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
49
|
-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
50
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
51
|
-
|
|
52
|
-
/* Source Map Options */
|
|
53
|
-
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
54
|
-
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
55
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
56
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
57
|
-
|
|
58
|
-
/* Experimental Options */
|
|
59
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
60
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"preserveSymlinks": true,
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"module": "es6",
|
|
7
|
+
"lib": ["es6"],
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"jsx": "react-native",
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"types": ["node", "react-native", "geojson"],
|
|
14
|
+
"moduleResolution": "node",
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noImplicitReturns": true,
|
|
61
19
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
]
|
|
20
|
+
"include": [
|
|
21
|
+
"javascript/**/*", "index.ts"
|
|
22
|
+
],
|
|
65
23
|
}
|
|
24
|
+
|