UNPKG

create-expo-cljs-app

Version:

Create a react native application with Expo and Shadow-CLJS!

79 lines (65 loc) 2.01 kB
"use strict"; exports.__esModule = true; exports.default = validate; var _warning = _interopRequireDefault(require("fbjs/lib/warning")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Copyright (c) Nicolas Gallagher. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ var invalidShortforms = { background: true, borderBottom: true, borderLeft: true, borderRight: true, borderTop: true, font: true, grid: true, outline: true, textDecoration: true }; function error(message) { (0, _warning.default)(false, message); } function validate(key, styles) { var obj = styles[key]; for (var k in obj) { var prop = k.trim(); var value = obj[prop]; var isInvalid = false; if (value === null) { continue; } if (typeof value === 'string' && value.indexOf('!important') > -1) { error("Invalid style declaration \"" + prop + ":" + value + "\". Values cannot include \"!important\""); isInvalid = true; } else { var suggestion = ''; if (prop === 'animation' || prop === 'animationName') { suggestion = 'Did you mean "animationKeyframes"?'; // } else if (prop === 'boxShadow') { // suggestion = 'Did you mean "shadow{Color,Offset,Opacity,Radius}"?'; isInvalid = true; } else if (prop === 'direction') { suggestion = 'Did you mean "writingDirection"?'; isInvalid = true; } else if (prop === 'verticalAlign') { suggestion = 'Did you mean "textAlignVertical"?'; isInvalid = true; } else if (invalidShortforms[prop]) { suggestion = 'Please use long-form properties.'; isInvalid = true; } if (suggestion !== '') { error("Invalid style property of \"" + prop + "\". " + suggestion); } } if (isInvalid) { delete obj[k]; } } } module.exports = exports.default;