Files
Nick 284fc4a0ab Fixes SymbolLayer textOffset and iconOffset on iOS
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.
2017-10-23 16:41:52 -07:00

96 lines
2.1 KiB
Plaintext
Raw Permalink 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 const styleExtras = {
iconOffset: {
iosType: 'vector',
},
textOffset: {
iosType: 'vector',
},
};
export default styleMap;