@rnmapbox/maps 10.0.0-beta.72 → 10.0.0-beta.74

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 (121) hide show
  1. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +2 -0
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLPointAnnotation.kt +0 -1
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImage.kt +74 -0
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImageManager.kt +67 -0
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImages.kt +62 -35
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +216 -0
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/location/LocationComponentManager.kt +4 -2
  8. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +9 -3
  9. package/index.d.ts +22 -74
  10. package/javascript/components/AbstractLayer.tsx +2 -1
  11. package/javascript/components/AbstractSource.tsx +3 -1
  12. package/javascript/components/Atmosphere.tsx +2 -1
  13. package/javascript/components/Camera.tsx +6 -4
  14. package/javascript/components/Image.tsx +12 -4
  15. package/javascript/components/Images.tsx +1 -1
  16. package/javascript/components/Light.tsx +60 -0
  17. package/javascript/components/PointAnnotation.tsx +2 -1
  18. package/javascript/components/ShapeSource.tsx +1 -11
  19. package/javascript/components/Terrain.tsx +2 -1
  20. package/javascript/components/VectorSource.tsx +209 -0
  21. package/javascript/components/annotations/Annotation.js +9 -10
  22. package/javascript/modules/location/locationManager.ts +2 -2
  23. package/javascript/types/BaseProps.ts +3 -0
  24. package/javascript/types/OnPressEvent.ts +11 -0
  25. package/javascript/utils/{Logger.js → Logger.ts} +32 -14
  26. package/javascript/utils/MapboxStyles.d.ts +1 -1
  27. package/javascript/utils/deprecation.ts +3 -3
  28. package/javascript/utils/nativeRef.ts +28 -0
  29. package/lib/commonjs/components/AbstractLayer.js.map +1 -1
  30. package/lib/commonjs/components/AbstractSource.js.map +1 -1
  31. package/lib/commonjs/components/Atmosphere.js.map +1 -1
  32. package/lib/commonjs/components/Camera.js +4 -4
  33. package/lib/commonjs/components/Camera.js.map +1 -1
  34. package/lib/commonjs/components/Image.js.map +1 -1
  35. package/lib/commonjs/components/Images.js +1 -1
  36. package/lib/commonjs/components/Images.js.map +1 -1
  37. package/lib/commonjs/components/Light.js +32 -33
  38. package/lib/commonjs/components/Light.js.map +1 -1
  39. package/lib/commonjs/components/PointAnnotation.js.map +1 -1
  40. package/lib/commonjs/components/ShapeSource.js.map +1 -1
  41. package/lib/commonjs/components/Terrain.js.map +1 -1
  42. package/lib/commonjs/components/VectorSource.js +15 -74
  43. package/lib/commonjs/components/VectorSource.js.map +1 -1
  44. package/lib/commonjs/components/annotations/Annotation.js +6 -9
  45. package/lib/commonjs/components/annotations/Annotation.js.map +1 -1
  46. package/lib/commonjs/modules/location/locationManager.js +2 -1
  47. package/lib/commonjs/modules/location/locationManager.js.map +1 -1
  48. package/lib/commonjs/types/BaseProps.js +2 -0
  49. package/lib/commonjs/types/BaseProps.js.map +1 -0
  50. package/lib/commonjs/types/OnPressEvent.js +2 -0
  51. package/lib/commonjs/types/OnPressEvent.js.map +1 -0
  52. package/lib/commonjs/utils/Logger.js +7 -7
  53. package/lib/commonjs/utils/Logger.js.map +1 -1
  54. package/lib/commonjs/utils/deprecation.js +2 -2
  55. package/lib/commonjs/utils/nativeRef.js +27 -0
  56. package/lib/commonjs/utils/nativeRef.js.map +1 -0
  57. package/lib/module/components/AbstractLayer.js.map +1 -1
  58. package/lib/module/components/AbstractSource.js.map +1 -1
  59. package/lib/module/components/Atmosphere.js.map +1 -1
  60. package/lib/module/components/Camera.js +4 -4
  61. package/lib/module/components/Camera.js.map +1 -1
  62. package/lib/module/components/Image.js.map +1 -1
  63. package/lib/module/components/Images.js +1 -1
  64. package/lib/module/components/Images.js.map +1 -1
  65. package/lib/module/components/Light.js +29 -32
  66. package/lib/module/components/Light.js.map +1 -1
  67. package/lib/module/components/PointAnnotation.js.map +1 -1
  68. package/lib/module/components/ShapeSource.js.map +1 -1
  69. package/lib/module/components/Terrain.js.map +1 -1
  70. package/lib/module/components/VectorSource.js +15 -74
  71. package/lib/module/components/VectorSource.js.map +1 -1
  72. package/lib/module/components/annotations/Annotation.js +6 -9
  73. package/lib/module/components/annotations/Annotation.js.map +1 -1
  74. package/lib/module/modules/location/locationManager.js +1 -1
  75. package/lib/module/modules/location/locationManager.js.map +1 -1
  76. package/lib/module/types/BaseProps.js +2 -0
  77. package/lib/module/types/BaseProps.js.map +1 -0
  78. package/lib/module/types/OnPressEvent.js +2 -0
  79. package/lib/module/types/OnPressEvent.js.map +1 -0
  80. package/lib/module/utils/Logger.js +7 -7
  81. package/lib/module/utils/Logger.js.map +1 -1
  82. package/lib/module/utils/deprecation.js +2 -2
  83. package/lib/module/utils/nativeRef.js +21 -0
  84. package/lib/module/utils/nativeRef.js.map +1 -0
  85. package/lib/typescript/components/AbstractLayer.d.ts +2 -1
  86. package/lib/typescript/components/AbstractLayer.d.ts.map +1 -1
  87. package/lib/typescript/components/AbstractSource.d.ts +2 -1
  88. package/lib/typescript/components/AbstractSource.d.ts.map +1 -1
  89. package/lib/typescript/components/Atmosphere.d.ts +2 -1
  90. package/lib/typescript/components/Atmosphere.d.ts.map +1 -1
  91. package/lib/typescript/components/Camera.d.ts.map +1 -1
  92. package/lib/typescript/components/Image.d.ts +10 -4
  93. package/lib/typescript/components/Image.d.ts.map +1 -1
  94. package/lib/typescript/components/Images.d.ts +1 -1
  95. package/lib/typescript/components/Images.d.ts.map +1 -1
  96. package/lib/typescript/components/Light.d.ts +17 -0
  97. package/lib/typescript/components/Light.d.ts.map +1 -0
  98. package/lib/typescript/components/PointAnnotation.d.ts +2 -1
  99. package/lib/typescript/components/PointAnnotation.d.ts.map +1 -1
  100. package/lib/typescript/components/ShapeSource.d.ts +3 -13
  101. package/lib/typescript/components/ShapeSource.d.ts.map +1 -1
  102. package/lib/typescript/components/Terrain.d.ts +2 -1
  103. package/lib/typescript/components/Terrain.d.ts.map +1 -1
  104. package/lib/typescript/components/VectorSource.d.ts +144 -0
  105. package/lib/typescript/components/VectorSource.d.ts.map +1 -0
  106. package/lib/typescript/modules/location/locationManager.d.ts +2 -2
  107. package/lib/typescript/modules/location/locationManager.d.ts.map +1 -1
  108. package/lib/typescript/types/BaseProps.d.ts +4 -0
  109. package/lib/typescript/types/BaseProps.d.ts.map +1 -0
  110. package/lib/typescript/types/OnPressEvent.d.ts +12 -0
  111. package/lib/typescript/types/OnPressEvent.d.ts.map +1 -0
  112. package/lib/typescript/utils/Logger.d.ts +53 -0
  113. package/lib/typescript/utils/Logger.d.ts.map +1 -0
  114. package/lib/typescript/utils/deprecation.d.ts +4 -3
  115. package/lib/typescript/utils/deprecation.d.ts.map +1 -1
  116. package/lib/typescript/utils/nativeRef.d.ts +21 -0
  117. package/lib/typescript/utils/nativeRef.d.ts.map +1 -0
  118. package/package.json +1 -1
  119. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.java +0 -103
  120. package/javascript/components/Light.js +0 -47
  121. package/javascript/components/VectorSource.js +0 -203
@@ -1,203 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { NativeModules, requireNativeComponent } from 'react-native';
4
-
5
- import {
6
- cloneReactChildrenWithProps,
7
- viewPropTypes,
8
- isFunction,
9
- isAndroid,
10
- } from '../utils';
11
- import { getFilter } from '../utils/filterUtils';
12
- import { copyPropertiesAsDeprecated } from '../utils/deprecation';
13
-
14
- import AbstractSource from './AbstractSource';
15
- import NativeBridgeComponent from './NativeBridgeComponent';
16
-
17
- const MapboxGL = NativeModules.MGLModule;
18
-
19
- export const NATIVE_MODULE_NAME = 'RCTMGLVectorSource';
20
-
21
- /**
22
- * VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
23
- * The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
24
- */
25
- class VectorSource extends NativeBridgeComponent(
26
- AbstractSource,
27
- NATIVE_MODULE_NAME,
28
- ) {
29
- static propTypes = {
30
- ...viewPropTypes,
31
-
32
- /**
33
- * A string that uniquely identifies the source.
34
- */
35
- id: PropTypes.string.isRequired,
36
-
37
- /**
38
- * A URL to a TileJSON configuration file describing the source’s contents and other metadata.
39
- */
40
- url: PropTypes.string,
41
-
42
- /**
43
- * An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
44
- * Example: https://example.com/vector-tiles/{z}/{x}/{y}.pbf
45
- */
46
- tileUrlTemplates: PropTypes.arrayOf(PropTypes.string),
47
-
48
- /**
49
- * An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
50
- * The value should be between 0 and 22, inclusive, and less than
51
- * maxZoomLevel, if specified. The default value for this option is 0.
52
- */
53
- minZoomLevel: PropTypes.number,
54
-
55
- /**
56
- * An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
57
- * The value should be between 0 and 22, inclusive, and less than
58
- * minZoomLevel, if specified. The default value for this option is 22.
59
- */
60
- maxZoomLevel: PropTypes.number,
61
-
62
- /**
63
- * Influences the y direction of the tile coordinates. (tms inverts y axis)
64
- */
65
- tms: PropTypes.bool,
66
-
67
- /**
68
- * An HTML or literal text string defining the buttons to be displayed in an action sheet when the
69
- * source is part of a map view’s style and the map view’s attribution button is pressed.
70
- */
71
- attribution: PropTypes.string,
72
-
73
- /**
74
- * Source press listener, gets called when a user presses one of the children layers only
75
- * if that layer has a higher z-index than another source layers
76
- *
77
- * @param {Object} event
78
- * @param {Object[]} event.features - the geojson features that have hit by the press (might be multiple)
79
- * @param {Object} event.coordinates - the coordinates of the click
80
- * @param {Object} event.point - the point of the click
81
- */
82
- onPress: PropTypes.func,
83
-
84
- /**
85
- * Overrides the default touch hitbox(44x44 pixels) for the source layers
86
- */
87
- hitbox: PropTypes.shape({
88
- /**
89
- * `width` of hitbox
90
- */
91
- width: PropTypes.number.isRequired,
92
- /**
93
- * `height` of hitbox
94
- */
95
- height: PropTypes.number.isRequired,
96
- }),
97
- };
98
-
99
- static defaultProps = {
100
- id: MapboxGL.StyleSource.DefaultSourceID,
101
- };
102
-
103
- constructor(props) {
104
- super(props);
105
- }
106
-
107
- _setNativeRef(nativeRef) {
108
- this._nativeRef = nativeRef;
109
- super._runPendingNativeCommands(nativeRef);
110
- }
111
-
112
- /**
113
- * Returns all features that match the query parameters regardless of whether or not the feature is
114
- * currently rendered on the map. The domain of the query includes all currently-loaded vector tiles
115
- * and GeoJSON source tiles. This function does not check tiles outside of the visible viewport.
116
- *
117
- * @example
118
- * vectorSource.features(['id1', 'id2'])
119
- *
120
- * @param {Array=} layerIDs - A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array.
121
- * @param {Array=} filter - an optional filter statement to filter the returned Features.
122
- * @return {FeatureCollection}
123
- */
124
- async features(layerIDs = [], filter = []) {
125
- const res = await this._runNativeCommand('features', this._nativeRef, [
126
- layerIDs,
127
- getFilter(filter),
128
- ]);
129
-
130
- if (isAndroid()) {
131
- return JSON.parse(res.data);
132
- }
133
-
134
- return res.data;
135
- }
136
-
137
- onPress(event) {
138
- const {
139
- nativeEvent: {
140
- payload: { features, coordinates, point },
141
- },
142
- } = event;
143
- let newEvent = {
144
- features,
145
- coordinates,
146
- point,
147
- };
148
- newEvent = copyPropertiesAsDeprecated(
149
- event,
150
- newEvent,
151
- (key) => {
152
- console.warn(
153
- `event.${key} is deprecated on VectorSource#onPress, please use event.features`,
154
- );
155
- },
156
- {
157
- nativeEvent: (origNativeEvent) => ({
158
- ...origNativeEvent,
159
- payload: features[0],
160
- }),
161
- },
162
- );
163
- this.props.onPress(newEvent);
164
- }
165
-
166
- render() {
167
- const props = {
168
- id: this.props.id,
169
- url: this.props.url,
170
- tileUrlTemplates: this.props.tileUrlTemplates,
171
- minZoomLevel: this.props.minZoomLevel,
172
- maxZoomLevel: this.props.maxZoomLevel,
173
- tms: this.props.tms,
174
- attribution: this.props.attribution,
175
- hitbox: this.props.hitbox,
176
- hasPressListener: isFunction(this.props.onPress),
177
- onMapboxVectorSourcePress: this.onPress.bind(this),
178
- onPress: undefined,
179
- ref: (nativeRef) => this._setNativeRef(nativeRef),
180
- onAndroidCallback: isAndroid() ? this._onAndroidCallback : undefined,
181
- };
182
- return (
183
- <RCTMGLVectorSource ref={this.setNativeRef} {...props}>
184
- {cloneReactChildrenWithProps(this.props.children, {
185
- sourceID: this.props.id,
186
- })}
187
- </RCTMGLVectorSource>
188
- );
189
- }
190
- }
191
-
192
- const RCTMGLVectorSource = requireNativeComponent(
193
- NATIVE_MODULE_NAME,
194
- VectorSource,
195
- {
196
- nativeOnly: {
197
- hasPressListener: true,
198
- onMapboxVectorSourcePress: true,
199
- },
200
- },
201
- );
202
-
203
- export default VectorSource;