@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.
Files changed (146) hide show
  1. package/.eslintrc.js +10 -2
  2. package/.husky/pre-commit +5 -0
  3. package/.yarn/plugins/@yarnpkg/plugin-typescript.cjs +9 -0
  4. package/.yarn/sdks/eslint/bin/eslint.js +20 -0
  5. package/.yarn/sdks/eslint/lib/api.js +20 -0
  6. package/.yarn/sdks/eslint/package.json +6 -0
  7. package/.yarn/sdks/integrations.yml +5 -0
  8. package/.yarn/sdks/prettier/index.js +20 -0
  9. package/.yarn/sdks/prettier/package.json +6 -0
  10. package/.yarn/sdks/typescript/bin/tsc +20 -0
  11. package/.yarn/sdks/typescript/bin/tsserver +20 -0
  12. package/.yarn/sdks/typescript/lib/tsc.js +20 -0
  13. package/.yarn/sdks/typescript/lib/tsserver.js +225 -0
  14. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +225 -0
  15. package/.yarn/sdks/typescript/lib/typescript.js +20 -0
  16. package/.yarn/sdks/typescript/package.json +6 -0
  17. package/CHANGELOG.md +15 -1
  18. package/android/build.gradle +2 -2
  19. package/android/rctmgl/build.gradle +2 -4
  20. package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSource.java +14 -0
  21. package/android/rctmgl/src/main/java/com/mapbox/rctmgl/components/styles/sources/RCTMGLShapeSourceManager.java +26 -0
  22. package/android/rctmgl/src/main/java/com/mapbox/rctmgl/utils/ClusterPropertyEntry.java +13 -0
  23. package/docs/Annotation.md +8 -9
  24. package/docs/BackgroundLayer.md +2 -10
  25. package/docs/Callout.md +5 -5
  26. package/docs/Camera.md +18 -47
  27. package/docs/CircleLayer.md +2 -10
  28. package/docs/FillExtrusionLayer.md +2 -10
  29. package/docs/FillLayer.md +2 -10
  30. package/docs/HeatmapLayer.md +2 -10
  31. package/docs/ImageSource.md +3 -2
  32. package/docs/Images.md +5 -3
  33. package/docs/Light.md +1 -1
  34. package/docs/LineLayer.md +2 -10
  35. package/docs/MapView.md +53 -37
  36. package/docs/MarkerView.md +4 -2
  37. package/docs/NativeUserLocation.md +2 -2
  38. package/docs/PointAnnotation.md +5 -8
  39. package/docs/RasterLayer.md +2 -10
  40. package/docs/RasterSource.md +3 -2
  41. package/docs/ShapeSource.md +12 -6
  42. package/docs/Style.md +1 -1
  43. package/docs/SymbolLayer.md +3 -10
  44. package/docs/UserLocation.md +8 -10
  45. package/docs/VectorSource.md +6 -5
  46. package/docs/coordinates.md +6 -0
  47. package/docs/docs.json +561 -1308
  48. package/docs/location.md +6 -0
  49. package/docs/snapshotManager.md +3 -3
  50. package/ios/RCTMGL/RCTMGLShapeSource.h +1 -0
  51. package/ios/RCTMGL/RCTMGLShapeSource.m +14 -0
  52. package/ios/RCTMGL/RCTMGLShapeSourceManager.m +1 -0
  53. package/ios/RCTMGL.xcodeproj/project.pbxproj +1 -0
  54. package/javascript/@types/assets.d.ts +4 -0
  55. package/javascript/MGLModule.ts +37 -0
  56. package/javascript/Maplibre.ts +65 -0
  57. package/javascript/components/AbstractLayer.tsx +107 -0
  58. package/javascript/components/AbstractSource.tsx +27 -0
  59. package/javascript/components/BackgroundLayer.tsx +43 -0
  60. package/javascript/components/{Callout.js → Callout.tsx} +67 -65
  61. package/javascript/components/{Camera.js → Camera.tsx} +266 -251
  62. package/javascript/components/CircleLayer.tsx +46 -0
  63. package/javascript/components/FillExtrusionLayer.tsx +47 -0
  64. package/javascript/components/FillLayer.tsx +41 -0
  65. package/javascript/components/{HeadingIndicator.js → HeadingIndicator.tsx} +8 -8
  66. package/javascript/components/HeatmapLayer.tsx +44 -0
  67. package/javascript/components/ImageSource.tsx +78 -0
  68. package/javascript/components/Images.tsx +134 -0
  69. package/javascript/components/Light.tsx +67 -0
  70. package/javascript/components/LineLayer.tsx +42 -0
  71. package/javascript/components/{MapView.js → MapView.tsx} +365 -354
  72. package/javascript/components/MarkerView.tsx +104 -0
  73. package/javascript/components/{NativeBridgeComponent.js → NativeBridgeComponent.tsx} +44 -13
  74. package/javascript/components/NativeUserLocation.tsx +33 -0
  75. package/javascript/components/PointAnnotation.tsx +221 -0
  76. package/javascript/components/RasterLayer.tsx +41 -0
  77. package/javascript/components/RasterSource.tsx +117 -0
  78. package/javascript/components/ShapeSource.tsx +383 -0
  79. package/javascript/components/{Style.js → Style.tsx} +132 -38
  80. package/javascript/components/SymbolLayer.tsx +72 -0
  81. package/javascript/components/{UserLocation.js → UserLocation.tsx} +111 -110
  82. package/javascript/components/VectorSource.tsx +207 -0
  83. package/javascript/components/annotations/Annotation.tsx +134 -0
  84. package/javascript/index.ts +4 -0
  85. package/javascript/modules/location/{locationManager.js → locationManager.ts} +71 -10
  86. package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +20 -4
  87. package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +23 -7
  88. package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +81 -24
  89. package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +43 -6
  90. package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +5 -5
  91. package/javascript/requestAndroidLocationPermissions.ts +29 -0
  92. package/javascript/types/BaseProps.ts +5 -0
  93. package/javascript/types/OnPressEvent.ts +13 -0
  94. package/javascript/types/index.ts +7 -0
  95. package/javascript/utils/BridgeValue.ts +90 -0
  96. package/javascript/utils/{Logger.js → Logger.ts} +37 -18
  97. package/javascript/utils/MaplibreStyles.d.ts +1486 -0
  98. package/javascript/utils/StyleValue.ts +49 -0
  99. package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +134 -0
  100. package/javascript/utils/animated/AnimatedCoordinatesArray.ts +112 -0
  101. package/javascript/utils/animated/{AnimatedExtractCoordinateFromArray.js → AnimatedExtractCoordinateFromArray.ts} +5 -5
  102. package/javascript/utils/animated/{AnimatedPoint.js → AnimatedPoint.ts} +20 -12
  103. package/javascript/utils/animated/{AnimatedRouteCoordinatesArray.js → AnimatedRouteCoordinatesArray.ts} +39 -14
  104. package/javascript/utils/animated/{AnimatedShape.js → AnimatedShape.ts} +31 -10
  105. package/javascript/utils/{deprecation.js → deprecation.ts} +9 -6
  106. package/javascript/utils/filterUtils.ts +9 -0
  107. package/javascript/utils/geoUtils.ts +79 -0
  108. package/javascript/utils/{index.js → index.ts} +44 -24
  109. package/javascript/utils/styleMap.ts +264 -0
  110. package/package.json +43 -34
  111. package/plugin/build/withMapLibre.js +3 -2
  112. package/scripts/autogenHelpers/globals.js +1 -1
  113. package/scripts/autogenerate.js +14 -6
  114. package/scripts/templates/MaplibreStyles.ts.ejs +99 -0
  115. package/scripts/templates/index.d.ts.ejs +71 -42
  116. package/scripts/templates/{styleMap.js.ejs → styleMap.ts.ejs} +3 -33
  117. package/setup-jest.js +3 -10
  118. package/tsconfig.json +20 -61
  119. package/index.d.ts +0 -954
  120. package/javascript/components/AbstractLayer.js +0 -75
  121. package/javascript/components/AbstractSource.js +0 -15
  122. package/javascript/components/BackgroundLayer.js +0 -97
  123. package/javascript/components/CircleLayer.js +0 -101
  124. package/javascript/components/FillExtrusionLayer.js +0 -98
  125. package/javascript/components/FillLayer.js +0 -94
  126. package/javascript/components/HeatmapLayer.js +0 -99
  127. package/javascript/components/ImageSource.js +0 -82
  128. package/javascript/components/Images.js +0 -119
  129. package/javascript/components/Light.js +0 -47
  130. package/javascript/components/LineLayer.js +0 -94
  131. package/javascript/components/MarkerView.js +0 -87
  132. package/javascript/components/NativeUserLocation.js +0 -41
  133. package/javascript/components/PointAnnotation.js +0 -216
  134. package/javascript/components/RasterLayer.js +0 -95
  135. package/javascript/components/RasterSource.js +0 -124
  136. package/javascript/components/ShapeSource.js +0 -357
  137. package/javascript/components/SymbolLayer.js +0 -120
  138. package/javascript/components/VectorSource.js +0 -200
  139. package/javascript/components/annotations/Annotation.js +0 -122
  140. package/javascript/index.js +0 -149
  141. package/javascript/utils/BridgeValue.js +0 -81
  142. package/javascript/utils/animated/AnimatedCoordinatesArray.js +0 -191
  143. package/javascript/utils/filterUtils.js +0 -7
  144. package/javascript/utils/geoUtils.js +0 -73
  145. package/javascript/utils/styleMap.js +0 -1932
  146. /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
@@ -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.js.ejs'),
338
- output: path.join(JS_OUTPUT_PATH, 'styleMap.js'),
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.forEach(({input, output}) => {
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);
@@ -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
- export interface ConstantProps {
9
- styletype: string
10
- payload: {
11
- value: any,
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
- export interface StyleFunctionProps {
16
- styletype: string
17
- payload: {
18
- fn: string,
19
- attributeName: string,
20
- stops: any[],
21
- mode: any,
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 PropTypes from 'prop-types';
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 (!IS_ANDROID && styleExtras[styleProp]) {
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',
@@ -110,7 +101,9 @@ NativeModules.MGLSnapshotModule = {
110
101
 
111
102
  NativeModules.MGLLocationModule = {
112
103
  getLastKnownLocation: jest.fn(),
104
+ setMinDisplacement: jest.fn(),
113
105
  start: jest.fn(),
106
+ stop: jest.fn(),
114
107
  pause: jest.fn(),
115
108
  };
116
109
 
package/tsconfig.json CHANGED
@@ -1,65 +1,24 @@
1
1
  {
2
2
  "compilerOptions": {
3
- /* Basic Options */
4
- "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
5
- "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6
- "lib": ["es6"], /* Specify library files to be included in the compilation. */
7
- "allowJs": true, /* Allow javascript files to be compiled. */
8
- // "checkJs": true, /* Report errors in .js files. */
9
- "jsx": "react-native", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10
- // "declaration": true, /* Generates corresponding '.d.ts' file. */
11
- // "sourceMap": true, /* Generates corresponding '.map' file. */
12
- // "outFile": "./", /* Concatenate and emit output to single file. */
13
- // "outDir": "./", /* Redirect output structure to the directory. */
14
- // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
15
- // "removeComments": true, /* Do not emit comments to output. */
16
- "noEmit": true, /* Do not emit outputs. */
17
- // "incremental": true, /* Enable incremental compilation */
18
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
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
- "exclude": [
63
- "node_modules", "babel.config.js", "metro.config.js", "jest.config.js"
64
- ]
20
+ "include": [
21
+ "javascript/**/*", "index.ts"
22
+ ],
65
23
  }
24
+