first step of TSpan

This commit is contained in:
Horcrux
2016-08-30 09:37:38 +08:00
parent e78e5db092
commit bd26c04a1d
10 changed files with 400 additions and 137 deletions
+40
View File
@@ -0,0 +1,40 @@
import React, {PropTypes} from 'react';
import createReactNativeComponentClass from 'react/lib/createReactNativeComponentClass';
import {numberProp, pathProps} from '../lib/props';
import {TSpanAttributes} from '../lib/attributes';
import extractFrame from '../lib/extract/extractFrame';
import Shape from './Shape';
class TSpan extends Shape {
static displayName = 'TSpan';
static propTypes = {
...pathProps,
dx: numberProp,
dy: numberProp,
textAnchor: PropTypes.oneOf(['start', 'middle', 'end']),
fontFamily: PropTypes.string,
fontSize: numberProp,
fontWeight: PropTypes.string,
fontStyle: PropTypes.string,
font: PropTypes.object
};
setNativeProps = (...args) => {
this.root.setNativeProps(...args);
};
render() {
return <RNSVGTSpan
ref={ele => {this.root = ele;}}
{...extractFrame(this.props)}
/>;
}
}
const RNSVGTSpan = createReactNativeComponentClass({
validAttributes: TSpanAttributes,
uiViewClassName: 'RNSVGTSpan'
});
export default TSpan;