Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 680 Bytes

File metadata and controls

31 lines (26 loc) · 680 Bytes

react-native-app-helpers/CustomTextTableColumn

Describes the schema of a column in a table which has a custom text renderer.

Usage

import type { CustomTextTableColumn } from "react-native-app-helpers";

type TableRow = {
  readonly columnA: null | string;
  readonly columnB: null | number;
  readonly columnC: 0 | 1 | 2 | 3;
  readonly columnD: null | boolean;
};

const example: CustomTextTableColumn<
  `exampleKeyA` | `exampleKeyB`,
  `exampleKeyC` | `exampleKeyD`,
  TableRow,
  `Example Context`
> = {
  type: `customText`,
  key: `exampleKeyA`,
  label: `Example Label B`,
  width: 5,
  render(value, context) {
    return `Prefixed ${value}`;
  },
};