@rnmapbox/maps 10.0.0-beta.64 → 10.0.0-beta.66

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 (90) hide show
  1. package/android/rctmgl/.settings/org.eclipse.buildship.core.prefs +12 -1
  2. package/android/rctmgl/src/main/java-mapboxgl/common/com/mapbox/rctmgl/modules/RCTMGLLocationModule.java +5 -0
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCamera.kt +1 -1
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTMGLVectorSource.java +3 -6
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/modules/RCTMGLLocationModule.kt +5 -0
  6. package/index.d.ts +37 -166
  7. package/ios/RCTMGL-v10/RCTMGLCamera.swift +113 -0
  8. package/ios/RCTMGL-v10/RCTMGLLocationModule.m +1 -0
  9. package/ios/RCTMGL-v10/RCTMGLLocationModule.swift +12 -3
  10. package/ios/RCTMGL-v10/RCTMGLLogging.swift +13 -0
  11. package/ios/RCTMGL-v10/RCTMGLMarkerView.swift +87 -55
  12. package/ios/RCTMGL-v10/RCTMGLOfflineModule.swift +184 -66
  13. package/ios/RCTMGL-v10/RCTMGLStyleValue.swift +8 -1
  14. package/javascript/components/BackgroundLayer.tsx +91 -0
  15. package/javascript/components/CircleLayer.tsx +97 -0
  16. package/javascript/components/FillExtrusionLayer.tsx +95 -0
  17. package/javascript/components/FillLayer.tsx +91 -0
  18. package/javascript/components/HeatmapLayer.tsx +96 -0
  19. package/javascript/components/NativeUserLocation.tsx +33 -0
  20. package/javascript/components/RasterLayer.tsx +88 -0
  21. package/javascript/components/SkyLayer.tsx +70 -0
  22. package/javascript/components/UserLocation.js +11 -0
  23. package/javascript/modules/location/locationManager.js +23 -2
  24. package/javascript/modules/offline/offlineManager.js +1 -1
  25. package/lib/commonjs/components/BackgroundLayer.js +6 -55
  26. package/lib/commonjs/components/BackgroundLayer.js.map +1 -1
  27. package/lib/commonjs/components/CircleLayer.js +8 -58
  28. package/lib/commonjs/components/CircleLayer.js.map +1 -1
  29. package/lib/commonjs/components/FillExtrusionLayer.js +3 -55
  30. package/lib/commonjs/components/FillExtrusionLayer.js.map +1 -1
  31. package/lib/commonjs/components/FillLayer.js +2 -55
  32. package/lib/commonjs/components/FillLayer.js.map +1 -1
  33. package/lib/commonjs/components/HeatmapLayer.js +3 -56
  34. package/lib/commonjs/components/HeatmapLayer.js.map +1 -1
  35. package/lib/commonjs/components/NativeUserLocation.js +6 -31
  36. package/lib/commonjs/components/NativeUserLocation.js.map +1 -1
  37. package/lib/commonjs/components/RasterLayer.js +1 -53
  38. package/lib/commonjs/components/RasterLayer.js.map +1 -1
  39. package/lib/commonjs/components/SkyLayer.js +2 -43
  40. package/lib/commonjs/components/SkyLayer.js.map +1 -1
  41. package/lib/commonjs/components/UserLocation.js +10 -0
  42. package/lib/commonjs/components/UserLocation.js.map +1 -1
  43. package/lib/commonjs/modules/location/locationManager.js +16 -1
  44. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  45. package/lib/commonjs/modules/offline/offlineManager.js +1 -1
  46. package/lib/module/components/BackgroundLayer.js +6 -55
  47. package/lib/module/components/BackgroundLayer.js.map +1 -1
  48. package/lib/module/components/CircleLayer.js +7 -57
  49. package/lib/module/components/CircleLayer.js.map +1 -1
  50. package/lib/module/components/FillExtrusionLayer.js +2 -54
  51. package/lib/module/components/FillExtrusionLayer.js.map +1 -1
  52. package/lib/module/components/FillLayer.js +1 -54
  53. package/lib/module/components/FillLayer.js.map +1 -1
  54. package/lib/module/components/HeatmapLayer.js +2 -55
  55. package/lib/module/components/HeatmapLayer.js.map +1 -1
  56. package/lib/module/components/NativeUserLocation.js +4 -30
  57. package/lib/module/components/NativeUserLocation.js.map +1 -1
  58. package/lib/module/components/RasterLayer.js +1 -53
  59. package/lib/module/components/RasterLayer.js.map +1 -1
  60. package/lib/module/components/SkyLayer.js +1 -42
  61. package/lib/module/components/SkyLayer.js.map +1 -1
  62. package/lib/module/components/UserLocation.js +10 -0
  63. package/lib/module/components/UserLocation.js.map +1 -1
  64. package/lib/module/modules/location/locationManager.js +17 -2
  65. package/lib/module/modules/location/locationManager.js.map +1 -1
  66. package/lib/module/modules/offline/offlineManager.js +1 -1
  67. package/lib/typescript/components/BackgroundLayer.d.ts +62 -0
  68. package/lib/typescript/components/BackgroundLayer.d.ts.map +1 -0
  69. package/lib/typescript/components/CircleLayer.d.ts +66 -0
  70. package/lib/typescript/components/CircleLayer.d.ts.map +1 -0
  71. package/lib/typescript/components/FillExtrusionLayer.d.ts +65 -0
  72. package/lib/typescript/components/FillExtrusionLayer.d.ts.map +1 -0
  73. package/{javascript/components/FillLayer.js → lib/typescript/components/FillLayer.d.ts} +28 -57
  74. package/lib/typescript/components/FillLayer.d.ts.map +1 -0
  75. package/lib/typescript/components/HeatmapLayer.d.ts +66 -0
  76. package/lib/typescript/components/HeatmapLayer.d.ts.map +1 -0
  77. package/lib/typescript/components/NativeUserLocation.d.ts +22 -0
  78. package/lib/typescript/components/NativeUserLocation.d.ts.map +1 -0
  79. package/lib/typescript/components/RasterLayer.d.ts +62 -0
  80. package/lib/typescript/components/RasterLayer.d.ts.map +1 -0
  81. package/lib/typescript/components/SkyLayer.d.ts +52 -0
  82. package/lib/typescript/components/SkyLayer.d.ts.map +1 -0
  83. package/package.json +1 -1
  84. package/javascript/components/BackgroundLayer.js +0 -97
  85. package/javascript/components/CircleLayer.js +0 -101
  86. package/javascript/components/FillExtrusionLayer.js +0 -98
  87. package/javascript/components/HeatmapLayer.js +0 -99
  88. package/javascript/components/NativeUserLocation.js +0 -41
  89. package/javascript/components/RasterLayer.js +0 -95
  90. package/javascript/components/SkyLayer.js +0 -80
@@ -0,0 +1,97 @@
1
+ import React from 'react';
2
+ import {
3
+ HostComponent,
4
+ NativeModules,
5
+ requireNativeComponent,
6
+ } from 'react-native';
7
+
8
+ import { FilterExpression, CircleLayerStyleProps } from '../utils/MapboxStyles';
9
+ import { StyleValue } from '../utils/StyleValue';
10
+
11
+ import AbstractLayer from './AbstractLayer';
12
+
13
+ const MapboxGL = NativeModules.MGLModule;
14
+
15
+ export type Props = {
16
+ /**
17
+ * A string that uniquely identifies the source in the style to which it is added.
18
+ */
19
+ id: string;
20
+
21
+ /**
22
+ * The source from which to obtain the data to style.
23
+ * If the source has not yet been added to the current style, the behavior is undefined.
24
+ * Inferred from parent source only if the layer is a direct child to it.
25
+ */
26
+ sourceID?: string;
27
+
28
+ /**
29
+ * Identifier of the layer within the source identified by the sourceID property
30
+ * from which the receiver obtains the data to style.
31
+ */
32
+ sourceLayerID?: string;
33
+
34
+ /**
35
+ * Inserts a layer above aboveLayerID.
36
+ */
37
+ aboveLayerID?: string;
38
+
39
+ /**
40
+ * Inserts a layer below belowLayerID
41
+ */
42
+ belowLayerID?: string;
43
+
44
+ /**
45
+ * Inserts a layer at a specified index
46
+ */
47
+ layerIndex?: number;
48
+
49
+ /**
50
+ * Filter only the features in the source layer that satisfy a condition that you define
51
+ */
52
+ filter?: FilterExpression;
53
+
54
+ /**
55
+ * The minimum zoom level at which the layer gets parsed and appears.
56
+ */
57
+ minZoomLevel?: number;
58
+
59
+ /**
60
+ * The maximum zoom level at which the layer gets parsed and appears.
61
+ */
62
+ maxZoomLevel?: number;
63
+
64
+ /**
65
+ * Customizable style attributes
66
+ */
67
+ style?: CircleLayerStyleProps;
68
+ } & React.ComponentProps<typeof AbstractLayer>;
69
+
70
+ export const NATIVE_MODULE_NAME = 'RCTMGLCircleLayer';
71
+
72
+ type NativeTypeProps = Omit<Props, 'style'> & {
73
+ reactStyle?: { [key: string]: StyleValue };
74
+ };
75
+
76
+ /**
77
+ * CircleLayer is a style layer that renders one or more filled circles on the map.
78
+ */
79
+ class CircleLayer extends AbstractLayer<Props, NativeTypeProps> {
80
+ static defaultProps = {
81
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
82
+ };
83
+
84
+ render() {
85
+ const props = {
86
+ ...this.props,
87
+ ...this.baseProps,
88
+ sourceLayerID: this.props.sourceLayerID,
89
+ };
90
+ return <RCTMGLCircleLayer ref={this.setNativeLayer} {...props} />;
91
+ }
92
+ }
93
+
94
+ const RCTMGLCircleLayer: HostComponent<Props> =
95
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
96
+
97
+ export default CircleLayer;
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { NativeModules, requireNativeComponent } from 'react-native';
3
+
4
+ import {
5
+ FilterExpression,
6
+ FillExtrusionLayerStyleProps,
7
+ } from '../utils/MapboxStyles';
8
+ import { StyleValue } from '../utils/StyleValue';
9
+
10
+ import AbstractLayer from './AbstractLayer';
11
+
12
+ const MapboxGL = NativeModules.MGLModule;
13
+
14
+ export const NATIVE_MODULE_NAME = 'RCTMGLFillExtrusionLayer';
15
+
16
+ export type Props = {
17
+ /**
18
+ * A string that uniquely identifies the source in the style to which it is added.
19
+ */
20
+ id: string;
21
+
22
+ /**
23
+ * The source from which to obtain the data to style.
24
+ * If the source has not yet been added to the current style, the behavior is undefined.
25
+ * Inferred from parent source only if the layer is a direct child to it.
26
+ */
27
+ sourceID?: string;
28
+
29
+ /**
30
+ * Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
31
+ */
32
+ sourceLayerID?: string;
33
+
34
+ /**
35
+ * Inserts a layer above aboveLayerID.
36
+ */
37
+ aboveLayerID?: string;
38
+
39
+ /**
40
+ * Inserts a layer below belowLayerID
41
+ */
42
+ belowLayerID?: string;
43
+
44
+ /**
45
+ * Inserts a layer at a specified index
46
+ */
47
+ layerIndex?: number;
48
+
49
+ /**
50
+ * Filter only the features in the source layer that satisfy a condition that you define
51
+ */
52
+ filter?: FilterExpression;
53
+
54
+ /**
55
+ * The minimum zoom level at which the layer gets parsed and appears.
56
+ */
57
+ minZoomLevel: number;
58
+
59
+ /**
60
+ * The maximum zoom level at which the layer gets parsed and appears.
61
+ */
62
+ maxZoomLevel: number;
63
+
64
+ /**
65
+ * Customizable style attributes
66
+ */
67
+ style?: FillExtrusionLayerStyleProps;
68
+ } & React.ComponentProps<typeof AbstractLayer>;
69
+
70
+ type NativeTypeProps = Omit<Props, 'style'> & {
71
+ reactStyle?: { [key: string]: StyleValue };
72
+ };
73
+
74
+ /**
75
+ * FillExtrusionLayer is a style layer that renders one or more 3D extruded polygons on the map.
76
+ */
77
+ class FillExtrusionLayer extends AbstractLayer<Props, NativeTypeProps> {
78
+ static defaultProps = {
79
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
80
+ };
81
+
82
+ render() {
83
+ const props = {
84
+ ...this.props,
85
+ ...this.baseProps,
86
+ sourceLayerID: this.props.sourceLayerID,
87
+ };
88
+ return <RCTMGLFillExtrusionLayer ref={this.setNativeLayer} {...props} />;
89
+ }
90
+ }
91
+
92
+ const RCTMGLFillExtrusionLayer =
93
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
94
+
95
+ export default FillExtrusionLayer;
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import { NativeModules, requireNativeComponent } from 'react-native';
3
+
4
+ import { FilterExpression, FillLayerStyleProps } from '../utils/MapboxStyles';
5
+ import { StyleValue } from '../utils/StyleValue';
6
+
7
+ import AbstractLayer from './AbstractLayer';
8
+
9
+ const MapboxGL = NativeModules.MGLModule;
10
+
11
+ export const NATIVE_MODULE_NAME = 'RCTMGLFillLayer';
12
+
13
+ export type Props = {
14
+ /**
15
+ * A string that uniquely identifies the source in the style to which it is added.
16
+ */
17
+ id: string;
18
+
19
+ /**
20
+ * The source from which to obtain the data to style.
21
+ * If the source has not yet been added to the current style, the behavior is undefined.
22
+ * Inferred from parent source only if the layer is a direct child to it.
23
+ */
24
+ sourceID?: string;
25
+
26
+ /**
27
+ * Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
28
+ */
29
+ sourceLayerID?: string;
30
+
31
+ /**
32
+ * Inserts a layer above aboveLayerID.
33
+ */
34
+ aboveLayerID?: string;
35
+
36
+ /**
37
+ * Inserts a layer below belowLayerID
38
+ */
39
+ belowLayerID?: string;
40
+
41
+ /**
42
+ * Inserts a layer at a specified index
43
+ */
44
+ layerIndex?: number;
45
+
46
+ /**
47
+ * Filter only the features in the source layer that satisfy a condition that you define
48
+ */
49
+ filter?: FilterExpression;
50
+
51
+ /**
52
+ * The minimum zoom level at which the layer gets parsed and appears.
53
+ */
54
+ minZoomLevel?: number;
55
+
56
+ /**
57
+ * The maximum zoom level at which the layer gets parsed and appears.
58
+ */
59
+ maxZoomLevel?: number;
60
+
61
+ /**
62
+ * Customizable style attributes
63
+ */
64
+ style?: FillLayerStyleProps;
65
+ } & React.ComponentProps<typeof AbstractLayer>;
66
+
67
+ type NativeTypeProps = Omit<Props, 'style'> & {
68
+ reactStyle?: { [key: string]: StyleValue };
69
+ };
70
+
71
+ /**
72
+ * FillLayer is a style layer that renders one or more filled (and optionally stroked) polygons on the map.
73
+ */
74
+ class FillLayer extends AbstractLayer<Props, NativeTypeProps> {
75
+ static defaultProps = {
76
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
77
+ };
78
+
79
+ render() {
80
+ const props = {
81
+ ...this.baseProps,
82
+ sourceLayerID: this.props.sourceLayerID,
83
+ };
84
+ return <RCTMGLFillLayer ref={this.setNativeLayer} {...props} />;
85
+ }
86
+ }
87
+
88
+ const RCTMGLFillLayer =
89
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
90
+
91
+ export default FillLayer;
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import { NativeModules, requireNativeComponent } from 'react-native';
3
+
4
+ import {
5
+ FilterExpression,
6
+ HeatmapLayerStyleProps,
7
+ } from '../utils/MapboxStyles';
8
+ import { StyleValue } from '../utils/StyleValue';
9
+
10
+ import AbstractLayer from './AbstractLayer';
11
+
12
+ const MapboxGL = NativeModules.MGLModule;
13
+
14
+ export const NATIVE_MODULE_NAME = 'RCTMGLHeatmapLayer';
15
+
16
+ export type Props = {
17
+ /**
18
+ * A string that uniquely identifies the source in the style to which it is added.
19
+ */
20
+ id: string;
21
+
22
+ /**
23
+ * The source from which to obtain the data to style.
24
+ * If the source has not yet been added to the current style, the behavior is undefined.
25
+ * Inferred from parent source only if the layer is a direct child to it.
26
+ */
27
+ sourceID?: string;
28
+
29
+ /**
30
+ * Identifier of the layer within the source identified by the sourceID property
31
+ * from which the receiver obtains the data to style.
32
+ */
33
+ sourceLayerID?: string;
34
+
35
+ /**
36
+ * Inserts a layer above aboveLayerID.
37
+ */
38
+ aboveLayerID?: string;
39
+
40
+ /**
41
+ * Inserts a layer below belowLayerID
42
+ */
43
+ belowLayerID?: string;
44
+
45
+ /**
46
+ * Inserts a layer at a specified index
47
+ */
48
+ layerIndex?: number;
49
+
50
+ /**
51
+ * Filter only the features in the source layer that satisfy a condition that you define
52
+ */
53
+ filter?: FilterExpression;
54
+
55
+ /**
56
+ * The minimum zoom level at which the layer gets parsed and appears.
57
+ */
58
+ minZoomLevel?: number;
59
+
60
+ /**
61
+ * The maximum zoom level at which the layer gets parsed and appears.
62
+ */
63
+ maxZoomLevel?: number;
64
+
65
+ /**
66
+ * Customizable style attributes
67
+ */
68
+ style?: HeatmapLayerStyleProps;
69
+ } & React.ComponentProps<typeof AbstractLayer>;
70
+
71
+ type NativeTypeProps = Omit<Props, 'style'> & {
72
+ reactStyle?: { [key: string]: StyleValue };
73
+ };
74
+
75
+ /**
76
+ * HeatmapLayer is a style layer that renders one or more filled circles on the map.
77
+ */
78
+ class HeatmapLayer extends AbstractLayer<Props, NativeTypeProps> {
79
+ static defaultProps = {
80
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
81
+ };
82
+
83
+ render() {
84
+ const props = {
85
+ ...this.props,
86
+ ...this.baseProps,
87
+ sourceLayerID: this.props.sourceLayerID,
88
+ };
89
+ return <RCTMGLHeatmapLayer ref={this.setNativeLayer} {...props} />;
90
+ }
91
+ }
92
+
93
+ const RCTMGLHeatmapLayer =
94
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
95
+
96
+ export default HeatmapLayer;
@@ -0,0 +1,33 @@
1
+ import React, { memo } from 'react';
2
+ import { HostComponent, requireNativeComponent } from 'react-native';
3
+
4
+ const NATIVE_MODULE_NAME = 'RCTMGLNativeUserLocation';
5
+
6
+ export type Props = {
7
+ /**
8
+ * Android render mode.
9
+ *
10
+ * - normal: just a circle
11
+ * - compass: triangle with heading
12
+ * - gps: large arrow
13
+ *
14
+ * @platform android
15
+ */
16
+ androidRenderMode?: 'normal' | 'compass' | 'gps';
17
+
18
+ /**
19
+ * iOS only. A Boolean value indicating whether the user location annotation may display a permanent heading indicator.
20
+ *
21
+ * @platform ios
22
+ */
23
+ iosShowsUserHeadingIndicator?: boolean;
24
+ };
25
+
26
+ const RCTMGLNativeUserLocation: HostComponent<Props> =
27
+ requireNativeComponent(NATIVE_MODULE_NAME);
28
+
29
+ const NativeUserLocation = memo((props: Props) => {
30
+ return <RCTMGLNativeUserLocation {...props} />;
31
+ });
32
+
33
+ export default NativeUserLocation;
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import { NativeModules, requireNativeComponent } from 'react-native';
3
+
4
+ import { FilterExpression, RasterLayerStyleProps } from '../utils/MapboxStyles';
5
+ import { StyleValue } from '../utils/StyleValue';
6
+
7
+ import AbstractLayer from './AbstractLayer';
8
+
9
+ const MapboxGL = NativeModules.MGLModule;
10
+
11
+ export const NATIVE_MODULE_NAME = 'RCTMGLRasterLayer';
12
+
13
+ export type Props = {
14
+ /**
15
+ * A string that uniquely identifies the source in the style to which it is added.
16
+ */
17
+ id: string;
18
+
19
+ /**
20
+ * The source from which to obtain the data to style.
21
+ * If the source has not yet been added to the current style, the behavior is undefined.
22
+ * Inferred from parent source only if the layer is a direct child to it.
23
+ */
24
+ sourceID?: string;
25
+
26
+ /**
27
+ * Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
28
+ */
29
+ sourceLayerID?: string;
30
+
31
+ /**
32
+ * Inserts a layer above aboveLayerID.
33
+ */
34
+ aboveLayerID?: string;
35
+
36
+ /**
37
+ * Inserts a layer below belowLayerID
38
+ */
39
+ belowLayerID?: string;
40
+
41
+ /**
42
+ * Inserts a layer at a specified index
43
+ */
44
+ layerIndex?: number;
45
+
46
+ /**
47
+ * Filter only the features in the source layer that satisfy a condition that you define
48
+ */
49
+ filter?: FilterExpression;
50
+
51
+ /**
52
+ * The minimum zoom level at which the layer gets parsed and appears.
53
+ */
54
+ minZoomLevel?: number;
55
+
56
+ /**
57
+ * The maximum zoom level at which the layer gets parsed and appears.
58
+ */
59
+ maxZoomLevel?: number;
60
+
61
+ /**
62
+ * Customizable style attributes
63
+ */
64
+ style: RasterLayerStyleProps;
65
+ } & React.ComponentProps<typeof AbstractLayer>;
66
+
67
+ type NativeTypeProps = Omit<Props, 'style'> & {
68
+ reactStyle?: { [key: string]: StyleValue };
69
+ };
70
+
71
+ class RasterLayer extends AbstractLayer<Props, NativeTypeProps> {
72
+ static defaultProps = {
73
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
74
+ };
75
+
76
+ render() {
77
+ const props = {
78
+ ...this.baseProps,
79
+ sourceLayerID: this.props.sourceLayerID,
80
+ };
81
+ return <RCTMGLRasterLayer ref={this.setNativeLayer} {...props} />;
82
+ }
83
+ }
84
+
85
+ const RCTMGLRasterLayer =
86
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
87
+
88
+ export default RasterLayer;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { NativeModules, requireNativeComponent } from 'react-native';
3
+
4
+ import { FilterExpression, SkyLayerStyleProps } from '../utils/MapboxStyles';
5
+ import { StyleValue } from '../utils/StyleValue';
6
+
7
+ import AbstractLayer from './AbstractLayer';
8
+
9
+ const MapboxGL = NativeModules.MGLModule;
10
+
11
+ export const NATIVE_MODULE_NAME = 'RCTMGLSkyLayer';
12
+
13
+ export type Props = {
14
+ /**
15
+ * A string that uniquely identifies the source in the style to which it is added.
16
+ */
17
+ id: string;
18
+
19
+ /**
20
+ * The source from which to obtain the data to style.
21
+ * If the source has not yet been added to the current style, the behavior is undefined.
22
+ */
23
+ sourceID?: string;
24
+
25
+ /**
26
+ * Inserts a layer above aboveLayerID.
27
+ */
28
+ aboveLayerID?: string;
29
+
30
+ /**
31
+ * Inserts a layer below belowLayerID
32
+ */
33
+ belowLayerID?: string;
34
+
35
+ /**
36
+ * Inserts a layer at a specified index
37
+ */
38
+ layerIndex?: number;
39
+
40
+ /**
41
+ * Filter only the features in the source layer that satisfy a condition that you define
42
+ */
43
+ filter?: FilterExpression;
44
+
45
+ /**
46
+ * Customizable style attributes
47
+ */
48
+ style?: SkyLayerStyleProps;
49
+ } & React.ComponentProps<typeof AbstractLayer>;
50
+
51
+ type NativeTypeProps = Omit<Props, 'style'> & {
52
+ reactStyle?: { [key: string]: StyleValue };
53
+ };
54
+ /**
55
+ * SkyLayer is a spherical dome around the map that is always rendered behind all other layers
56
+ */
57
+ class SkyLayer extends AbstractLayer<Props, NativeTypeProps> {
58
+ static defaultProps = {
59
+ sourceID: MapboxGL.StyleSource.DefaultSourceID,
60
+ };
61
+
62
+ render() {
63
+ return <RCTMGLSkyLayer ref={this.setNativeLayer} {...this.baseProps} />;
64
+ }
65
+ }
66
+
67
+ const RCTMGLSkyLayer =
68
+ requireNativeComponent<NativeTypeProps>(NATIVE_MODULE_NAME);
69
+
70
+ export default SkyLayer;
@@ -97,6 +97,13 @@ class UserLocation extends React.Component {
97
97
  */
98
98
  showsUserHeadingIndicator: PropTypes.bool,
99
99
 
100
+ /**
101
+ * Request the always location permission, and listen to the location even when the app is in background
102
+ *
103
+ * @platform ios
104
+ */
105
+ requestsAlwaysUse: PropTypes.bool,
106
+
100
107
  /**
101
108
  * Minimum amount of movement before GPS location is updated in meters
102
109
  */
@@ -112,6 +119,7 @@ class UserLocation extends React.Component {
112
119
  animated: true,
113
120
  visible: true,
114
121
  showsUserHeadingIndicator: false,
122
+ requestsAlwaysUse: false,
115
123
  minDisplacement: 0,
116
124
  renderMode: 'normal',
117
125
  };
@@ -161,6 +169,9 @@ class UserLocation extends React.Component {
161
169
  if (this.props.minDisplacement !== prevProps.minDisplacement) {
162
170
  locationManager.setMinDisplacement(this.props.minDisplacement);
163
171
  }
172
+ if (this.props.requestsAlwaysUse !== prevProps.requestsAlwaysUse) {
173
+ locationManager.setRequestsAlwaysUse(this.props.requestsAlwaysUse);
174
+ }
164
175
  }
165
176
 
166
177
  async componentWillUnmount() {
@@ -1,4 +1,4 @@
1
- import { NativeModules, NativeEventEmitter } from 'react-native';
1
+ import { NativeModules, NativeEventEmitter, AppState } from 'react-native';
2
2
 
3
3
  const MapboxGL = NativeModules.MGLModule;
4
4
  const MapboxGLLocationManager = NativeModules.MGLLocationModule;
@@ -12,8 +12,14 @@ class LocationManager {
12
12
  this._listeners = [];
13
13
  this._lastKnownLocation = null;
14
14
  this._isListening = false;
15
+ this._requestsAlwaysUse = false;
15
16
  this.onUpdate = this.onUpdate.bind(this);
16
17
  this.subscription = null;
18
+
19
+ this._appStateListener = AppState.addEventListener(
20
+ 'change',
21
+ this._handleAppStateChange.bind(this),
22
+ );
17
23
  }
18
24
 
19
25
  async getLastKnownLocation() {
@@ -28,7 +34,7 @@ class LocationManager {
28
34
  lastKnownLocation =
29
35
  await MapboxGLLocationManager.getLastKnownLocation();
30
36
  } catch (error) {
31
- console.log('locationManager Error: ', error);
37
+ console.warn('locationManager Error: ', error);
32
38
  }
33
39
 
34
40
  if (!this._lastKnownLocation && lastKnownLocation) {
@@ -64,6 +70,16 @@ class LocationManager {
64
70
  this.stop();
65
71
  }
66
72
 
73
+ _handleAppStateChange(appState) {
74
+ if (!this._requestsAlwaysUse) {
75
+ if (appState === 'background') {
76
+ this.stop();
77
+ } else if (appState === 'active') {
78
+ this.start();
79
+ }
80
+ }
81
+ }
82
+
67
83
  start(displacement = -1) {
68
84
  if (
69
85
  displacement === -1 ||
@@ -103,6 +119,11 @@ class LocationManager {
103
119
  MapboxGLLocationManager.setMinDisplacement(minDisplacement);
104
120
  }
105
121
 
122
+ setRequestsAlwaysUse(requestsAlwaysUse) {
123
+ MapboxGLLocationManager.setRequestsAlwaysUse(requestsAlwaysUse);
124
+ this._requestsAlwaysUse = requestsAlwaysUse;
125
+ }
126
+
106
127
  onUpdate(location) {
107
128
  this._lastKnownLocation = location;
108
129
 
@@ -247,7 +247,7 @@ class OfflineManager {
247
247
 
248
248
  /**
249
249
  * Sets the period at which download status events will be sent over the React Native bridge.
250
- * The default is 500ms.
250
+ * The default is 300ms.
251
251
  *
252
252
  * @example
253
253
  * MapboxGL.offlineManager.setProgressEventThrottle(500);