Skip to content

Commit 69bb2db

Browse files
ferdicusYour Name
and
Your Name
authored
fix(layer, sources): id is required (#989)
* id is required * mandatory id * update docs Co-authored-by: Your Name <you@example.com>
1 parent a937a8c commit 69bb2db

23 files changed

+36
-35
lines changed

docs/BackgroundLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/CircleLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style.<br/>If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property<br/>from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/FillExtrusionLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/FillLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/HeatmapLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style.<br/>If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property<br/>from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/ImageSource.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source. |
99
| url | `union` | `none` | `false` | An HTTP(S) URL, absolute file URL, or local file URL to the source image.<br/>Gifs are currently not supported. |
1010
| coordinates | `array` | `none` | `true` | The top left, top right, bottom right, and bottom left coordinates for the image. |
1111

docs/LineLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style.<br/>If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/RasterLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/SymbolLayer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### props
66
| Prop | Type | Default | Required | Description |
77
| ---- | :--: | :-----: | :------: | :----------: |
8-
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
8+
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
99
| sourceID | `string` | `MapboxGL.StyleSource.DefaultSourceID` | `false` | The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. |
1010
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
1111
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |

docs/docs.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"props": [
77
{
88
"name": "id",
9-
"required": false,
9+
"required": true,
1010
"type": "string",
1111
"default": "none",
1212
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -749,7 +749,7 @@
749749
"props": [
750750
{
751751
"name": "id",
752-
"required": false,
752+
"required": true,
753753
"type": "string",
754754
"default": "none",
755755
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -1090,7 +1090,7 @@
10901090
"props": [
10911091
{
10921092
"name": "id",
1093-
"required": false,
1093+
"required": true,
10941094
"type": "string",
10951095
"default": "none",
10961096
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -1341,7 +1341,7 @@
13411341
"props": [
13421342
{
13431343
"name": "id",
1344-
"required": false,
1344+
"required": true,
13451345
"type": "string",
13461346
"default": "none",
13471347
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -1601,7 +1601,7 @@
16011601
"props": [
16021602
{
16031603
"name": "id",
1604-
"required": false,
1604+
"required": true,
16051605
"type": "string",
16061606
"default": "none",
16071607
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -1818,7 +1818,7 @@
18181818
"props": [
18191819
{
18201820
"name": "id",
1821-
"required": false,
1821+
"required": true,
18221822
"type": "string",
18231823
"default": "none",
18241824
"description": "A string that uniquely identifies the source."
@@ -2000,7 +2000,7 @@
20002000
"props": [
20012001
{
20022002
"name": "id",
2003-
"required": false,
2003+
"required": true,
20042004
"type": "string",
20052005
"default": "none",
20062006
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -3216,7 +3216,7 @@
32163216
"props": [
32173217
{
32183218
"name": "id",
3219-
"required": false,
3219+
"required": true,
32203220
"type": "string",
32213221
"default": "none",
32223222
"description": "A string that uniquely identifies the source in the style to which it is added."
@@ -3751,7 +3751,7 @@
37513751
"props": [
37523752
{
37533753
"name": "id",
3754-
"required": false,
3754+
"required": true,
37553755
"type": "string",
37563756
"default": "none",
37573757
"description": "A string that uniquely identifies the source in the style to which it is added."

index.d.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export interface CalloutProps extends Omit<ViewProps, 'style'> {
729729
}
730730

731731
export interface TileSourceProps extends ViewProps {
732-
id?: string;
732+
id: string;
733733
url?: string;
734734
tileUrlTemplates?: Array<string>;
735735
minZoomLevel?: number;
@@ -745,7 +745,7 @@ export interface VectorSourceProps extends TileSourceProps {
745745
}
746746

747747
export interface ShapeSourceProps extends ViewProps {
748-
id?: string;
748+
id: string;
749749
url?: string;
750750
shape?: GeoJSON.GeometryCollection | GeoJSON.Feature | GeoJSON.FeatureCollection;
751751
cluster?: boolean;
@@ -767,7 +767,7 @@ export interface RasterSourceProps extends TileSourceProps {
767767
}
768768

769769
export interface LayerBaseProps<T = {}> extends Omit<ViewProps, 'style'> {
770-
id?: string;
770+
id: string;
771771
sourceID?: MapboxGL.StyleSource;
772772
sourceLayerID?: string;
773773
aboveLayerID?: string;
@@ -786,7 +786,8 @@ export interface CircleLayerProps extends LayerBaseProps {
786786
style?: StyleProp<CircleLayerStyle>;
787787
}
788788

789-
export interface FillExtrusionLayerProps extends LayerBaseProps {
789+
export interface FillExtrusionLayerProps extends Omit<LayerBaseProps, 'id'> {
790+
id: string;
790791
style?: StyleProp<FillExtrusionLayerStyle>;
791792
}
792793

@@ -815,7 +816,7 @@ export interface ImagesProps extends ViewProps {
815816
}
816817

817818
export interface ImageSourceProps extends ViewProps {
818-
id?: string;
819+
id: string;
819820
url?: number | string;
820821
coordinates: [
821822
GeoJSON.Position,

javascript/components/BackgroundLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BackgroundLayer extends AbstractLayer {
1818
/**
1919
* A string that uniquely identifies the source in the style to which it is added.
2020
*/
21-
id: PropTypes.string,
21+
id: PropTypes.string.isRequired,
2222

2323
/**
2424
* The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

javascript/components/CircleLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CircleLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style.

javascript/components/FillExtrusionLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FillExtrusionLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

javascript/components/FillLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FillLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

javascript/components/HeatmapLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class HeatmapLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style.

javascript/components/ImageSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ImageSource extends AbstractSource {
2424
/**
2525
* A string that uniquely identifies the source.
2626
*/
27-
id: PropTypes.string,
27+
id: PropTypes.string.isRequired,
2828

2929
/**
3030
* An HTTP(S) URL, absolute file URL, or local file URL to the source image.

javascript/components/LineLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LineLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style.

javascript/components/RasterLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RasterLayer extends AbstractLayer {
1818
/**
1919
* A string that uniquely identifies the source in the style to which it is added.
2020
*/
21-
id: PropTypes.string,
21+
id: PropTypes.string.isRequired,
2222

2323
/**
2424
* The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

javascript/components/RasterSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class RasterSource extends AbstractSource {
2626
/**
2727
* A string that uniquely identifies the source.
2828
*/
29-
id: PropTypes.string,
29+
id: PropTypes.string.isRequired,
3030

3131
/**
3232
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.

javascript/components/ShapeSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ShapeSource extends NativeBridgeComponent(AbstractSource) {
3232
/**
3333
* A string that uniquely identifies the source.
3434
*/
35-
id: PropTypes.string,
35+
id: PropTypes.string.isRequired,
3636

3737
/**
3838
* An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle.

javascript/components/SymbolLayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SymbolLayer extends AbstractLayer {
2121
/**
2222
* A string that uniquely identifies the source in the style to which it is added.
2323
*/
24-
id: PropTypes.string,
24+
id: PropTypes.string.isRequired,
2525

2626
/**
2727
* The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined.

javascript/components/VectorSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VectorSource extends NativeBridgeComponent(AbstractSource) {
2929
/**
3030
* A string that uniquely identifies the source.
3131
*/
32-
id: PropTypes.string,
32+
id: PropTypes.string.isRequired,
3333

3434
/**
3535
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.

0 commit comments

Comments
 (0)