Add G element

Add G element
This commit is contained in:
Horcrux
2016-01-22 18:41:52 +08:00
parent 815540fc28
commit b871e0087e
11 changed files with 181 additions and 19 deletions
+45
View File
@@ -0,0 +1,45 @@
import React, {
ART,
Component,
Children,
cloneElement
} from 'react-native';
let {
Group
} = ART;
const transformProps = {
scale: null,
scaleX: null,
scaleY: null,
rotate: null,
transform: null,
x: null,
y: null,
originX: null,
originY: null
};
class G extends Component{
static displayName = 'G';
constructor() {
super(...arguments);
this.children = Children.map(this.props.children, child => cloneElement(child, {
id: null,
...this.props,
...transformProps,
children: child.children,
...child.props
}));
};
render() {
return <Group
{...this.props}
>{this.children}</Group>;
}
}
export default G;