Skip to content

Commit

Permalink
fix(layer, sources): id is required (rnmapbox#989)
Browse files Browse the repository at this point in the history
* id is required

* mandatory id

* update docs

Co-authored-by: Your Name <you@example.com>
  • Loading branch information
ferdicus and Your Name authored Sep 7, 2020
1 parent a937a8c commit 69bb2db
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion docs/BackgroundLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/CircleLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/FillExtrusionLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/FillLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/HeatmapLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/ImageSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source. |
| 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. |
| coordinates | `array` | `none` | `true` | The top left, top right, bottom right, and bottom left coordinates for the image. |

Expand Down
2 changes: 1 addition & 1 deletion docs/LineLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/RasterLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
2 changes: 1 addition & 1 deletion docs/SymbolLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| id | `string` | `none` | `false` | A string that uniquely identifies the source in the style to which it is added. |
| id | `string` | `none` | `true` | A string that uniquely identifies the source in the style to which it is added. |
| 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. |
| 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. |
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
Expand Down
18 changes: 9 additions & 9 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -749,7 +749,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -1090,7 +1090,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -1341,7 +1341,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -1601,7 +1601,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -1818,7 +1818,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source."
Expand Down Expand Up @@ -2000,7 +2000,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -3216,7 +3216,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down Expand Up @@ -3751,7 +3751,7 @@
"props": [
{
"name": "id",
"required": false,
"required": true,
"type": "string",
"default": "none",
"description": "A string that uniquely identifies the source in the style to which it is added."
Expand Down
11 changes: 6 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ export interface CalloutProps extends Omit<ViewProps, 'style'> {
}

export interface TileSourceProps extends ViewProps {
id?: string;
id: string;
url?: string;
tileUrlTemplates?: Array<string>;
minZoomLevel?: number;
Expand All @@ -745,7 +745,7 @@ export interface VectorSourceProps extends TileSourceProps {
}

export interface ShapeSourceProps extends ViewProps {
id?: string;
id: string;
url?: string;
shape?: GeoJSON.GeometryCollection | GeoJSON.Feature | GeoJSON.FeatureCollection;
cluster?: boolean;
Expand All @@ -767,7 +767,7 @@ export interface RasterSourceProps extends TileSourceProps {
}

export interface LayerBaseProps<T = {}> extends Omit<ViewProps, 'style'> {
id?: string;
id: string;
sourceID?: MapboxGL.StyleSource;
sourceLayerID?: string;
aboveLayerID?: string;
Expand All @@ -786,7 +786,8 @@ export interface CircleLayerProps extends LayerBaseProps {
style?: StyleProp<CircleLayerStyle>;
}

export interface FillExtrusionLayerProps extends LayerBaseProps {
export interface FillExtrusionLayerProps extends Omit<LayerBaseProps, 'id'> {
id: string;
style?: StyleProp<FillExtrusionLayerStyle>;
}

Expand Down Expand Up @@ -815,7 +816,7 @@ export interface ImagesProps extends ViewProps {
}

export interface ImageSourceProps extends ViewProps {
id?: string;
id: string;
url?: number | string;
coordinates: [
GeoJSON.Position,
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/BackgroundLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BackgroundLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/CircleLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CircleLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* The source from which to obtain the data to style.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/FillExtrusionLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FillExtrusionLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/FillLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FillLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/HeatmapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HeatmapLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* The source from which to obtain the data to style.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/ImageSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ImageSource extends AbstractSource {
/**
* A string that uniquely identifies the source.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* An HTTP(S) URL, absolute file URL, or local file URL to the source image.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/LineLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class LineLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* The source from which to obtain the data to style.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/RasterLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RasterLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/RasterSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RasterSource extends AbstractSource {
/**
* A string that uniquely identifies the source.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* A URL to a TileJSON configuration file describing the source’s contents and other metadata.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/ShapeSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ShapeSource extends NativeBridgeComponent(AbstractSource) {
/**
* A string that uniquely identifies the source.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/SymbolLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SymbolLayer extends AbstractLayer {
/**
* A string that uniquely identifies the source in the style to which it is added.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion javascript/components/VectorSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class VectorSource extends NativeBridgeComponent(AbstractSource) {
/**
* A string that uniquely identifies the source.
*/
id: PropTypes.string,
id: PropTypes.string.isRequired,

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

0 comments on commit 69bb2db

Please sign in to comment.