react-native-form-model
Version:
An easily testable and opinionated React Native form model builder written in pure JavaScript.
57 lines (56 loc) • 1.74 kB
TypeScript
import { TextStyle } from 'react-native';
declare global {
namespace ReactNativePaper {
interface PaperThemeWithForm extends Theme {
form: Required<FormStyle>;
}
}
}
export interface PaperThemeWithForm extends ReactNativePaper.PaperThemeWithForm {
}
declare type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>;
};
export interface FormStyle {
sectionMargin?: number;
roundness?: number;
rowHeight?: number;
fieldHeight?: number;
fontSize?: number;
errorFontSize?: number;
fontWeight?: TextStyle['fontWeight'];
inputFontWeight?: TextStyle['fontWeight'];
sectionTitleAlign?: TextStyle['textAlign'];
sectionFooterAlign?: TextStyle['textAlign'];
containedTextBorderWidth?: number;
colors: FormColors;
paddingLeft?: number;
paddingRight?: number;
paddingTop?: number;
paddingBottom?: number;
marginLeft?: number;
marginRight?: number;
marginTop?: number;
marginBottom?: number;
}
export declare type PartialFormStyle = DeepPartial<FormStyle>;
export interface FormColors {
label?: string;
input?: string;
error?: string;
disabled?: string;
destructive?: string;
buttonForeground?: string;
buttonBackground?: string;
sectionTitle?: string;
sectionFooter?: string;
divider?: string;
formBackground?: string;
containedTextBorder?: string;
containedTextBackground?: string;
}
export declare type RequiredFormColors = Required<Omit<FormColors, 'formBackground'>>;
export declare const kDefaultLightFormColors: RequiredFormColors;
export declare const kDefaultDarkFormColors: RequiredFormColors;
export declare const kDefaultFormStyle: Required<FormStyle>;
export {};