@react-native-ama/forms 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/FormField.js +0 -1
- package/dist/components/FormSwitch.d.ts +1 -1
- package/dist/components/TextInput.d.ts +3 -16
- package/dist/components/TextInput.js +2 -4
- package/dist/hooks/useTextInput.d.ts +40 -35
- package/dist/index.d.ts +4 -4
- package/package.json +4 -5
- package/src/components/FormField.tsx +0 -1
- package/src/components/FormSwitch.tsx +1 -1
- package/src/components/TextInput.tsx +13 -16
- package/src/hooks/useTextInput.ts +1 -1
- package/src/index.ts +4 -4
|
@@ -41,7 +41,6 @@ const useFormField_1 = require("../hooks/useFormField");
|
|
|
41
41
|
const FormField = (_a) => {
|
|
42
42
|
var { children, wrapInsideAccessibleView = true } = _a, props = __rest(_a, ["children", "wrapInsideAccessibleView"]);
|
|
43
43
|
const viewRef = React.useRef(null);
|
|
44
|
-
// @ts-ignore
|
|
45
44
|
const formProps = (0, useFormField_1.useFormField)(Object.assign({ hasFocusCallback: false, ref: viewRef }, props));
|
|
46
45
|
return wrapInsideAccessibleView ? (<react_native_1.TouchableWithoutFeedback {...props} ref={viewRef} {...formProps}>
|
|
47
46
|
<react_native_1.View accessible>{children}</react_native_1.View>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SwitchListItemProps } from '@react-native-ama/react-native';
|
|
1
|
+
import { type SwitchListItemProps } from '@react-native-ama/react-native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export type FormSwitchProps = SwitchListItemProps;
|
|
4
4
|
export declare const FormSwitch: (props: FormSwitchProps) => React.JSX.Element;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextInput as RNTextInput, TextInputProps as RNTextInputProps } from 'react-native';
|
|
3
|
-
|
|
3
|
+
import { UseTextInput } from '../hooks/useTextInput';
|
|
4
|
+
export type TextInputProps = RNTextInputProps & Omit<UseTextInput, 'required' | 'accessibilityLabel'> & {
|
|
4
5
|
labelComponent: JSX.Element;
|
|
5
6
|
labelPosition?: 'beforeInput' | 'afterInput';
|
|
6
7
|
nextFormField?: React.RefObject<RNTextInput>;
|
|
7
8
|
id?: string;
|
|
8
9
|
nextFieldId?: string;
|
|
9
|
-
hasValidation: boolean;
|
|
10
10
|
errorComponent?: JSX.Element;
|
|
11
|
-
hasError?: boolean;
|
|
12
11
|
errorPosition?: 'belowLabel' | 'afterInput';
|
|
13
|
-
errorMessage?: string;
|
|
14
12
|
};
|
|
15
|
-
export declare const TextInput: React.ForwardRefExoticComponent<
|
|
16
|
-
labelComponent: JSX.Element;
|
|
17
|
-
labelPosition?: "beforeInput" | "afterInput" | undefined;
|
|
18
|
-
nextFormField?: React.RefObject<RNTextInput> | undefined;
|
|
19
|
-
id?: string | undefined;
|
|
20
|
-
nextFieldId?: string | undefined;
|
|
21
|
-
hasValidation: boolean;
|
|
22
|
-
errorComponent?: JSX.Element | undefined;
|
|
23
|
-
hasError?: boolean | undefined;
|
|
24
|
-
errorPosition?: "afterInput" | "belowLabel" | undefined;
|
|
25
|
-
errorMessage?: string | undefined;
|
|
26
|
-
} & React.RefAttributes<RNTextInput>>;
|
|
13
|
+
export declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<RNTextInput>>;
|
|
@@ -49,12 +49,10 @@ exports.TextInput = React.forwardRef((_a, forwardedRef) => {
|
|
|
49
49
|
React.useImperativeHandle(forwardedRef, () => inputRef.current);
|
|
50
50
|
const showLabelBeforeInput = labelPosition === 'beforeInput';
|
|
51
51
|
const accessibilityLabel = React.useMemo(() => (0, internal_2.maybeGenerateStringFromElement)(labelComponent, rest.accessibilityLabel), [labelComponent, rest.accessibilityLabel]);
|
|
52
|
-
|
|
53
|
-
const textInputProps = (0, useTextInput_1.useTextInput)(Object.assign({ required: false, ref: inputRef, id,
|
|
52
|
+
const textInputProps = (0, useTextInput_1.useTextInput)(Object.assign(Object.assign({}, rest), { ref: inputRef, id,
|
|
54
53
|
nextFieldId, nextFormFieldRef: nextFormField, hasError,
|
|
55
54
|
hasValidation,
|
|
56
|
-
errorMessage,
|
|
57
|
-
accessibilityLabel }, rest));
|
|
55
|
+
errorMessage, required: false, accessibilityLabel }));
|
|
58
56
|
const checks = __DEV__ ? core_2.useChecks === null || core_2.useChecks === void 0 ? void 0 : (0, core_2.useChecks)() : undefined;
|
|
59
57
|
__DEV__ &&
|
|
60
58
|
(checks === null || checks === void 0 ? void 0 : checks.noUndefinedProperty({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { LayoutChangeEvent, NativeSyntheticEvent, ReturnKeyTypeOptions, StyleProp, TextInputSubmitEditingEventData, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { UseFormField } from './useFormField';
|
|
4
|
-
type UseTextInput = Omit<UseFormField, 'hasFocusCallback'> & {
|
|
4
|
+
export type UseTextInput = Omit<UseFormField, 'hasFocusCallback'> & {
|
|
5
5
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
6
6
|
returnKeyType?: ReturnKeyTypeOptions;
|
|
7
7
|
onSubmitEditing?: (event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void;
|
|
@@ -35,12 +35,12 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
35
35
|
onChangeText?: ((text: string) => void) | undefined;
|
|
36
36
|
onContentSizeChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
|
|
37
37
|
onEndEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
|
|
38
|
+
onPress?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
38
39
|
onPressIn?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
39
40
|
onPressOut?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
40
41
|
onFocus?: ((e: NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
|
|
41
42
|
onSelectionChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
|
|
42
|
-
onSubmitEditing?: ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) | undefined;
|
|
43
|
-
onTextInput?: ((e: NativeSyntheticEvent<import("react-native").TextInputTextInputEventData>) => void) | undefined;
|
|
43
|
+
onSubmitEditing?: (((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) & ((event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)) | undefined;
|
|
44
44
|
onScroll?: ((e: NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
|
|
45
45
|
onKeyPress?: ((e: NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
|
|
46
46
|
placeholder?: string | undefined;
|
|
@@ -61,20 +61,21 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
61
61
|
value?: string | undefined;
|
|
62
62
|
maxFontSizeMultiplier?: number | null | undefined;
|
|
63
63
|
children?: React.ReactNode;
|
|
64
|
-
hitSlop?: import("react-native").Insets | undefined;
|
|
64
|
+
hitSlop?: number | import("react-native").Insets | null | undefined;
|
|
65
65
|
id?: string | undefined;
|
|
66
|
-
|
|
66
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
67
|
+
onLayout?: (((event: LayoutChangeEvent) => void) & ((event: LayoutChangeEvent) => void)) | undefined;
|
|
67
68
|
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
68
69
|
removeClippedSubviews?: boolean | undefined;
|
|
69
70
|
nativeID?: string | undefined;
|
|
70
71
|
collapsable?: boolean | undefined;
|
|
71
|
-
|
|
72
|
+
collapsableChildren?: boolean | undefined;
|
|
72
73
|
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
73
74
|
focusable?: boolean | undefined;
|
|
75
|
+
tabIndex?: 0 | -1 | undefined;
|
|
74
76
|
shouldRasterizeIOS?: boolean | undefined;
|
|
75
77
|
isTVSelectable?: boolean | undefined;
|
|
76
78
|
hasTVPreferredFocus?: boolean | undefined;
|
|
77
|
-
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
78
79
|
tvParallaxShiftDistanceX?: number | undefined;
|
|
79
80
|
tvParallaxShiftDistanceY?: number | undefined;
|
|
80
81
|
tvParallaxTiltAngle?: number | undefined;
|
|
@@ -122,7 +123,6 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
122
123
|
'aria-disabled'?: boolean | undefined;
|
|
123
124
|
'aria-expanded'?: boolean | undefined;
|
|
124
125
|
'aria-selected'?: boolean | undefined;
|
|
125
|
-
'aria-labelledby'?: string | undefined;
|
|
126
126
|
accessibilityHint: string;
|
|
127
127
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
128
128
|
'aria-valuemax'?: number | undefined;
|
|
@@ -132,11 +132,12 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
132
132
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
133
133
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
134
134
|
'aria-hidden'?: boolean | undefined;
|
|
135
|
-
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
136
135
|
'aria-modal'?: boolean | undefined;
|
|
137
136
|
role?: import("react-native").Role | undefined;
|
|
138
|
-
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
139
137
|
accessibilityLabelledBy?: string | string[] | undefined;
|
|
138
|
+
'aria-labelledby'?: string | undefined;
|
|
139
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
140
|
+
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
140
141
|
accessibilityElementsHidden?: boolean | undefined;
|
|
141
142
|
accessibilityViewIsModal?: boolean | undefined;
|
|
142
143
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
@@ -158,6 +159,7 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
158
159
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
159
160
|
smartInsertDelete?: boolean | undefined;
|
|
160
161
|
cursorColor?: import("react-native").ColorValue | null | undefined;
|
|
162
|
+
selectionHandleColor?: import("react-native").ColorValue | null | undefined;
|
|
161
163
|
importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
|
|
162
164
|
disableFullscreenUI?: boolean | undefined;
|
|
163
165
|
inlineImageLeft?: string | undefined;
|
|
@@ -169,20 +171,21 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
169
171
|
textAlignVertical?: "center" | "auto" | "top" | "bottom" | undefined;
|
|
170
172
|
showSoftInputOnFocus?: boolean | undefined;
|
|
171
173
|
verticalAlign?: "auto" | "top" | "bottom" | "middle" | undefined;
|
|
174
|
+
ref?: React.RefObject<any> | React.ForwardedRef<any> | undefined;
|
|
175
|
+
suppressError?: boolean | undefined;
|
|
176
|
+
hasValidation: boolean;
|
|
177
|
+
hasError?: boolean | undefined;
|
|
178
|
+
nextFieldId?: string | undefined;
|
|
179
|
+
nextFormFieldRef?: React.RefObject<any> | undefined;
|
|
180
|
+
errorMessage?: string | undefined;
|
|
181
|
+
requiredMessage?: string | undefined;
|
|
172
182
|
labelComponent?: JSX.Element | undefined;
|
|
173
183
|
labelPosition?: "beforeInput" | "afterInput" | undefined;
|
|
174
184
|
nextFormField?: React.RefObject<import("react-native").TextInput> | undefined;
|
|
175
|
-
nextFieldId?: string | undefined;
|
|
176
|
-
hasValidation: boolean;
|
|
177
185
|
errorComponent?: JSX.Element | undefined;
|
|
178
|
-
hasError?: boolean | undefined;
|
|
179
186
|
errorPosition?: "afterInput" | "belowLabel" | undefined;
|
|
180
|
-
errorMessage?: string | undefined;
|
|
181
187
|
focusNextFormField: () => void;
|
|
182
188
|
isLastField: () => boolean;
|
|
183
|
-
ref?: React.RefObject<any> | React.ForwardedRef<any> | undefined;
|
|
184
|
-
suppressError?: boolean | undefined;
|
|
185
|
-
nextFormFieldRef?: React.RefObject<any> | undefined;
|
|
186
189
|
} | {
|
|
187
190
|
allowFontScaling?: boolean | undefined;
|
|
188
191
|
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
@@ -203,12 +206,12 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
203
206
|
onChangeText?: ((text: string) => void) | undefined;
|
|
204
207
|
onContentSizeChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
|
|
205
208
|
onEndEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
|
|
209
|
+
onPress?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
206
210
|
onPressIn?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
207
211
|
onPressOut?: ((e: NativeSyntheticEvent<import("react-native").NativeTouchEvent>) => void) | undefined;
|
|
208
212
|
onFocus?: ((e: NativeSyntheticEvent<import("react-native").TextInputFocusEventData>) => void) | undefined;
|
|
209
213
|
onSelectionChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
|
|
210
|
-
onSubmitEditing?: ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) | undefined;
|
|
211
|
-
onTextInput?: ((e: NativeSyntheticEvent<import("react-native").TextInputTextInputEventData>) => void) | undefined;
|
|
214
|
+
onSubmitEditing?: (((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) & ((event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)) | undefined;
|
|
212
215
|
onScroll?: ((e: NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
|
|
213
216
|
onKeyPress?: ((e: NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
|
|
214
217
|
placeholder?: string | undefined;
|
|
@@ -223,27 +226,28 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
223
226
|
end?: number | undefined;
|
|
224
227
|
} | undefined;
|
|
225
228
|
selectionColor?: import("react-native").ColorValue | undefined;
|
|
226
|
-
style?:
|
|
229
|
+
style?: ViewStyle | undefined;
|
|
227
230
|
textAlign?: "center" | "left" | "right" | undefined;
|
|
228
231
|
testID?: string | undefined;
|
|
229
232
|
inputAccessoryViewID?: string | undefined;
|
|
230
233
|
value?: string | undefined;
|
|
231
234
|
maxFontSizeMultiplier?: number | null | undefined;
|
|
232
235
|
children?: React.ReactNode;
|
|
233
|
-
hitSlop?: import("react-native").Insets | undefined;
|
|
236
|
+
hitSlop?: number | import("react-native").Insets | null | undefined;
|
|
234
237
|
id?: string | undefined;
|
|
235
|
-
|
|
238
|
+
needsOffscreenAlphaCompositing?: boolean | undefined;
|
|
239
|
+
onLayout?: (((event: LayoutChangeEvent) => void) & ((event: LayoutChangeEvent) => void)) | undefined;
|
|
236
240
|
pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
|
|
237
241
|
removeClippedSubviews?: boolean | undefined;
|
|
238
242
|
nativeID?: string | undefined;
|
|
239
243
|
collapsable?: boolean | undefined;
|
|
240
|
-
|
|
244
|
+
collapsableChildren?: boolean | undefined;
|
|
241
245
|
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
242
246
|
focusable?: boolean | undefined;
|
|
247
|
+
tabIndex?: 0 | -1 | undefined;
|
|
243
248
|
shouldRasterizeIOS?: boolean | undefined;
|
|
244
249
|
isTVSelectable?: boolean | undefined;
|
|
245
250
|
hasTVPreferredFocus?: boolean | undefined;
|
|
246
|
-
tvParallaxProperties?: import("react-native").TVParallaxProperties | undefined;
|
|
247
251
|
tvParallaxShiftDistanceX?: number | undefined;
|
|
248
252
|
tvParallaxShiftDistanceY?: number | undefined;
|
|
249
253
|
tvParallaxTiltAngle?: number | undefined;
|
|
@@ -291,7 +295,6 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
291
295
|
'aria-disabled'?: boolean | undefined;
|
|
292
296
|
'aria-expanded'?: boolean | undefined;
|
|
293
297
|
'aria-selected'?: boolean | undefined;
|
|
294
|
-
'aria-labelledby'?: string | undefined;
|
|
295
298
|
accessibilityHint: string;
|
|
296
299
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
297
300
|
'aria-valuemax'?: number | undefined;
|
|
@@ -301,11 +304,12 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
301
304
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
302
305
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
303
306
|
'aria-hidden'?: boolean | undefined;
|
|
304
|
-
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
305
307
|
'aria-modal'?: boolean | undefined;
|
|
306
308
|
role?: import("react-native").Role | undefined;
|
|
307
|
-
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
308
309
|
accessibilityLabelledBy?: string | string[] | undefined;
|
|
310
|
+
'aria-labelledby'?: string | undefined;
|
|
311
|
+
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
312
|
+
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
309
313
|
accessibilityElementsHidden?: boolean | undefined;
|
|
310
314
|
accessibilityViewIsModal?: boolean | undefined;
|
|
311
315
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
@@ -327,6 +331,7 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
327
331
|
lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
|
|
328
332
|
smartInsertDelete?: boolean | undefined;
|
|
329
333
|
cursorColor?: import("react-native").ColorValue | null | undefined;
|
|
334
|
+
selectionHandleColor?: import("react-native").ColorValue | null | undefined;
|
|
330
335
|
importantForAutofill?: "auto" | "yes" | "no" | "noExcludeDescendants" | "yesExcludeDescendants" | undefined;
|
|
331
336
|
disableFullscreenUI?: boolean | undefined;
|
|
332
337
|
inlineImageLeft?: string | undefined;
|
|
@@ -338,19 +343,19 @@ export declare const useTextInput: ({ onLayout, returnKeyType, onSubmitEditing,
|
|
|
338
343
|
textAlignVertical?: "center" | "auto" | "top" | "bottom" | undefined;
|
|
339
344
|
showSoftInputOnFocus?: boolean | undefined;
|
|
340
345
|
verticalAlign?: "auto" | "top" | "bottom" | "middle" | undefined;
|
|
346
|
+
ref?: React.RefObject<any> | React.ForwardedRef<any> | undefined;
|
|
347
|
+
suppressError?: boolean | undefined;
|
|
348
|
+
hasValidation: boolean;
|
|
349
|
+
hasError?: boolean | undefined;
|
|
350
|
+
nextFieldId?: string | undefined;
|
|
351
|
+
nextFormFieldRef?: React.RefObject<any> | undefined;
|
|
352
|
+
errorMessage?: string | undefined;
|
|
353
|
+
requiredMessage?: string | undefined;
|
|
341
354
|
labelComponent?: JSX.Element | undefined;
|
|
342
355
|
labelPosition?: "beforeInput" | "afterInput" | undefined;
|
|
343
356
|
nextFormField?: React.RefObject<import("react-native").TextInput> | undefined;
|
|
344
|
-
nextFieldId?: string | undefined;
|
|
345
|
-
hasValidation: boolean;
|
|
346
357
|
errorComponent?: JSX.Element | undefined;
|
|
347
|
-
hasError?: boolean | undefined;
|
|
348
358
|
errorPosition?: "afterInput" | "belowLabel" | undefined;
|
|
349
|
-
errorMessage?: string | undefined;
|
|
350
359
|
focusNextFormField: () => void;
|
|
351
360
|
isLastField: () => boolean;
|
|
352
|
-
ref?: React.RefObject<any> | React.ForwardedRef<any> | undefined;
|
|
353
|
-
suppressError?: boolean | undefined;
|
|
354
|
-
nextFormFieldRef?: React.RefObject<any> | undefined;
|
|
355
361
|
};
|
|
356
|
-
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { isFocused } from '@react-native-ama/internal';
|
|
3
|
-
import { FormActions, FormProps } from './components/Form';
|
|
3
|
+
import { FormActions, type FormProps } from './components/Form';
|
|
4
4
|
import { FormField, FormFieldProps } from './components/FormField';
|
|
5
5
|
import { FormSubmit, FormSubmitProps } from './components/FormSubmit';
|
|
6
6
|
import { FormSwitch, FormSwitchProps } from './components/FormSwitch';
|
|
@@ -11,8 +11,8 @@ type FormComponent = React.FunctionComponent<FormProps> & {
|
|
|
11
11
|
};
|
|
12
12
|
declare const Form: FormComponent;
|
|
13
13
|
export { Form, FormField, FormSubmit, FormSwitch };
|
|
14
|
-
export { TextInput } from './components/TextInput';
|
|
15
|
-
export { useFormField } from './hooks/useFormField';
|
|
16
|
-
export { useTextInput } from './hooks/useTextInput';
|
|
14
|
+
export { TextInput, type TextInputProps } from './components/TextInput';
|
|
15
|
+
export { useFormField, type UseFormField } from './hooks/useFormField';
|
|
16
|
+
export { useTextInput, type UseTextInput } from './hooks/useTextInput';
|
|
17
17
|
export { isFocused };
|
|
18
18
|
export { type FormProps, type FormActions, type FormFieldProps, type FormSubmitProps, type FormSwitchProps, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ama/forms",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"private": false,
|
|
3
|
+
"version": "1.1.1",
|
|
5
4
|
"react-native": "src/index",
|
|
6
5
|
"types": "dist/index.d.ts",
|
|
7
6
|
"main": "dist/index.js",
|
|
@@ -24,9 +23,9 @@
|
|
|
24
23
|
"test": "jest"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@react-native-ama/core": "~1.
|
|
28
|
-
"@react-native-ama/internal": "~1.
|
|
29
|
-
"@react-native-ama/react-native": "~1.
|
|
26
|
+
"@react-native-ama/core": "~1.1.1",
|
|
27
|
+
"@react-native-ama/internal": "~1.1.1",
|
|
28
|
+
"@react-native-ama/react-native": "~1.1.1"
|
|
30
29
|
},
|
|
31
30
|
"peerDependencies": {
|
|
32
31
|
"react": "*",
|
|
@@ -8,20 +8,18 @@ import {
|
|
|
8
8
|
TextInputProps as RNTextInputProps,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
|
-
import { useTextInput } from '../hooks/useTextInput';
|
|
11
|
+
import { UseTextInput, useTextInput } from '../hooks/useTextInput';
|
|
12
12
|
|
|
13
|
-
export type TextInputProps = RNTextInputProps &
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
errorMessage?: string;
|
|
24
|
-
};
|
|
13
|
+
export type TextInputProps = RNTextInputProps &
|
|
14
|
+
Omit<UseTextInput, 'required' | 'accessibilityLabel'> & {
|
|
15
|
+
labelComponent: JSX.Element;
|
|
16
|
+
labelPosition?: 'beforeInput' | 'afterInput';
|
|
17
|
+
nextFormField?: React.RefObject<RNTextInput>;
|
|
18
|
+
id?: string;
|
|
19
|
+
nextFieldId?: string;
|
|
20
|
+
errorComponent?: JSX.Element;
|
|
21
|
+
errorPosition?: 'belowLabel' | 'afterInput';
|
|
22
|
+
};
|
|
25
23
|
|
|
26
24
|
export const TextInput = React.forwardRef<RNTextInput, TextInputProps>(
|
|
27
25
|
(
|
|
@@ -55,9 +53,8 @@ export const TextInput = React.forwardRef<RNTextInput, TextInputProps>(
|
|
|
55
53
|
[labelComponent, rest.accessibilityLabel],
|
|
56
54
|
);
|
|
57
55
|
|
|
58
|
-
// @ts-ignore
|
|
59
56
|
const textInputProps = useTextInput({
|
|
60
|
-
|
|
57
|
+
...rest,
|
|
61
58
|
ref: inputRef,
|
|
62
59
|
id,
|
|
63
60
|
nextFieldId,
|
|
@@ -65,8 +62,8 @@ export const TextInput = React.forwardRef<RNTextInput, TextInputProps>(
|
|
|
65
62
|
hasError,
|
|
66
63
|
hasValidation,
|
|
67
64
|
errorMessage,
|
|
65
|
+
required: false,
|
|
68
66
|
accessibilityLabel,
|
|
69
|
-
...rest,
|
|
70
67
|
});
|
|
71
68
|
|
|
72
69
|
const checks = __DEV__ ? useChecks?.() : undefined;
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
import { TextInputProps } from '../components/TextInput';
|
|
15
15
|
import { UseFormField, useFormField } from './useFormField';
|
|
16
16
|
|
|
17
|
-
type UseTextInput = Omit<UseFormField, 'hasFocusCallback'> & {
|
|
17
|
+
export type UseTextInput = Omit<UseFormField, 'hasFocusCallback'> & {
|
|
18
18
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
19
19
|
returnKeyType?: ReturnKeyTypeOptions;
|
|
20
20
|
onSubmitEditing?: (
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { isFocused } from '@react-native-ama/internal';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
FormActions,
|
|
7
|
-
FormProps,
|
|
8
7
|
Form as FormProvider,
|
|
8
|
+
type FormProps,
|
|
9
9
|
} from './components/Form';
|
|
10
10
|
import { FormField, FormFieldProps } from './components/FormField';
|
|
11
11
|
import { FormSubmit, FormSubmitProps } from './components/FormSubmit';
|
|
@@ -26,11 +26,11 @@ Form.Switch = FormSwitch;
|
|
|
26
26
|
export { Form, FormField, FormSubmit, FormSwitch };
|
|
27
27
|
|
|
28
28
|
// Components
|
|
29
|
-
export { TextInput } from './components/TextInput';
|
|
29
|
+
export { TextInput, type TextInputProps } from './components/TextInput';
|
|
30
30
|
|
|
31
31
|
// Hooks
|
|
32
|
-
export { useFormField } from './hooks/useFormField';
|
|
33
|
-
export { useTextInput } from './hooks/useTextInput';
|
|
32
|
+
export { useFormField, type UseFormField } from './hooks/useFormField';
|
|
33
|
+
export { useTextInput, type UseTextInput } from './hooks/useTextInput';
|
|
34
34
|
|
|
35
35
|
// utils
|
|
36
36
|
export { isFocused };
|