UNPKG

react-native-form-model

Version:

An easily testable and opinionated React Native form model builder written in pure JavaScript.

23 lines (22 loc) 839 B
import FormElement, { FormElementOptions } from './FormElement'; import { FormStyle } from './FormStyle'; import SectionModel, { SectionModelOptions } from './SectionModel'; declare type ForwardElementOptions = Omit<FormElementOptions, 'form'>; export interface FormModelOptions extends ForwardElementOptions { showErrors?: boolean; onSubmit?: () => void; } export default class FormModel extends FormElement { sections: SectionModel[]; showErrors: boolean; style?: FormStyle; onSubmit: () => void; get form(): FormModel; set form(form: FormModel); constructor(options?: FormModelOptions); static create(options?: FormModelOptions): FormModel; static empty(): FormModel; reset(): void; addSection(options?: Omit<SectionModelOptions, 'form' | 'sectionIndex'>): SectionModel; } export {};