@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
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/* eslint react/prop-types:0 */
|
|
2
|
-
import {getFilter} from '../utils/filterUtils';
|
|
3
|
-
import {getStyleType} from '../utils/styleMap';
|
|
4
|
-
import BridgeValue from '../utils/BridgeValue';
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import {processColor} from 'react-native';
|
|
8
|
-
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
9
|
-
|
|
10
|
-
class AbstractLayer extends React.PureComponent {
|
|
11
|
-
get baseProps() {
|
|
12
|
-
return {
|
|
13
|
-
...this.props,
|
|
14
|
-
id: this.props.id,
|
|
15
|
-
sourceID: this.props.sourceID,
|
|
16
|
-
reactStyle: this.getStyle(),
|
|
17
|
-
minZoomLevel: this.props.minZoomLevel,
|
|
18
|
-
maxZoomLevel: this.props.maxZoomLevel,
|
|
19
|
-
aboveLayerID: this.props.aboveLayerID,
|
|
20
|
-
belowLayerID: this.props.belowLayerID,
|
|
21
|
-
layerIndex: this.props.layerIndex,
|
|
22
|
-
filter: getFilter(this.props.filter),
|
|
23
|
-
style: undefined,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getStyleTypeFormatter(styleType) {
|
|
28
|
-
if (styleType === 'color') {
|
|
29
|
-
return processColor;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
_getStyle(style) {
|
|
34
|
-
if (!style) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const nativeStyle = {};
|
|
39
|
-
const styleProps = Object.keys(style);
|
|
40
|
-
for (const styleProp of styleProps) {
|
|
41
|
-
const styleType = getStyleType(styleProp);
|
|
42
|
-
let rawStyle = style[styleProp];
|
|
43
|
-
|
|
44
|
-
if (styleType === 'color' && typeof rawStyle === 'string') {
|
|
45
|
-
rawStyle = processColor(rawStyle);
|
|
46
|
-
} else if (styleType === 'image' && typeof rawStyle === 'number') {
|
|
47
|
-
rawStyle = resolveAssetSource(rawStyle) || {};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const bridgeValue = new BridgeValue(rawStyle);
|
|
51
|
-
nativeStyle[styleProp] = {
|
|
52
|
-
styletype: styleType,
|
|
53
|
-
stylevalue: bridgeValue.toJSON(),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return nativeStyle;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getStyle() {
|
|
61
|
-
return this._getStyle(this.props.style);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
setNativeProps(props) {
|
|
65
|
-
if (this.refs.nativeLayer) {
|
|
66
|
-
let propsToPass = props;
|
|
67
|
-
if (props.style) {
|
|
68
|
-
propsToPass = {...props, reactStyle: this._getStyle(props.style)};
|
|
69
|
-
}
|
|
70
|
-
this.refs.nativeLayer.setNativeProps(propsToPass);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default AbstractLayer;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
class AbstractSource extends React.PureComponent {
|
|
4
|
-
setNativeProps(props) {
|
|
5
|
-
if (this._nativeRef) {
|
|
6
|
-
this._nativeRef.setNativeProps(props);
|
|
7
|
-
} else {
|
|
8
|
-
if (this.refs.nativeSource) {
|
|
9
|
-
this.refs.nativeSource.setNativeProps(props);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default AbstractSource;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {viewPropTypes} from '../utils';
|
|
2
|
-
import {BackgroundLayerStyleProp} from '../utils/styleMap';
|
|
3
|
-
|
|
4
|
-
import AbstractLayer from './AbstractLayer';
|
|
5
|
-
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
-
|
|
10
|
-
const MapLibreGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLBackgroundLayer';
|
|
13
|
-
|
|
14
|
-
class BackgroundLayer extends AbstractLayer {
|
|
15
|
-
static propTypes = {
|
|
16
|
-
...viewPropTypes,
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A string that uniquely identifies the source in the style to which it is added.
|
|
20
|
-
*/
|
|
21
|
-
id: PropTypes.string.isRequired,
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The source from which to obtain the data to style.
|
|
25
|
-
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
26
|
-
* Inferred from parent source only if the layer is a direct child to it.
|
|
27
|
-
*/
|
|
28
|
-
sourceID: PropTypes.string,
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
|
32
|
-
*/
|
|
33
|
-
sourceLayerID: PropTypes.string,
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Inserts a layer above aboveLayerID.
|
|
37
|
-
*/
|
|
38
|
-
aboveLayerID: PropTypes.string,
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Inserts a layer below belowLayerID
|
|
42
|
-
*/
|
|
43
|
-
belowLayerID: PropTypes.string,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Inserts a layer at a specified index
|
|
47
|
-
*/
|
|
48
|
-
layerIndex: PropTypes.number,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Filter only the features in the source layer that satisfy a condition that you define
|
|
52
|
-
*/
|
|
53
|
-
filter: PropTypes.array,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The minimum zoom level at which the layer gets parsed and appears.
|
|
57
|
-
*/
|
|
58
|
-
minZoomLevel: PropTypes.number,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The maximum zoom level at which the layer gets parsed and appears.
|
|
62
|
-
*/
|
|
63
|
-
maxZoomLevel: PropTypes.number,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Customizable style attributes
|
|
67
|
-
*/
|
|
68
|
-
style: PropTypes.oneOfType([
|
|
69
|
-
BackgroundLayerStyleProp,
|
|
70
|
-
PropTypes.arrayOf(BackgroundLayerStyleProp),
|
|
71
|
-
]),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
static defaultProps = {
|
|
75
|
-
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
render() {
|
|
79
|
-
return (
|
|
80
|
-
<RCTMGLBackgroundLayer
|
|
81
|
-
testID="rctmglBackgroundLayer"
|
|
82
|
-
ref="nativeLayer"
|
|
83
|
-
{...this.baseProps}
|
|
84
|
-
/>
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const RCTMGLBackgroundLayer = requireNativeComponent(
|
|
90
|
-
NATIVE_MODULE_NAME,
|
|
91
|
-
BackgroundLayer,
|
|
92
|
-
{
|
|
93
|
-
nativeOnly: {reactStyle: true},
|
|
94
|
-
},
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
export default BackgroundLayer;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import {viewPropTypes} from '../utils';
|
|
2
|
-
import {CircleLayerStyleProp} from '../utils/styleMap';
|
|
3
|
-
|
|
4
|
-
import AbstractLayer from './AbstractLayer';
|
|
5
|
-
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
-
|
|
10
|
-
const MapLibreGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLCircleLayer';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* CircleLayer is a style layer that renders one or more filled circles on the map.
|
|
16
|
-
*/
|
|
17
|
-
class CircleLayer extends AbstractLayer {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...viewPropTypes,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A string that uniquely identifies the source in the style to which it is added.
|
|
23
|
-
*/
|
|
24
|
-
id: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The source from which to obtain the data to style.
|
|
28
|
-
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
29
|
-
* Inferred from parent source only if the layer is a direct child to it.
|
|
30
|
-
*/
|
|
31
|
-
sourceID: PropTypes.string,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Identifier of the layer within the source identified by the sourceID property
|
|
35
|
-
* from which the receiver obtains the data to style.
|
|
36
|
-
*/
|
|
37
|
-
sourceLayerID: PropTypes.string,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Inserts a layer above aboveLayerID.
|
|
41
|
-
*/
|
|
42
|
-
aboveLayerID: PropTypes.string,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Inserts a layer below belowLayerID
|
|
46
|
-
*/
|
|
47
|
-
belowLayerID: PropTypes.string,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Inserts a layer at a specified index
|
|
51
|
-
*/
|
|
52
|
-
layerIndex: PropTypes.number,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Filter only the features in the source layer that satisfy a condition that you define
|
|
56
|
-
*/
|
|
57
|
-
filter: PropTypes.array,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The minimum zoom level at which the layer gets parsed and appears.
|
|
61
|
-
*/
|
|
62
|
-
minZoomLevel: PropTypes.number,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The maximum zoom level at which the layer gets parsed and appears.
|
|
66
|
-
*/
|
|
67
|
-
maxZoomLevel: PropTypes.number,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Customizable style attributes
|
|
71
|
-
*/
|
|
72
|
-
style: PropTypes.oneOfType([
|
|
73
|
-
CircleLayerStyleProp,
|
|
74
|
-
PropTypes.arrayOf(CircleLayerStyleProp),
|
|
75
|
-
]),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
static defaultProps = {
|
|
79
|
-
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
render() {
|
|
83
|
-
return (
|
|
84
|
-
<RCTMGLCircleLayer
|
|
85
|
-
testID="rctmglCircleLayer"
|
|
86
|
-
ref="nativeLayer"
|
|
87
|
-
{...this.baseProps}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const RCTMGLCircleLayer = requireNativeComponent(
|
|
94
|
-
NATIVE_MODULE_NAME,
|
|
95
|
-
CircleLayer,
|
|
96
|
-
{
|
|
97
|
-
nativeOnly: {reactStyle: true},
|
|
98
|
-
},
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
export default CircleLayer;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {viewPropTypes} from '../utils';
|
|
2
|
-
import {FillExtrusionLayerStyleProp} from '../utils/styleMap';
|
|
3
|
-
|
|
4
|
-
import AbstractLayer from './AbstractLayer';
|
|
5
|
-
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
-
|
|
10
|
-
const MapLibreGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLFillExtrusionLayer';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* FillExtrusionLayer is a style layer that renders one or more 3D extruded polygons on the map.
|
|
16
|
-
*/
|
|
17
|
-
class FillExtrusionLayer extends AbstractLayer {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...viewPropTypes,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A string that uniquely identifies the source in the style to which it is added.
|
|
23
|
-
*/
|
|
24
|
-
id: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The source from which to obtain the data to style.
|
|
28
|
-
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
29
|
-
* Inferred from parent source only if the layer is a direct child to it.
|
|
30
|
-
*/
|
|
31
|
-
sourceID: PropTypes.string,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
|
35
|
-
*/
|
|
36
|
-
sourceLayerID: PropTypes.string,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Inserts a layer above aboveLayerID.
|
|
40
|
-
*/
|
|
41
|
-
aboveLayerID: PropTypes.string,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Inserts a layer below belowLayerID
|
|
45
|
-
*/
|
|
46
|
-
belowLayerID: PropTypes.string,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Inserts a layer at a specified index
|
|
50
|
-
*/
|
|
51
|
-
layerIndex: PropTypes.number,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Filter only the features in the source layer that satisfy a condition that you define
|
|
55
|
-
*/
|
|
56
|
-
filter: PropTypes.array,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The minimum zoom level at which the layer gets parsed and appears.
|
|
60
|
-
*/
|
|
61
|
-
minZoomLevel: PropTypes.number,
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The maximum zoom level at which the layer gets parsed and appears.
|
|
65
|
-
*/
|
|
66
|
-
maxZoomLevel: PropTypes.number,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Customizable style attributes
|
|
70
|
-
*/
|
|
71
|
-
style: PropTypes.oneOfType([
|
|
72
|
-
FillExtrusionLayerStyleProp,
|
|
73
|
-
PropTypes.arrayOf(FillExtrusionLayerStyleProp),
|
|
74
|
-
]),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
static defaultProps = {
|
|
78
|
-
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
render() {
|
|
82
|
-
const props = {
|
|
83
|
-
...this.baseProps,
|
|
84
|
-
sourceLayerID: this.props.sourceLayerID,
|
|
85
|
-
};
|
|
86
|
-
return <RCTMGLFillExtrusionLayer ref="nativeLayer" {...props} />;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const RCTMGLFillExtrusionLayer = requireNativeComponent(
|
|
91
|
-
NATIVE_MODULE_NAME,
|
|
92
|
-
FillExtrusionLayer,
|
|
93
|
-
{
|
|
94
|
-
nativeOnly: {reactStyle: true},
|
|
95
|
-
},
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
export default FillExtrusionLayer;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {viewPropTypes} from '../utils';
|
|
2
|
-
import {FillLayerStyleProp} from '../utils/styleMap';
|
|
3
|
-
|
|
4
|
-
import AbstractLayer from './AbstractLayer';
|
|
5
|
-
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
-
|
|
10
|
-
const MapLibreGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLFillLayer';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* FillLayer is a style layer that renders one or more filled (and optionally stroked) polygons on the map.
|
|
16
|
-
*/
|
|
17
|
-
class FillLayer extends AbstractLayer {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...viewPropTypes,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A string that uniquely identifies the source in the style to which it is added.
|
|
23
|
-
*/
|
|
24
|
-
id: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The source from which to obtain the data to style.
|
|
28
|
-
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
29
|
-
* Inferred from parent source only if the layer is a direct child to it.
|
|
30
|
-
*/
|
|
31
|
-
sourceID: PropTypes.string,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
|
35
|
-
*/
|
|
36
|
-
sourceLayerID: PropTypes.string,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Inserts a layer above aboveLayerID.
|
|
40
|
-
*/
|
|
41
|
-
aboveLayerID: PropTypes.string,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Inserts a layer below belowLayerID
|
|
45
|
-
*/
|
|
46
|
-
belowLayerID: PropTypes.string,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Inserts a layer at a specified index
|
|
50
|
-
*/
|
|
51
|
-
layerIndex: PropTypes.number,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Filter only the features in the source layer that satisfy a condition that you define
|
|
55
|
-
*/
|
|
56
|
-
filter: PropTypes.array,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The minimum zoom level at which the layer gets parsed and appears.
|
|
60
|
-
*/
|
|
61
|
-
minZoomLevel: PropTypes.number,
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The maximum zoom level at which the layer gets parsed and appears.
|
|
65
|
-
*/
|
|
66
|
-
maxZoomLevel: PropTypes.number,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Customizable style attributes
|
|
70
|
-
*/
|
|
71
|
-
style: PropTypes.oneOfType([
|
|
72
|
-
FillLayerStyleProp,
|
|
73
|
-
PropTypes.arrayOf(FillLayerStyleProp),
|
|
74
|
-
]),
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
static defaultProps = {
|
|
78
|
-
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
render() {
|
|
82
|
-
const props = {
|
|
83
|
-
...this.baseProps,
|
|
84
|
-
sourceLayerID: this.props.sourceLayerID,
|
|
85
|
-
};
|
|
86
|
-
return <RCTMGLFillLayer ref="nativeLayer" {...props} />;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const RCTMGLFillLayer = requireNativeComponent(NATIVE_MODULE_NAME, FillLayer, {
|
|
91
|
-
nativeOnly: {reactStyle: true},
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
export default FillLayer;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {viewPropTypes} from '../utils';
|
|
2
|
-
import {HeatmapLayerStyleProp} from '../utils/styleMap';
|
|
3
|
-
|
|
4
|
-
import AbstractLayer from './AbstractLayer';
|
|
5
|
-
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
9
|
-
|
|
10
|
-
const MapLibreGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLHeatmapLayer';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* HeatmapLayer is a style layer that renders one or more filled circles on the map.
|
|
16
|
-
*/
|
|
17
|
-
class HeatmapLayer extends AbstractLayer {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
...viewPropTypes,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A string that uniquely identifies the source in the style to which it is added.
|
|
23
|
-
*/
|
|
24
|
-
id: PropTypes.string.isRequired,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The source from which to obtain the data to style.
|
|
28
|
-
* If the source has not yet been added to the current style, the behavior is undefined.
|
|
29
|
-
* Inferred from parent source only if the layer is a direct child to it.
|
|
30
|
-
*/
|
|
31
|
-
sourceID: PropTypes.string,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Identifier of the layer within the source identified by the sourceID property
|
|
35
|
-
* from which the receiver obtains the data to style.
|
|
36
|
-
*/
|
|
37
|
-
sourceLayerID: PropTypes.string,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Inserts a layer above aboveLayerID.
|
|
41
|
-
*/
|
|
42
|
-
aboveLayerID: PropTypes.string,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Inserts a layer below belowLayerID
|
|
46
|
-
*/
|
|
47
|
-
belowLayerID: PropTypes.string,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Inserts a layer at a specified index
|
|
51
|
-
*/
|
|
52
|
-
layerIndex: PropTypes.number,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Filter only the features in the source layer that satisfy a condition that you define
|
|
56
|
-
*/
|
|
57
|
-
filter: PropTypes.array,
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The minimum zoom level at which the layer gets parsed and appears.
|
|
61
|
-
*/
|
|
62
|
-
minZoomLevel: PropTypes.number,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The maximum zoom level at which the layer gets parsed and appears.
|
|
66
|
-
*/
|
|
67
|
-
maxZoomLevel: PropTypes.number,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Customizable style attributes
|
|
71
|
-
*/
|
|
72
|
-
style: PropTypes.oneOfType([
|
|
73
|
-
HeatmapLayerStyleProp,
|
|
74
|
-
PropTypes.arrayOf(HeatmapLayerStyleProp),
|
|
75
|
-
]),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
static defaultProps = {
|
|
79
|
-
sourceID: MapLibreGL.StyleSource.DefaultSourceID,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
render() {
|
|
83
|
-
const props = {
|
|
84
|
-
...this.baseProps,
|
|
85
|
-
sourceLayerID: this.props.sourceLayerID,
|
|
86
|
-
};
|
|
87
|
-
return <RCTMGLHeatmapLayer ref="nativeLayer" {...props} />;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const RCTMGLHeatmapLayer = requireNativeComponent(
|
|
92
|
-
NATIVE_MODULE_NAME,
|
|
93
|
-
HeatmapLayer,
|
|
94
|
-
{
|
|
95
|
-
nativeOnly: {reactStyle: true},
|
|
96
|
-
},
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
export default HeatmapLayer;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cloneReactChildrenWithProps,
|
|
3
|
-
viewPropTypes,
|
|
4
|
-
isNumber,
|
|
5
|
-
resolveImagePath,
|
|
6
|
-
} from '../utils';
|
|
7
|
-
|
|
8
|
-
import AbstractSource from './AbstractSource';
|
|
9
|
-
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import {requireNativeComponent} from 'react-native';
|
|
12
|
-
import React from 'react';
|
|
13
|
-
|
|
14
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLImageSource';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* ImageSource is a content source that is used for a georeferenced raster image to be shown on the map.
|
|
18
|
-
* The georeferenced image scales and rotates as the user zooms and rotates the map
|
|
19
|
-
*/
|
|
20
|
-
class ImageSource extends AbstractSource {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
...viewPropTypes,
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* A string that uniquely identifies the source.
|
|
26
|
-
*/
|
|
27
|
-
id: PropTypes.string.isRequired,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* An HTTP(S) URL, absolute file URL, or local file URL to the source image.
|
|
31
|
-
* Gifs are currently not supported.
|
|
32
|
-
*/
|
|
33
|
-
url: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The top left, top right, bottom right, and bottom left coordinates for the image.
|
|
37
|
-
*/
|
|
38
|
-
coordinates: PropTypes.arrayOf(
|
|
39
|
-
PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
40
|
-
).isRequired,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
_getURL() {
|
|
44
|
-
let {url} = this.props;
|
|
45
|
-
|
|
46
|
-
if (isNumber(this.props.url)) {
|
|
47
|
-
url = resolveImagePath(this.props.url);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return url;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
if (
|
|
55
|
-
!this.props.url ||
|
|
56
|
-
!this.props.coordinates ||
|
|
57
|
-
!this.props.coordinates.length
|
|
58
|
-
) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const props = {
|
|
63
|
-
...this.props,
|
|
64
|
-
url: this._getURL(),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<RCTMGLImageSource ref="nativeSource" {...props}>
|
|
69
|
-
{cloneReactChildrenWithProps(this.props.children, {
|
|
70
|
-
sourceID: this.props.id,
|
|
71
|
-
})}
|
|
72
|
-
</RCTMGLImageSource>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const RCTMGLImageSource = requireNativeComponent(
|
|
78
|
-
NATIVE_MODULE_NAME,
|
|
79
|
-
ImageSource,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
export default ImageSource;
|