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

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 (60) hide show
  1. package/.eslintrc.js +2 -1
  2. package/.github/workflows/ios-actions.yml +1 -1
  3. package/android/install.md +20 -1
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +2 -0
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/mapview/RCTMGLMapView.kt +22 -31
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +26 -0
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/atmosphere/RCTMGLAtmosphere.kt +59 -0
  8. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/atmosphere/RCTMGLAtmosphereManager.kt +30 -0
  9. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/terrain/RCTMGLTerrain.kt +32 -27
  10. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/terrain/RCTMGLTerrainManager.kt +5 -11
  11. package/docs/Annotations.md +4 -3
  12. package/docs/Camera.md +1 -1
  13. package/docs/HeadingIndicator.md +1 -1
  14. package/docs/MapView.md +2 -2
  15. package/docs/SymbolLayer.md +4 -3
  16. package/docs/Terrain.md +64 -9
  17. package/docs/docs.json +66 -53
  18. package/index.d.ts +13 -80
  19. package/ios/RCTMGL-v10/RCTMGLCamera.swift +28 -26
  20. package/ios/RCTMGL-v10/RCTMGLImages.swift +1 -99
  21. package/ios/RCTMGL-v10/RCTMGLLogging.swift +8 -0
  22. package/ios/RCTMGL-v10/RCTMGLMapView.swift +35 -39
  23. package/ios/RCTMGL-v10/RCTMGLSingletonLayer.swift +7 -1
  24. package/ios/RCTMGL-v10/RCTMGLStyle.swift +34 -0
  25. package/ios/RCTMGL-v10/RCTMGLTerrain.swift +56 -63
  26. package/ios/RCTMGL-v10/RCTMGLTerrainManager.m +2 -3
  27. package/javascript/components/AbstractLayer.tsx +72 -0
  28. package/javascript/components/BackgroundLayer.js +1 -1
  29. package/javascript/components/Camera.tsx +17 -1
  30. package/javascript/components/CircleLayer.js +1 -1
  31. package/javascript/components/FillExtrusionLayer.js +1 -1
  32. package/javascript/components/FillLayer.js +1 -1
  33. package/javascript/components/{HeadingIndicator.js → HeadingIndicator.tsx} +5 -6
  34. package/javascript/components/HeatmapLayer.js +1 -1
  35. package/javascript/components/LineLayer.js +1 -1
  36. package/javascript/components/MapView.js +8 -12
  37. package/javascript/components/RasterLayer.js +1 -1
  38. package/javascript/components/SkyLayer.js +1 -1
  39. package/javascript/components/SymbolLayer.tsx +113 -0
  40. package/javascript/components/Terrain.tsx +52 -0
  41. package/javascript/components/UserLocation.js +1 -1
  42. package/javascript/global.d.ts +4 -0
  43. package/javascript/index.js +8 -4
  44. package/javascript/types/index.ts +0 -14
  45. package/javascript/utils/MapboxStyles.ts +177 -52
  46. package/javascript/utils/StyleValue.ts +8 -6
  47. package/javascript/utils/deprecation.ts +39 -0
  48. package/javascript/utils/{filterUtils.js → filterUtils.tsx} +1 -1
  49. package/javascript/utils/styleMap.ts +26 -0
  50. package/package.json +6 -6
  51. package/scripts/autogenHelpers/DocJSONBuilder.js +2 -3
  52. package/scripts/autogenHelpers/globals.js +20 -7
  53. package/scripts/autogenerate.js +13 -0
  54. package/scripts/templates/MapboxStyles.ts.ejs +8 -3
  55. package/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +1 -0
  56. package/.eslintignore +0 -1
  57. package/javascript/components/AbstractLayer.js +0 -46
  58. package/javascript/components/SymbolLayer.js +0 -120
  59. package/javascript/components/Terrain.js +0 -56
  60. package/javascript/utils/deprecation.js +0 -24
@@ -28,7 +28,7 @@ export function transformStyle(
28
28
  const styleProps = Object.keys(style) as Array<keyof typeof style>;
29
29
  for (const styleProp of styleProps) {
30
30
  const styleType = getStyleType(styleProp);
31
- let rawStyle: RawValueType = style[styleProp];
31
+ let rawStyle: RawValueType | undefined = style[styleProp];
32
32
 
33
33
  if (styleType === 'color' && typeof rawStyle === 'string') {
34
34
  const color = processColor(rawStyle);
@@ -43,11 +43,13 @@ export function transformStyle(
43
43
  (Image.resolveAssetSource(rawStyle) as unknown as RawValueType) || {};
44
44
  }
45
45
 
46
- const bridgeValue = new BridgeValue(rawStyle);
47
- nativeStyle[styleProp] = {
48
- styletype: styleType,
49
- stylevalue: bridgeValue.toJSON(),
50
- };
46
+ if (rawStyle !== undefined) {
47
+ const bridgeValue = new BridgeValue(rawStyle);
48
+ nativeStyle[styleProp] = {
49
+ styletype: styleType,
50
+ stylevalue: bridgeValue.toJSON(),
51
+ };
52
+ }
51
53
  }
52
54
 
53
55
  return nativeStyle;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * deprecatedClass: creates a subclass of the class, which prints deprecated warning when called
3
+ */
4
+ export function deprecatedClass<C extends new (...args: any[]) => object>(
5
+ origClass: C,
6
+ deprecationMessage: string,
7
+ ): C {
8
+ const result = class extends origClass {
9
+ constructor(...args: any[]) {
10
+ console.log(`Deprecated: ${deprecationMessage}`);
11
+ super(...args);
12
+ }
13
+ };
14
+ return result;
15
+ }
16
+
17
+ /**
18
+ * Copy properties from origObject to newObject, which not exists in newObject,
19
+ * calls onDeprecatedCalled callback in case a copied property is invoked.
20
+ */
21
+ export function copyPropertiesAsDeprecated(
22
+ origObject: { [key: string]: unknown },
23
+ newObject: { [key: string]: unknown },
24
+ onDeprecatedCalled: (key: string) => void,
25
+ accessors: { [key: string]: (value: unknown) => unknown } = {},
26
+ ): { [key: string]: unknown } {
27
+ const result = newObject;
28
+ for (const [key, value] of Object.entries(origObject)) {
29
+ if (!newObject[key]) {
30
+ Object.defineProperty(result, key, {
31
+ get() {
32
+ onDeprecatedCalled(key);
33
+ return accessors[key] ? accessors[key](value) : value;
34
+ },
35
+ });
36
+ }
37
+ }
38
+ return result;
39
+ }
@@ -1,4 +1,4 @@
1
- export function getFilter(filter) {
1
+ export function getFilter(filter: string[] | unknown) {
2
2
  if (!Array.isArray(filter) || filter.length === 0) {
3
3
  return [];
4
4
  }
@@ -1671,6 +1671,28 @@ export const AtmosphereLayerStyleProp = PropTypes.shape({
1671
1671
  }),
1672
1672
  });
1673
1673
 
1674
+ export const TerrainLayerStyleProp = PropTypes.shape({
1675
+ /**
1676
+ * Name of a source of `raster_dem` type to be used for terrain elevation.
1677
+ */
1678
+ source: PropTypes.string,
1679
+
1680
+ /**
1681
+ * Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.
1682
+ *
1683
+ * @requires source
1684
+ */
1685
+ exaggeration: PropTypes.oneOfType([PropTypes.number, PropTypes.array]),
1686
+
1687
+ /**
1688
+ * The transition affecting any changes to this layer’s exaggeration property.
1689
+ */
1690
+ exaggerationTransition: PropTypes.shape({
1691
+ duration: PropTypes.number,
1692
+ delay: PropTypes.number,
1693
+ }),
1694
+ });
1695
+
1674
1696
  const styleMap = {
1675
1697
  fillSortKey: StyleTypes.Constant,
1676
1698
  fillAntialias: StyleTypes.Constant,
@@ -1891,6 +1913,10 @@ const styleMap = {
1891
1913
  starIntensity: StyleTypes.Constant,
1892
1914
  starIntensityTransition: StyleTypes.Transition,
1893
1915
 
1916
+ source: StyleTypes.Constant,
1917
+ exaggeration: StyleTypes.Constant,
1918
+ exaggerationTransition: StyleTypes.Transition,
1919
+
1894
1920
  color: StyleTypes.Color,
1895
1921
  colorTransition: StyleTypes.Transition,
1896
1922
  visibility: StyleTypes.Constant,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.0.0-beta.41",
4
+ "version": "10.0.0-beta.43",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,9 +29,9 @@
29
29
  "unittest:single": "jest --testNamePattern",
30
30
  "lint": "eslint .",
31
31
  "lint:fix": "eslint . --fix",
32
- "type:check": "tsc --noEmit",
32
+ "type:check": "npx tsc --noEmit",
33
33
  "test:plugin": "expo-module test plugin",
34
- "build:plugin": "tsc --build plugin",
34
+ "build:plugin": "npx tsc --build plugin",
35
35
  "lint:plugin": "eslint plugin/src/*",
36
36
  "prepare": "husky install"
37
37
  },
@@ -73,8 +73,8 @@
73
73
  "@types/react-native": ">=0.59.9",
74
74
  "@typescript-eslint/eslint-plugin": "^5.37.0",
75
75
  "@typescript-eslint/parser": "^5.37.0",
76
- "babel-jest": "^27.5.1",
77
- "documentation": "13.2.5",
76
+ "babel-jest": "^29.0.3",
77
+ "documentation": "14.0.0",
78
78
  "ejs": "^3.1.3",
79
79
  "ejs-lint": "^1.1.0",
80
80
  "eslint": "^8.23.0",
@@ -95,7 +95,7 @@
95
95
  "react-docgen": "rnmapbox/react-docgen#rnmapbox-dist",
96
96
  "react-native": "0.67.0",
97
97
  "react-test-renderer": "17.0.2",
98
- "typescript": "^4.8.0"
98
+ "typescript": "4.8.3"
99
99
  },
100
100
  "jest": {
101
101
  "preset": "react-native",
@@ -22,7 +22,6 @@ const IGNORE_FILES = [
22
22
  'AbstractLayer',
23
23
  'AbstractSource',
24
24
  'NativeBridgeComponent',
25
- 'NativeBridgeComponent.tsx',
26
25
  ];
27
26
  const IGNORE_PATTERN = /\.web\./;
28
27
 
@@ -359,7 +358,7 @@ class DocJSONBuilder {
359
358
  return reject(err);
360
359
  }
361
360
 
362
- let fileName = fileNameWithExt.replace(/.(js)/, '');
361
+ let fileName = fileNameWithExt.replace(/\.(js|tsx|ts$)/, '');
363
362
  if (
364
363
  IGNORE_FILES.includes(fileName) ||
365
364
  fileName.match(IGNORE_PATTERN)
@@ -370,7 +369,7 @@ class DocJSONBuilder {
370
369
 
371
370
  let parsedComponents = docgen.parse(content, {
372
371
  babelOptions: {
373
- filename: fileName,
372
+ filename: fileNameWithExt,
374
373
  },
375
374
  });
376
375
  let [parsed] = parsedComponents;
@@ -107,6 +107,8 @@ global.getLayerType = function (layer, platform) {
107
107
  return isIOS ? 'MGLSkyLayer' : 'SkyLayer';
108
108
  case 'atmosphere':
109
109
  return isIOS ? 'MGLAtmosphere' : 'Atmosphere';
110
+ case 'terrain':
111
+ return isIOS ? 'MGLTerrain' : 'Terrain';
110
112
  default:
111
113
  throw new Error(
112
114
  `Is ${layer.name} a new layer? We should add support for it!`,
@@ -290,20 +292,31 @@ global.dtsInterfaceType = function (prop) {
290
292
  propTypes.push('string[]');
291
293
  break;
292
294
  case 'enum':
293
- propTypes.push(`Enum<${pascelCase(prop.name)}Enum>[]`);
295
+ propTypes.push(
296
+ `Enum<${pascelCase(prop.name)}Enum, ${pascelCase(
297
+ prop.name,
298
+ )}EnumValues>[]`,
299
+ );
294
300
  break;
295
301
  }
296
302
  // propTypes.push('ConstantPropType');
297
303
  } else if (prop.type === 'number') {
298
304
  propTypes.push('number');
299
305
  } else if (prop.type === 'enum') {
300
- propTypes.push(`Enum<${pascelCase(prop.name)}Enum>`);
301
- } else {
302
- // images can be required which result in a number
303
- if (prop.image) {
304
- propTypes.push('number');
305
- }
306
+ propTypes.push(
307
+ `Enum<${pascelCase(prop.name)}Enum, ${pascelCase(prop.name)}EnumValues>`,
308
+ );
309
+ } else if (prop.type === 'boolean') {
310
+ propTypes.push('boolean');
311
+ } else if (prop.type === 'resolvedImage') {
312
+ propTypes.push('ResolvedImageType');
313
+ } else if (prop.type === 'formatted') {
314
+ propTypes.push('FormattedString');
315
+ } else if (prop.type === 'string') {
306
316
  propTypes.push('string');
317
+ } else {
318
+ console.error('Unexpected type:', prop.type);
319
+ throw new Error(`Unexpected type: ${prop.type} for ${prop.name}`);
307
320
  }
308
321
 
309
322
  /*
@@ -155,6 +155,19 @@ layers.push({
155
155
  support: { gl: false, v10: true },
156
156
  });
157
157
 
158
+ // add terrain as a layer
159
+ layers.push({
160
+ name: 'terrain',
161
+ properties: getPropertiesFor('terrain'),
162
+ props: {
163
+ gl: getPropertiesFor('terrain', 'gl'),
164
+ v10: getPropertiesFor('terrain', 'v10')
165
+ .filter(({ name }) => name !== 'source')
166
+ .map((i) => ({ ...i, transition: false })),
167
+ },
168
+ support: { gl: false, v10: true },
169
+ });
170
+
158
171
  function getPropertiesFor(kind, only) {
159
172
  const attributes = styleSpecJSON[kind];
160
173
 
@@ -2,7 +2,7 @@
2
2
  const layers = locals.layers;
3
3
  -%>
4
4
  /* This file was generated from MapboxStyle.ts.ejs do not modify */
5
-
5
+ import { type ImageSourcePropType } from 'react-native';
6
6
 
7
7
  export type Translation = { x: number; y: number } | [number, number];
8
8
 
@@ -11,6 +11,8 @@ export interface Transition {
11
11
  delay: number;
12
12
  }
13
13
 
14
+ export type FormattedString = string; /* TODO */
15
+
14
16
  type ExpressionName =
15
17
  // Types
16
18
  | 'array' | 'boolean' | 'collator' | 'format' | 'image' | 'literal' | 'number' | 'number-format' | 'object' | 'string'
@@ -47,8 +49,10 @@ export type Expression = [ExpressionName, ...ExpressionField[]];
47
49
 
48
50
  type ExpressionParameters = 'zoom' | 'feature' | 'feature-state' | 'sky-radial-progress' | 'line-progress' | 'heatmap-density';
49
51
 
52
+ type ResolvedImageType = ImageSourcePropType;
53
+
50
54
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
- type Value<T, AllowedParameters extends ExpressionParameters[] = []> =
55
+ export type Value<T, AllowedParameters extends ExpressionParameters[] = []> =
52
56
  | T
53
57
  | Expression;
54
58
 
@@ -59,9 +63,10 @@ type Value<T, AllowedParameters extends ExpressionParameters[] = []> =
59
63
  <%- pascelCase(k) %> = '<%- k %>',
60
64
  <%_ } _%>
61
65
  }
66
+ type <%- pascelCase(enumInfo.name) %>EnumValues = <%- Object.keys(enumInfo.values).map(k => `'${k}'`).join(' | ') %>;
62
67
  <%_ } _%>
63
68
 
64
- type Enum<EnumType> = EnumType | keyof EnumType;
69
+ type Enum<EnumType, EnumValues> = EnumType | EnumValues;
65
70
 
66
71
  <%_ for (let layer of layers) { _%>
67
72
  export interface <%- pascelCase(layer.name) %>LayerStyleProps {
@@ -20,6 +20,7 @@ import com.mapbox.maps.extension.style.layers.generated.SymbolLayer;
20
20
  import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer;
21
21
  import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer;
22
22
  import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere;
23
+ import com.mapbox.maps.extension.style.terrain.generated.Terrain;
23
24
  // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility;
24
25
  import com.mapbox.maps.extension.style.layers.properties.generated.*;
25
26
  import com.mapbox.maps.extension.style.types.StyleTransition;
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- /plugin/build
@@ -1,46 +0,0 @@
1
- /* eslint react/prop-types:0 */
2
- import React from 'react';
3
- import { processColor } from 'react-native';
4
-
5
- import { getFilter } from '../utils/filterUtils';
6
- import { transformStyle } from '../utils/StyleValue';
7
-
8
- class AbstractLayer extends React.PureComponent {
9
- get baseProps() {
10
- return {
11
- ...this.props,
12
- id: this.props.id,
13
- sourceID: this.props.sourceID,
14
- reactStyle: this.getStyle(this.props.style),
15
- minZoomLevel: this.props.minZoomLevel,
16
- maxZoomLevel: this.props.maxZoomLevel,
17
- aboveLayerID: this.props.aboveLayerID,
18
- belowLayerID: this.props.belowLayerID,
19
- layerIndex: this.props.layerIndex,
20
- filter: getFilter(this.props.filter),
21
- style: undefined,
22
- };
23
- }
24
-
25
- getStyleTypeFormatter(styleType) {
26
- if (styleType === 'color') {
27
- return processColor;
28
- }
29
- }
30
-
31
- getStyle(style) {
32
- return transformStyle(style);
33
- }
34
-
35
- setNativeProps(props) {
36
- if (this.refs.nativeLayer) {
37
- let propsToPass = props;
38
- if (props.style) {
39
- propsToPass = { ...props, reactStyle: this.getStyle(props.style) };
40
- }
41
- this.refs.nativeLayer.setNativeProps(propsToPass);
42
- }
43
- }
44
- }
45
-
46
- export default AbstractLayer;
@@ -1,120 +0,0 @@
1
- import React from 'react';
2
- import { View, NativeModules, requireNativeComponent } from 'react-native';
3
- import PropTypes from 'prop-types';
4
-
5
- import { viewPropTypes } from '../utils';
6
- import { SymbolLayerStyleProp } from '../utils/styleMap';
7
-
8
- import AbstractLayer from './AbstractLayer';
9
-
10
- const MapboxGL = NativeModules.MGLModule;
11
-
12
- export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer';
13
-
14
- /**
15
- * SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
16
- */
17
- class SymbolLayer 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
- SymbolLayerStyleProp,
73
- PropTypes.arrayOf(SymbolLayerStyleProp),
74
- ]),
75
- };
76
-
77
- static defaultProps = {
78
- sourceID: MapboxGL.StyleSource.DefaultSourceID,
79
- };
80
-
81
- _shouldSnapshot() {
82
- let isSnapshot = false;
83
-
84
- if (React.Children.count(this.props.children) <= 0) {
85
- return isSnapshot;
86
- }
87
-
88
- React.Children.forEach(this.props.children, (child) => {
89
- if (child.type === View) {
90
- isSnapshot = true;
91
- }
92
- });
93
-
94
- return isSnapshot;
95
- }
96
-
97
- render() {
98
- const props = {
99
- ...this.baseProps,
100
- snapshot: this._shouldSnapshot(),
101
- sourceLayerID: this.props.sourceLayerID,
102
- };
103
-
104
- return (
105
- <RCTMGLSymbolLayer ref="nativeLayer" {...props}>
106
- {this.props.children}
107
- </RCTMGLSymbolLayer>
108
- );
109
- }
110
- }
111
-
112
- const RCTMGLSymbolLayer = requireNativeComponent(
113
- NATIVE_MODULE_NAME,
114
- SymbolLayer,
115
- {
116
- nativeOnly: { reactStyle: true, snapshot: true },
117
- },
118
- );
119
-
120
- export default SymbolLayer;
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { NativeModules, requireNativeComponent } from 'react-native';
4
-
5
- import { viewPropTypes } from '../utils';
6
-
7
- import AbstractLayer from './AbstractLayer';
8
-
9
- const MapboxGL = NativeModules.MGLModule;
10
-
11
- export const NATIVE_MODULE_NAME = 'RCTMGLTerrain';
12
-
13
- /**
14
- * A global modifier that elevates layers and markers based on a DEM data source.
15
- */
16
- class Terrain extends React.PureComponent {
17
- static propTypes = {
18
- ...viewPropTypes,
19
-
20
- /**
21
- * Name of a source of raster_dem type to be used for terrain elevation.
22
- */
23
- sourceID: PropTypes.string,
24
-
25
- /**
26
- * Optional number between 0 and 1000 inclusive. Defaults to 1. Supports interpolateexpressions. Transitionable.
27
- * Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.
28
- */
29
- exaggeration: PropTypes.oneOfType([PropTypes.number, PropTypes.array]),
30
- };
31
-
32
- static defaultProps = {
33
- sourceID: MapboxGL.StyleSource.DefaultSourceID,
34
- };
35
-
36
- get baseProps() {
37
- return {
38
- ...this.props,
39
- sourceID: this.props.sourceID,
40
- };
41
- }
42
-
43
- render() {
44
- const props = {
45
- ...this.baseProps,
46
- sourceID: this.props.sourceID,
47
- };
48
- return <RCTMGLTerrain ref="nativeLayer" {...props} />;
49
- }
50
- }
51
-
52
- const RCTMGLTerrain = requireNativeComponent(NATIVE_MODULE_NAME, Terrain, {
53
- nativeOnly: { reactStyle: true },
54
- });
55
-
56
- export default Terrain;
@@ -1,24 +0,0 @@
1
- /**
2
- * Copy properties from origObject to newObject, which not exists in newObject,
3
- * calls onDeprecatedCalled callback in case a copied property is invoked.
4
- */
5
-
6
- export function copyPropertiesAsDeprecated(
7
- origObject,
8
- newObject,
9
- onDeprecatedCalled,
10
- accessors = {},
11
- ) {
12
- const result = newObject;
13
- for (const [key, value] of Object.entries(origObject)) {
14
- if (!newObject[key]) {
15
- Object.defineProperty(result, key, {
16
- get() {
17
- onDeprecatedCalled(key);
18
- return accessors[key] ? accessors[key](value) : value;
19
- },
20
- });
21
- }
22
- }
23
- return result;
24
- }