Home / Class/ Text Class — react Architecture

Text Class — react Architecture

Architecture documentation for the Text class in ReactART.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a38f915d_debe_d809_56c8_b122dfdcf5ba["Text"]
  e064536f_e798_4392_8a3b_fe7d105a0a21["ReactART.js"]
  a38f915d_debe_d809_56c8_b122dfdcf5ba -->|defined in| e064536f_e798_4392_8a3b_fe7d105a0a21
  cff83ffb_5e5f_4683_1fde_cde4acabc44a["constructor()"]
  a38f915d_debe_d809_56c8_b122dfdcf5ba -->|method| cff83ffb_5e5f_4683_1fde_cde4acabc44a
  fb7d381d_27c2_ba1e_200b_9a1e9f610db3["render()"]
  a38f915d_debe_d809_56c8_b122dfdcf5ba -->|method| fb7d381d_27c2_ba1e_200b_9a1e9f610db3

Relationship Graph

Source Code

packages/react-art/src/ReactART.js lines 147–169

class Text extends React.Component {
  constructor(props) {
    super(props);
    // We allow reading these props. Ideally we could expose the Text node as
    // ref directly.
    ['height', 'width', 'x', 'y'].forEach(key => {
      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 (
      <T {...this.props} ref={t => (this._text = t)}>
        {childrenAsString(this.props.children)}
      </T>
    );
  }
}

Domain

Frequently Asked Questions

What is the Text class?
Text is a class in the react codebase, defined in packages/react-art/src/ReactART.js.
Where is Text defined?
Text is defined in packages/react-art/src/ReactART.js at line 147.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free