mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-30 04:21:08 +00:00
84 lines
2.1 KiB
JavaScript
84 lines
2.1 KiB
JavaScript
import React from 'react';
|
|||
|
|
import PropTypes from 'prop-types';
|
||
|
|
import { NativeModules, requireNativeComponent } from 'react-native';
|
||
|
|
|
||
|
|
import { SymbolLayerStyleProp } from '../utils/styleMap';
|
||
|
|
import AbstractLayer from './AbstractLayer';
|
||
|
|
|
||
|
|
const MapboxGL = NativeModules.MGLModule;
|
||
|
|
|
||
|
|
export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer';
|
||
|
|
|
||
|
|
const RCTMGLSymbolLayer = requireNativeComponent(NATIVE_MODULE_NAME, SymbolLayer);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
|
||
|
|
*/
|
||
|
|
class SymbolLayer extends AbstractLayer {
|
||
|
|
static propTypes = {
|
||
|
|
/**
|
||
|
|
* A string that uniquely identifies the source in the style to which it is added.
|
||
|
|
*/
|
||
|
|
id: PropTypes.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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.
|
||
|
|
*/
|
||
|
|
sourceID: PropTypes.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.
|
||
|
|
*/
|
||
|
|
sourceLayerID: PropTypes.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Inserts a layer above aboveLayerID.
|
||
|
|
*/
|
||
|
|
aboveLayerID: PropTypes.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Inserts a layer below belowLayerID
|
||
|
|
*/
|
||
|
|
belowLayerID: PropTypes.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Inserts a layer at a specified index
|
||
|
|
*/
|
||
|
|
layerIndex: PropTypes.number,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Filter only the features in the source layer that satisfy a condition that you define
|
||
|
|
*/
|
||
|
|
filter: PropTypes.array,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The minimum zoom level at which the layer gets parsed and appears.
|
||
|
|
*/
|
||
|
|
minZoomLevel: PropTypes.number,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The maximum zoom level at which the layer gets parsed and appears.
|
||
|
|
*/
|
||
|
|
maxZoomLevel: PropTypes.number,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Customizable style attributes
|
||
|
|
*/
|
||
|
|
style: SymbolLayerStyleProp,
|
||
|
|
};
|
||
|
|
|
||
|
|
static defaultProps = {
|
||
|
|
sourceID: MapboxGL.StyleSource.DefaultSourceID,
|
||
|
|
};
|
||
|
|
|
||
|
|
render () {
|
||
|
|
const props = {
|
||
|
|
...this.baseProps,
|
||
|
|
sourceLayerID: this.props.sourceLayerID,
|
||
|
|
};
|
||
|
|
return <RCTMGLSymbolLayer {...props} />;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default SymbolLayer;
|