Files
react-native-mapbox-gl/scripts/templates/styleMap.js.ejs
T

87 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<%
const layers = locals.layers;
-%>
/* eslint-disable */
// DO NOT MODIFY
// THIS FILE IS AUTOGENERATED
import PropTypes from 'prop-types';
export const StyleTypes = {
Constant: 'constant',
Color: 'color',
Transition: 'transition',
Translation: 'translation',
Function: 'function',
Image: 'image',
};
export const StyleFunctionTypes = {
Camera: 'camera',
Source: 'source',
Composite: 'composite',
};
export const StyleFunctionPropType = PropTypes.shape({
type: PropTypes.string.isRequired,
payload: PropTypes.shape({
fn: PropTypes.string,
attributeName: PropTypes.string,
stops: PropTypes.object,
mode: PropTypes.any,
}).isRequired,
});
export const TransitionPropType = PropTypes.shape({
duration: PropTypes.number,
delay: PropTypes.number,
});
export const TranslationPropType = PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
});
<%_ for (let layer of layers) { _%>
export const <%- pascelCase(layer.name) _%>LayerStyleProp = PropTypes.shape({
<%_ for (let prop of layer.properties) { %>
/**
* <%- prop.doc.description %>
<%_ if (prop.doc.requires.length) { _%>
*
* @requires <%- prop.doc.requires.join(', ') %>
<%_ } _%>
<%_ if (prop.doc.disabledBy.length) { _%>
*
* @disabledBy <%- prop.doc.disabledBy.join(', ') %>
<%_ } _%>
*/
<%= prop.name %>: <%- jsDocReactProp(prop) %>,
<%_ if (prop.transition) { %>
/**
* The transition affecting any changes to this layers <%= prop.name %> property.
*/
<%= prop.name %>Transition: TransitionPropType,
<%_ } _%>
<%_ } _%>
});
<%_ } _%>
const styleMap = {
<%_ for (let layer of layers) { _%>
<%_ for (let prop of layer.properties) { _%>
<%_ if (prop.name !== 'visibility') { _%>
<%= prop.name %>: <%- jsStyleType(prop) %>,
<%_ if (prop.transition) { _%>
<%= prop.name %>Transition: StyleTypes.Transition,
<%_ } _%>
<%_ } _%>
<%_ } _%>
<%_ } _%>
visibility: StyleTypes.Constant,
};
export default styleMap;