add clipping js code

This commit is contained in:
Horcrux
2016-04-21 15:44:25 +08:00
parent c8aaa1eb12
commit fa1aea094a
19 changed files with 78 additions and 29 deletions
+18
View File
@@ -0,0 +1,18 @@
import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath';
const clipRules = {
evenodd: 0,
nonzero: 1
};
export default function (props) {
let {clipPath, clipRule} = props;
let clippingProps = {};
if (clipPath) {
clippingProps.clipPath = new SerializablePath(clipPath).toJSON();
clippingProps.clipRule = clipRules[clipRule] === 0 ? 0 : 1;
}
return clippingProps;
}