@cantoo/rn-svg
Version:
SVG library for react-native
45 lines • 1.47 kB
JavaScript
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import extractTransform from '../lib/extract/extractTransform';
import { withoutXY } from '../lib/extract/extractProps';
import units from '../lib/units';
import Shape from './Shape';
import { RNSVGMask } from './NativeComponents';
export default class Mask extends Shape {
static displayName = 'Mask';
static defaultProps = {
x: '0%',
y: '0%',
width: '100%',
height: '100%'
};
render() {
const {
props
} = this;
const {
maskTransform,
transform,
x,
y,
width,
height,
maskUnits,
maskContentUnits,
children
} = props;
const maskProps = {
x,
y,
width,
height,
maskTransform: extractTransform(maskTransform || transform || props),
maskUnits: maskUnits !== undefined ? units[maskUnits] : 0,
maskContentUnits: maskContentUnits !== undefined ? units[maskContentUnits] : 1
};
return /*#__PURE__*/React.createElement(RNSVGMask, _extends({
ref: this.refMethod
}, withoutXY(this, props), maskProps), children);
}
}
//# sourceMappingURL=Mask.js.map