diff --git a/src/renderers/art/ReactARTFiber.js b/src/renderers/art/ReactARTFiber.js index 86b04e5e1c..2aa02b151a 100644 --- a/src/renderers/art/ReactARTFiber.js +++ b/src/renderers/art/ReactARTFiber.js @@ -292,7 +292,7 @@ class RadialGradient { } applyFill(node) { - node.fillRadial.apply(node, this.args); + node.fillRadial.apply(node, this._args); } } @@ -302,7 +302,7 @@ class Pattern { } applyFill(node) { - node.fillImage.apply(node, this.args); + node.fillImage.apply(node, this._args); } } @@ -361,6 +361,30 @@ class Surface extends Component { } } +class Text extends React.Component { + constructor(props) { + super(props); + // We allow reading these props. Ideally we could expose the Text node as + // ref directly. + for (const key of ['height', 'width', 'x', 'y']) { + Object.defineProperty(this, key, { + get: function() { + return this._text ? this._text[key] : undefined; + }, + }); + } + } + render() { + // This means you can't have children that render into strings... + const T = TYPES.TEXT; + return ( + this._text = t}> + {childrenAsString(this.props.children)} + + ); + } +} + /** ART Renderer */ const ARTRenderer = ReactFiberReconciler({ @@ -506,10 +530,6 @@ module.exports = { RadialGradient, Shape: TYPES.SHAPE, Surface, - Text: function Text(props) { - // TODO: This means you can't have children that render into strings. - const T = TYPES.TEXT; - return {childrenAsString(props.children)}; - }, + Text: Text, Transform, };