@rnmapbox/maps 10.0.0-beta.39 → 10.0.0-beta.41

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 (53) hide show
  1. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/AbstractMapFeature.kt +10 -0
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraUpdateItem.kt +135 -0
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraUpdateQueue.kt +68 -0
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCamera.kt +498 -0
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCameraManager.kt +114 -0
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/UserLocation.java +1 -1
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/UserTrackingMode.java +1 -1
  8. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/sources/RCTSource.kt +14 -9
  9. package/docs/Annotation.md +1 -1
  10. package/docs/Atmosphere.md +1 -1
  11. package/docs/BackgroundLayer.md +1 -1
  12. package/docs/Callout.md +1 -1
  13. package/docs/Camera.md +1 -1
  14. package/docs/CircleLayer.md +1 -1
  15. package/docs/FillExtrusionLayer.md +1 -1
  16. package/docs/FillLayer.md +1 -1
  17. package/docs/HeadingIndicator.md +1 -1
  18. package/docs/HeatmapLayer.md +1 -1
  19. package/docs/ImageSource.md +1 -1
  20. package/docs/Images.md +1 -1
  21. package/docs/Light.md +1 -1
  22. package/docs/LineLayer.md +1 -1
  23. package/docs/MapView.md +1 -1
  24. package/docs/MarkerView.md +1 -1
  25. package/docs/NativeUserLocation.md +1 -1
  26. package/docs/PointAnnotation.md +12 -10
  27. package/docs/RasterDemSource.md +1 -1
  28. package/docs/RasterLayer.md +1 -1
  29. package/docs/RasterSource.md +1 -1
  30. package/docs/ShapeSource.md +1 -1
  31. package/docs/SkyLayer.md +1 -1
  32. package/docs/Style.md +1 -1
  33. package/docs/SymbolLayer.md +1 -1
  34. package/docs/Terrain.md +1 -1
  35. package/docs/UserLocation.md +1 -1
  36. package/docs/VectorSource.md +1 -1
  37. package/docs/docs.json +44 -23
  38. package/index.d.ts +3 -19
  39. package/ios/RCTMGL-v10/RCTMGLCamera.swift +11 -1
  40. package/javascript/components/MarkerView.tsx +12 -1
  41. package/javascript/components/{NativeBridgeComponent.js → NativeBridgeComponent.tsx} +33 -10
  42. package/javascript/components/PointAnnotation.tsx +231 -0
  43. package/javascript/utils/index.d.ts +11 -3
  44. package/package.json +8 -8
  45. package/scripts/autogenHelpers/DocJSONBuilder.js +68 -12
  46. package/scripts/templates/component.md.ejs +1 -1
  47. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/AbstractMapFeature.java +0 -15
  48. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraUpdateItem.java +0 -167
  49. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/CameraUpdateQueue.java +0 -73
  50. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCamera.java +0 -662
  51. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/camera/RCTMGLCameraManager.java +0 -102
  52. package/javascript/components/PointAnnotation.d.ts +0 -13
  53. package/javascript/components/PointAnnotation.js +0 -217
@@ -1,102 +0,0 @@
1
- package com.mapbox.rctmgl.components.camera;
2
-
3
- import com.mapbox.geojson.FeatureCollection;
4
- import com.facebook.common.logging.FLog;
5
- import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.bridge.ReadableMap;
7
- import com.facebook.react.uimanager.ThemedReactContext;
8
- import com.facebook.react.uimanager.annotations.ReactProp;
9
- import com.mapbox.rctmgl.components.AbstractEventEmitter;
10
- import com.mapbox.rctmgl.utils.GeoJSONUtils;
11
- //import com.mapbox.rctmgl.utils.GeoJSONUtils;
12
-
13
- import java.util.HashMap;
14
- import java.util.Map;
15
-
16
- public class RCTMGLCameraManager extends AbstractEventEmitter<RCTMGLCamera> {
17
- public static final String REACT_CLASS = "RCTMGLCamera";
18
-
19
- private ReactApplicationContext mContext;
20
-
21
- public RCTMGLCameraManager(ReactApplicationContext context) {
22
- super(context);
23
- mContext = context;
24
- }
25
-
26
- @Override
27
- public Map<String, String> customEvents() {
28
- return new HashMap<>();
29
- }
30
-
31
- @Override
32
- public String getName() {
33
- return REACT_CLASS;
34
- }
35
-
36
- @Override
37
- protected RCTMGLCamera createViewInstance(ThemedReactContext reactContext) {
38
- return new RCTMGLCamera(reactContext, this);
39
- }
40
-
41
- @ReactProp(name="stop")
42
- public void setStop(RCTMGLCamera camera, ReadableMap map) {
43
- if (map != null) {
44
- CameraStop stop = CameraStop.fromReadableMap(mContext, map, null);
45
- camera.setStop(stop);
46
- }
47
- }
48
-
49
- @ReactProp(name="defaultStop")
50
- public void setDefaultStop(RCTMGLCamera camera, ReadableMap map) {
51
- if (map != null) {
52
- CameraStop stop = CameraStop.fromReadableMap(mContext, map, null);
53
- camera.setDefaultStop(stop);
54
- }
55
- }
56
- /*v10todo
57
- @ReactProp(name="maxBounds")
58
- public void setMaxBounds(RCTMGLCamera camera, String value) {
59
- if (value != null) {
60
- FeatureCollection collection = FeatureCollection.fromJson(value);
61
- camera.setMaxBounds(GeoJSONUtils.toLatLngBounds(collection));
62
- }
63
- }
64
- */
65
-
66
- @ReactProp(name="userTrackingMode")
67
- public void setUserTrackingMode(RCTMGLCamera camera, int userTrackingMode) {
68
- camera.setUserTrackingMode(userTrackingMode);
69
- throw new AssertionError("Unused code");
70
- }
71
-
72
- @ReactProp(name="followZoomLevel")
73
- public void setZoomLevel(RCTMGLCamera camera, double zoomLevel) {
74
- camera.setZoomLevel(zoomLevel);
75
- }
76
-
77
- @ReactProp(name="followUserLocation")
78
- public void setFollowUserLocation(RCTMGLCamera camera, boolean value) {
79
- camera.setFollowUserLocation(value);
80
- }
81
-
82
- @ReactProp(name="followUserMode")
83
- public void setFollowUserMode(RCTMGLCamera camera, String value) {
84
- camera.setFollowUserMode(value);
85
- }
86
-
87
- @ReactProp(name="minZoomLevel")
88
- public void setMinZoomLevel(RCTMGLCamera camera, double value) {
89
- camera.setMinZoomLevel(value);
90
- }
91
-
92
- @ReactProp(name="maxZoomLevel")
93
- public void setMaxZoomLevel(RCTMGLCamera camera, double value) {
94
- camera.setMaxZoomLevel(value);
95
- }
96
-
97
- @ReactProp(name="followPitch")
98
- public void setFollowPitch(RCTMGLCamera camera, double value) {
99
- camera.setFollowPitch(value);
100
- }
101
-
102
- }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
-
3
- export interface PointAnnotationProps {
4
- coordinate: [number, number];
5
- anchor: {
6
- x: number;
7
- y: number;
8
- };
9
- }
10
-
11
- export default class PointAnnotation extends React.Component<PointAnnotationProps> {
12
- refresh(): void;
13
- }
@@ -1,217 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { requireNativeComponent, StyleSheet, Platform } from 'react-native';
4
-
5
- import { toJSONString, isFunction, viewPropTypes } from '../utils';
6
- import { makePoint } from '../utils/geoUtils';
7
-
8
- import NativeBridgeComponent from './NativeBridgeComponent';
9
-
10
- export const NATIVE_MODULE_NAME = 'RCTMGLPointAnnotation';
11
-
12
- const styles = StyleSheet.create({
13
- container: {
14
- alignItems: 'center',
15
- justifyContent: 'center',
16
- position: 'absolute',
17
- },
18
- });
19
-
20
- /**
21
- * PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
22
- *
23
- * Consider using ShapeSource and SymbolLayer instead, if you have many points and you have static images,
24
- * they'll offer much better performance.
25
- *
26
- * If you need interactive views please use MarkerView,
27
- * as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
28
- */
29
- class PointAnnotation extends NativeBridgeComponent(React.PureComponent) {
30
- static propTypes = {
31
- ...viewPropTypes,
32
-
33
- /**
34
- * A string that uniquely identifies the annotation
35
- */
36
- id: PropTypes.string.isRequired,
37
-
38
- /**
39
- * The string containing the annotation’s title. Note this is required to be set if you want to see a callout appear on iOS.
40
- */
41
- title: PropTypes.string,
42
-
43
- /**
44
- * The string containing the annotation’s snippet(subtitle). Not displayed in the default callout.
45
- */
46
- snippet: PropTypes.string,
47
-
48
- /**
49
- * Manually selects/deselects annotation
50
- * @type {[type]}
51
- */
52
- selected: PropTypes.bool,
53
-
54
- /**
55
- * Enable or disable dragging. Defaults to false.
56
- */
57
- draggable: PropTypes.bool,
58
-
59
- /**
60
- * The center point (specified as a map coordinate) of the annotation.
61
- */
62
- coordinate: PropTypes.arrayOf(PropTypes.number).isRequired,
63
-
64
- /**
65
- * Specifies the anchor being set on a particular point of the annotation.
66
- * The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
67
- * where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
68
- * Note this is only for custom annotations not the default pin view.
69
- * Defaults to the center of the view.
70
- */
71
- anchor: PropTypes.shape({
72
- /**
73
- * See anchor
74
- */
75
- x: PropTypes.number.isRequired,
76
- /**
77
- * See anchor
78
- */
79
- y: PropTypes.number.isRequired,
80
- }),
81
-
82
- /**
83
- * This callback is fired once this annotation is selected. Returns a Feature as the first param.
84
- */
85
- onSelected: PropTypes.func,
86
-
87
- /**
88
- * This callback is fired once this annotation is deselected.
89
- */
90
- onDeselected: PropTypes.func,
91
-
92
- /**
93
- * This callback is fired once this annotation has started being dragged.
94
- */
95
- onDragStart: PropTypes.func,
96
-
97
- /**
98
- * This callback is fired once this annotation has stopped being dragged.
99
- */
100
- onDragEnd: PropTypes.func,
101
-
102
- /**
103
- * This callback is fired while this annotation is being dragged.
104
- */
105
- onDrag: PropTypes.func,
106
- };
107
-
108
- static defaultProps = {
109
- anchor: { x: 0.5, y: 0.5 },
110
- draggable: false,
111
- };
112
-
113
- constructor(props) {
114
- super(props, NATIVE_MODULE_NAME);
115
- this._onSelected = this._onSelected.bind(this);
116
- this._onDeselected = this._onDeselected.bind(this);
117
- this._onDragStart = this._onDragStart.bind(this);
118
- this._onDrag = this._onDrag.bind(this);
119
- this._onDragEnd = this._onDragEnd.bind(this);
120
- }
121
-
122
- _onSelected(e) {
123
- if (isFunction(this.props.onSelected)) {
124
- this.props.onSelected(e.nativeEvent.payload);
125
- }
126
- }
127
-
128
- _onDeselected(e) {
129
- if (isFunction(this.props.onDeselected)) {
130
- this.props.onDeselected(e.nativeEvent.payload);
131
- }
132
- }
133
-
134
- _onDragStart(e) {
135
- if (isFunction(this.props.onDragStart)) {
136
- this.props.onDragStart(e.nativeEvent.payload);
137
- }
138
- }
139
-
140
- _onDrag(e) {
141
- if (isFunction(this.props.onDrag)) {
142
- this.props.onDrag(e.nativeEvent.payload);
143
- }
144
- }
145
-
146
- _onDragEnd(e) {
147
- if (isFunction(this.props.onDragEnd)) {
148
- this.props.onDragEnd(e.nativeEvent.payload);
149
- }
150
- }
151
-
152
- _getCoordinate() {
153
- if (!this.props.coordinate) {
154
- return undefined;
155
- }
156
- return toJSONString(makePoint(this.props.coordinate));
157
- }
158
-
159
- /**
160
- * On v10 and pre v10 android point annotation is rendered offscreen with a canvas into an image.
161
- * To rerender the image from the current state of the view call refresh.
162
- * Call this for example from Image#onLoad.
163
- */
164
- refresh() {
165
- if (Platform.OS === 'android') {
166
- this._runNativeCommand('refresh', this._nativeRef, []);
167
- } else {
168
- this._runNativeCommand('refresh', this._nativeRef, []);
169
- }
170
- }
171
-
172
- _setNativeRef(nativeRef) {
173
- this._nativeRef = nativeRef;
174
- super._runPendingNativeCommands(nativeRef);
175
- }
176
-
177
- render() {
178
- const props = {
179
- ...this.props,
180
- ref: (nativeRef) => this._setNativeRef(nativeRef),
181
- id: this.props.id,
182
- title: this.props.title,
183
- snippet: this.props.snippet,
184
- anchor: this.props.anchor,
185
- selected: this.props.selected,
186
- draggable: this.props.draggable,
187
- style: [this.props.style, styles.container],
188
- onMapboxPointAnnotationSelected: this._onSelected,
189
- onMapboxPointAnnotationDeselected: this._onDeselected,
190
- onMapboxPointAnnotationDragStart: this._onDragStart,
191
- onMapboxPointAnnotationDrag: this._onDrag,
192
- onMapboxPointAnnotationDragEnd: this._onDragEnd,
193
- coordinate: this._getCoordinate(),
194
- };
195
- return (
196
- <RCTMGLPointAnnotation {...props}>
197
- {this.props.children}
198
- </RCTMGLPointAnnotation>
199
- );
200
- }
201
- }
202
-
203
- const RCTMGLPointAnnotation = requireNativeComponent(
204
- NATIVE_MODULE_NAME,
205
- PointAnnotation,
206
- {
207
- nativeOnly: {
208
- onMapboxPointAnnotationSelected: true,
209
- onMapboxPointAnnotationDeselected: true,
210
- onMapboxPointAnnotationDragStart: true,
211
- onMapboxPointAnnotationDrag: true,
212
- onMapboxPointAnnotationDragEnd: true,
213
- },
214
- },
215
- );
216
-
217
- export default PointAnnotation;