GT2/Ejectable/node_modules/react-native-web/dist/exports/StyleSheet/resolveShadowValue.js

36 lines
1.1 KiB
JavaScript

/**
* 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.
*
*
*/
import normalizeColor from '../../modules/normalizeColor';
import normalizeValueWithProperty from './normalizeValueWithProperty';
var defaultOffset = {
height: 0,
width: 0
};
var resolveShadowValue = function resolveShadowValue(style) {
var shadowColor = style.shadowColor,
shadowOffset = style.shadowOffset,
shadowOpacity = style.shadowOpacity,
shadowRadius = style.shadowRadius;
var _ref = shadowOffset || defaultOffset,
height = _ref.height,
width = _ref.width;
var offsetX = normalizeValueWithProperty(width);
var offsetY = normalizeValueWithProperty(height);
var blurRadius = normalizeValueWithProperty(shadowRadius || 0);
var color = normalizeColor(shadowColor || 'black', shadowOpacity);
if (color != null && offsetX != null && offsetY != null && blurRadius != null) {
return offsetX + " " + offsetY + " " + blurRadius + " " + color;
}
};
export default resolveShadowValue;