mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-30 20:41:08 +00:00
There seem to be some styles that will be special cases to the rules used from the json spec this PR adds the ability to add overrides, so we can be flexible in special cases. In this case we were using a NSArray for textOffset and iconOffset when it should be a CGVector.
96 lines
2.1 KiB
Plaintext
96 lines
2.1 KiB
Plaintext
<%
|
||
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 layer’s <%= 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 const styleExtras = {
|
||
iconOffset: {
|
||
iosType: 'vector',
|
||
},
|
||
textOffset: {
|
||
iosType: 'vector',
|
||
},
|
||
};
|
||
|
||
export default styleMap;
|