-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
168 lines (151 loc) · 4.86 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
import { SelectPickerSection } from './src/models/selectPickerSection';
declare module 'react-native-declarative-ui' {
import { ScrollViewProperties } from 'react-native';
import { CalendarTheme } from 'react-native-calendars';
export type ComposableItem = {
[key: string]: unknown;
};
type Validation = string | string[] | { [key: string]: string[][] };
interface ComposableFormProps<T> {
model: T;
structure: ComposableStructure;
onChange: (id: string, value?: unknown) => void;
onSave?: () => void;
onClear?: () => void;
onFocus?: (input: TextInput) => void;
onFormFilled: (isFilled: boolean) => void;
backgroundColor?: string;
loadingMapper?: {
[id: string]: boolean;
};
pickerMapper?: {
[id: string]: ComposableItem[] | string[];
};
sectionPickerMapper?: {
[id: string]: SelectPickerSection[];
}
searchMapper?: {
[id: string]: (filterText?: string) => Promise<ComposableItem[] | string[]>;
};
createNewItemMapper?: {
[id: string]: {
label: string | null;
callback: () => void | null;
};
};
emptySetMapper?: {
[id: string]: () => (React.ComponentType<any> | React.ReactElement);
};
externalModel?: T;
customStyle?: ComposableFormOptions;
customComponents?: ComposableFormCustomComponents;
googleApiKey?: string;
dynamicValidations?: unknown;
durationPickerConfiguration?: {
maxHours?: number;
hoursInterval?: number;
maxMinutes?: number;
minutesInterval?: number;
disableZeroDuration?: boolean;
}
}
export class ComposableForm<T> extends React.Component<ComposableFormProps<T>, any> { }
export type ComposableFormOptions = {
formContainer?: {
externalPadding?: number;
inlinePadding?: number;
backgroundColor?: string;
};
textFields?: {
backgroundColor?: string;
disabledBackgroundColor?: string;
floatingLabelColor?: string;
focusedFloatingLabelColor?: string;
errorFloatingLabelColor?: string;
disabledFloatingLabelColor?: string;
color?: string;
descriptionColor?: string;
disabledColor?: string;
borderColor?: string;
focusedBorderColor?: string;
errorBorderColor?: string;
disabledBorderColor?: string;
selectionColor?: string;
errorMessageColor?: string;
};
checkBoxes?: {
color?: string;
urlColor?: string;
};
labels?: {
placeholderStyle?: StyleProp<TextStyle>;
inputStyle?: StyleProp<TextStyle>;
};
calendars?: {
singleDayTheme?: CalendarTheme;
};
pickers?: {
knobColor?: string;
headerBackgroundColor?: string;
headerButtonColor?: string;
headerButtonDisabledColor?: string;
renderCustomBackground?: () => React.ReactElement<{}>;
renderCustomCancelButton?: () => React.ReactElement<{}>;
};
selectPickers?: {
selectedItemTextColor?: string;
selectedItemIconColor?: string;
createNewItemTextColor?: string;
createNewItemIconColor?: string;
};
selectSectionPickers?: {
selectedItemTextColor?: string;
selectedItemIconColor?: string;
createNewItemTextColor?: string;
createNewItemIconColor?: string;
sectionHeaderColor?: string;
sectionHeaderBackgroundColor?: string;
};
segments?: {
activeItemColor?: string;
backgroundColor?: string;
segmentActiveTextStyle?: {
color: string;
},
segmentInactiveTextStyle?: {
color: string;
}
};
toggles?: {
trackColor?: {
false: string;
true: string;
}
};
};
export type ComposableFormCustomComponents = {
renderOverlayItem?: (item: ComposableItem | string, displayProperty?: string) => React.ReactElement<{}>;
renderTopLabelItem?: (topLabel: string) => React.ReactElement<{}>;
renderToggleLabelItem?: (label: string) => React.ReactElement<{}>;
renderHeaderTitle?: (header: string) => React.ReactElement<{}>;
};
class SharedOptionsManager {
setRNNAvailable: (isAvailable: boolean) => void;
isRNNAvailable: () => boolean;
setDefaultOptions: (newOptions: ComposableFormOptions) => void;
getDefaultOptions: () => ComposableFormOptions;
setCustomComponents: (customRenderers: ComposableFormCustomComponents) => void;
getCustomComponents: () => ComposableFormCustomComponents;
setLocale: (locale: string) => void;
}
const SharedOptions: SharedOptionsManager;
export { SharedOptions };
export { ComposableFormModals };
interface IKeyboardAvoidingScrollViewProps extends ScrollViewProperties {
focusedField?: TextInput;
marginBottom?: number;
additionalOffset?: number;
}
export class KeyboardAvoidingScrollView extends React.Component<IKeyboardAvoidingScrollViewProps, any> { }
const ComposableFormModals: React.ReactElement[];
}