Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1.28 KB

File metadata and controls

58 lines (47 loc) · 1.28 KB

react-native-app-helpers/createTextComponent

Creates a new React component which can be used to render text.

Usage

import { createTextComponent } from "react-native-app-helpers";

const ExampleText = createTextComponent(`example`, `red`, 12, `left`, false, null);

const ExampleScreen = () => (
  <ExampleText>
    Hello World! (
      in the "example" font,
      in red,
      at size 12,
      left-aligned,
      truncates with ellipsis rather than wrapping
    )
  </ExampleText>
);
import { createTextComponent } from "react-native-app-helpers";

const ExampleText = createTextComponent(`example`, `red`, 12, `left`, true, null);

const ExampleScreen = () => (
  <ExampleText>
    Hello World! (
      in the "example" font,
      in red,
      at size 12,
      left-aligned,
      wraps over multiple lines when the available width is exceeded
    )
  </ExampleText>
);
import { createTextComponent } from "react-native-app-helpers";

const ExampleText = createTextComponent(`example`, `red`, 12, `left`, false, {
  underline: true,
  strikethrough: false,
  style: `solid`, // Also: double, dotted, dashed.
  color: `blue`,
});

const ExampleScreen = () => (
  <ExampleText>
    This has text decorations applied to it as described above.
  </ExampleText>
);