react-native-form-model
Version:
An easily testable and opinionated React Native form model builder written in pure JavaScript.
19 lines (18 loc) • 909 B
TypeScript
/// <reference types="react" />
import { MaybeObservable } from '../util/reactUtil';
import FormElement, { FormElementOptions } from './FormElement';
import RowModel, { RowModelOptions } from './RowModel';
export interface SectionModelOptions extends FormElementOptions {
sectionIndex: number;
title?: MaybeObservable<string> | (() => React.ReactNode);
footer?: MaybeObservable<string> | (() => React.ReactNode);
}
export default class SectionModel extends FormElement {
title: MaybeObservable<string> | (() => React.ReactNode);
footer: MaybeObservable<string> | (() => React.ReactNode);
rows: RowModel[];
constructor(options: SectionModelOptions);
addRow(options?: Omit<RowModelOptions, 'form' | 'sectionIndex' | 'rowIndex'>): RowModel;
setTitle(title: Required<SectionModelOptions>['title']): this;
setFooter(footer: Required<SectionModelOptions>['footer']): this;
}