@rnmapbox/maps 10.0.0-beta.31 → 10.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -2
- package/.github/ISSUE_TEMPLATE/bug_report.yml +112 -0
- package/.husky/pre-commit +5 -0
- package/.nvmrc +1 -1
- package/README-v10.md +1 -1
- package/README.md +28 -23
- package/android/install.md +1 -1
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraStop.kt +27 -31
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +53 -48
- package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +5 -5
- package/docs/Annotation.md +8 -8
- package/docs/Annotations.md +14 -12
- package/docs/Atmosphere.md +76 -76
- package/docs/BackgroundLayer.md +44 -44
- package/docs/Callout.md +4 -4
- package/docs/Camera.md +124 -6
- package/docs/CircleLayer.md +129 -129
- package/docs/CustomHttpHeaders.md +15 -13
- package/docs/FillExtrusionLayer.md +120 -120
- package/docs/FillLayer.md +83 -83
- package/docs/HeadingIndicator.md +3 -3
- package/docs/HeatmapLayer.md +58 -58
- package/docs/ImageSource.md +4 -3
- package/docs/Images.md +3 -3
- package/docs/Light.md +45 -45
- package/docs/LineLayer.md +166 -166
- package/docs/Logger.md +8 -9
- package/docs/MapView.md +32 -32
- package/docs/MapboxGL.md +26 -27
- package/docs/MarkerView.md +11 -6
- package/docs/NativeUserLocation.md +3 -3
- package/docs/OfflineManager.md +35 -33
- package/docs/PointAnnotation.md +12 -6
- package/docs/RasterDemSource.md +3 -3
- package/docs/RasterLayer.md +99 -99
- package/docs/RasterSource.md +5 -3
- package/docs/ShapeSource.md +17 -16
- package/docs/SkyLayer.md +69 -69
- package/docs/Style.md +5 -3
- package/docs/StyleSheet.md +74 -278
- package/docs/SymbolLayer.md +454 -454
- package/docs/Terrain.md +6 -6
- package/docs/UserLocation.md +8 -8
- package/docs/VectorSource.md +9 -8
- package/docs/docs.json +196 -28
- package/docs/snapshotManager.md +7 -5
- package/index.d.ts +41 -26
- package/ios/RCTMGL-v10/CustomHttpHeaders.swift +39 -0
- package/ios/RCTMGL-v10/MGLModule.m +3 -0
- package/ios/RCTMGL-v10/MGLModule.swift +8 -0
- package/ios/RCTMGL-v10/RCTMGLCamera.swift +14 -5
- package/ios/RCTMGL-v10/RCTMGLMarkerView.swift +28 -14
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapper.swift +24 -0
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapperManager.m +8 -0
- package/ios/RCTMGL-v10/RCTMGLMarkerViewWrapperManager.swift +14 -0
- package/ios/RCTMGL-v10/RCTMGLOfflineModule.swift +10 -12
- package/javascript/{utils/animated → classes}/AnimatedCoordinatesArray.js +1 -1
- package/javascript/{utils/animated → classes}/AnimatedExtractCoordinateFromArray.js +3 -1
- package/javascript/{utils/animated → classes}/AnimatedPoint.js +0 -0
- package/javascript/{utils/animated → classes}/AnimatedRouteCoordinatesArray.js +3 -1
- package/javascript/{utils/animated → classes}/AnimatedShape.js +9 -3
- package/javascript/classes/index.d.ts +5 -0
- package/javascript/classes/index.js +5 -0
- package/javascript/components/Callout.js +1 -1
- package/javascript/components/Camera.tsx +5 -1
- package/javascript/components/Images.js +1 -1
- package/javascript/components/MapView.js +3 -4
- package/javascript/components/MarkerView.tsx +125 -0
- package/javascript/components/PointAnnotation.d.ts +13 -0
- package/javascript/components/RasterDemSource.js +1 -1
- package/javascript/components/RasterSource.js +1 -1
- package/javascript/components/ShapeSource.js +4 -4
- package/javascript/components/Style.js +1 -1
- package/javascript/components/annotations/Annotation.js +3 -3
- package/javascript/index.js +27 -14
- package/javascript/types/index.ts +14 -0
- package/javascript/utils/BridgeValue.ts +89 -0
- package/javascript/utils/StyleValue.ts +22 -10
- package/javascript/utils/animated/Animated.js +0 -11
- package/javascript/utils/deprecation.js +0 -1
- package/javascript/utils/geoUtils.d.ts +10 -0
- package/javascript/utils/index.d.ts +6 -0
- package/javascript/utils/{styleMap.js → styleMap.ts} +110 -354
- package/javascript/web/MapContext.ts +6 -0
- package/javascript/web/components/Camera.tsx +39 -0
- package/javascript/web/components/MapView.tsx +51 -0
- package/package.json +21 -20
- package/plugin/build/withMapbox.js +0 -2
- package/plugin/install.md +13 -6
- package/scripts/autogenHelpers/DocJSONBuilder.js +43 -4
- package/scripts/autogenHelpers/globals.js +0 -2
- package/scripts/autogenerate.js +3 -4
- package/scripts/templates/component.md.ejs +25 -25
- package/scripts/templates/{styleMap.js.ejs → styleMap.ts.ejs} +7 -4
- package/tsconfig.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -75
- package/javascript/components/MarkerView.js +0 -91
- package/javascript/utils/BridgeValue.js +0 -81
- package/javascript/utils/resolveAssetSource.d.ts +0 -5
- package/javascript/web/MapContext.js +0 -5
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Platform, NativeModules, requireNativeComponent } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { toJSONString, viewPropTypes } from '../utils';
|
|
6
|
-
import { makePoint } from '../utils/geoUtils';
|
|
7
|
-
|
|
8
|
-
import PointAnnotation from './PointAnnotation';
|
|
9
|
-
|
|
10
|
-
const MapboxGL = NativeModules.MGLModule;
|
|
11
|
-
|
|
12
|
-
export const NATIVE_MODULE_NAME = 'RCTMGLMarkerView';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* MarkerView allows you to place a interactive react native marker to the map.
|
|
16
|
-
*
|
|
17
|
-
* If you have static view consider using PointAnnotation or SymbolLayer they'll offer much better performance
|
|
18
|
-
* .
|
|
19
|
-
* This is based on [MakerView plugin](https://docs.mapbox.com/android/plugins/overview/markerview/) on Android
|
|
20
|
-
* and PointAnnotation on iOS.
|
|
21
|
-
*/
|
|
22
|
-
class MarkerView extends React.PureComponent {
|
|
23
|
-
static propTypes = {
|
|
24
|
-
...viewPropTypes,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The center point (specified as a map coordinate) of the marker.
|
|
28
|
-
* See also #anchor.
|
|
29
|
-
*/
|
|
30
|
-
coordinate: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Specifies the anchor being set on a particular point of the annotation.
|
|
34
|
-
* The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
|
|
35
|
-
* where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
|
|
36
|
-
* Note this is only for custom annotations not the default pin view.
|
|
37
|
-
* Defaults to the center of the view.
|
|
38
|
-
*/
|
|
39
|
-
anchor: PropTypes.shape({
|
|
40
|
-
/**
|
|
41
|
-
* `x` of anchor
|
|
42
|
-
*/
|
|
43
|
-
x: PropTypes.number.isRequired,
|
|
44
|
-
/**
|
|
45
|
-
* `y` of anchor
|
|
46
|
-
*/
|
|
47
|
-
y: PropTypes.number.isRequired,
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Expects one child - can be container with multiple elements
|
|
52
|
-
*/
|
|
53
|
-
children: PropTypes.element.isRequired,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
static defaultProps = {
|
|
57
|
-
anchor: { x: 0.5, y: 0.5 },
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
_getCoordinate() {
|
|
61
|
-
if (!this.props.coordinate) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
return toJSONString(makePoint(this.props.coordinate));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
render() {
|
|
68
|
-
if (Platform.OS === 'ios' && !MapboxGL.MapboxV10) {
|
|
69
|
-
return <PointAnnotation {...this.props} />;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const props = {
|
|
73
|
-
...this.props,
|
|
74
|
-
anchor: this.props.anchor,
|
|
75
|
-
coordinate: this._getCoordinate(),
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<RCTMGLMarkerView {...props}>{this.props.children}</RCTMGLMarkerView>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const RCTMGLMarkerView =
|
|
85
|
-
Platform.OS === 'android'
|
|
86
|
-
? requireNativeComponent(NATIVE_MODULE_NAME, MarkerView, {})
|
|
87
|
-
: MapboxGL.MapboxV10
|
|
88
|
-
? requireNativeComponent(NATIVE_MODULE_NAME, MarkerView, {})
|
|
89
|
-
: undefined;
|
|
90
|
-
|
|
91
|
-
export default MarkerView;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { isBoolean, isNumber, isString } from './index';
|
|
2
|
-
|
|
3
|
-
const Types = {
|
|
4
|
-
Array: 'array',
|
|
5
|
-
Bool: 'boolean',
|
|
6
|
-
Number: 'number',
|
|
7
|
-
String: 'string',
|
|
8
|
-
HashMap: 'hashmap',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default class BridgeValue {
|
|
12
|
-
constructor(rawValue) {
|
|
13
|
-
this.rawValue = rawValue;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get type() {
|
|
17
|
-
if (Array.isArray(this.rawValue)) {
|
|
18
|
-
return Types.Array;
|
|
19
|
-
}
|
|
20
|
-
if (isBoolean(this.rawValue)) {
|
|
21
|
-
return Types.Bool;
|
|
22
|
-
}
|
|
23
|
-
if (isNumber(this.rawValue)) {
|
|
24
|
-
return Types.Number;
|
|
25
|
-
}
|
|
26
|
-
if (isString(this.rawValue)) {
|
|
27
|
-
return Types.String;
|
|
28
|
-
}
|
|
29
|
-
if (this.rawValue && typeof this.rawValue === 'object') {
|
|
30
|
-
return Types.HashMap;
|
|
31
|
-
}
|
|
32
|
-
throw new Error(
|
|
33
|
-
`[type - ${this.rawValue}] BridgeValue must be a primitive/array/object`,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get value() {
|
|
38
|
-
const { type } = this;
|
|
39
|
-
|
|
40
|
-
let value;
|
|
41
|
-
|
|
42
|
-
if (type === Types.Array) {
|
|
43
|
-
value = [];
|
|
44
|
-
|
|
45
|
-
for (const innerRawValue of this.rawValue) {
|
|
46
|
-
const bridgeValue = new BridgeValue(innerRawValue);
|
|
47
|
-
value.push(bridgeValue.toJSON());
|
|
48
|
-
}
|
|
49
|
-
} else if (type === Types.HashMap) {
|
|
50
|
-
value = [];
|
|
51
|
-
|
|
52
|
-
const stringKeys = Object.keys(this.rawValue);
|
|
53
|
-
for (const stringKey of stringKeys) {
|
|
54
|
-
value.push([
|
|
55
|
-
new BridgeValue(stringKey).toJSON(),
|
|
56
|
-
new BridgeValue(this.rawValue[stringKey]).toJSON(),
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
} else if (
|
|
60
|
-
type === Types.Bool ||
|
|
61
|
-
type === Types.Number ||
|
|
62
|
-
type === Types.String
|
|
63
|
-
) {
|
|
64
|
-
value = this.rawValue;
|
|
65
|
-
} else {
|
|
66
|
-
throw new Error(
|
|
67
|
-
`[value - ${this.rawValue}] BridgeValue must be a primitive/array/object`,
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
toJSON(formatter) {
|
|
75
|
-
return {
|
|
76
|
-
type: this.type,
|
|
77
|
-
value:
|
|
78
|
-
typeof formatter === 'function' ? formatter(this.value) : this.value,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|