@jobber/components-native 0.48.5 → 0.48.7
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.
|
@@ -28,7 +28,7 @@ export interface InputTextProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* Determines what keyboard is shown
|
|
30
30
|
*/
|
|
31
|
-
keyboard?: "default" | "numeric" | "phone-pad" | "email-address" | "numbers-and-punctuation" | "decimal-pad";
|
|
31
|
+
readonly keyboard?: "default" | "numeric" | "phone-pad" | "email-address" | "numbers-and-punctuation" | "decimal-pad";
|
|
32
32
|
/**
|
|
33
33
|
* Set the component to a given value
|
|
34
34
|
*/
|
|
@@ -49,21 +49,21 @@ export interface InputTextProps {
|
|
|
49
49
|
* Simplified callback that only provides the new value
|
|
50
50
|
* @param newValue
|
|
51
51
|
*/
|
|
52
|
-
onChangeText?: (newValue: string) => void;
|
|
52
|
+
readonly onChangeText?: (newValue: string) => void;
|
|
53
53
|
/**
|
|
54
54
|
* Callback that is called when the text input's submit button is pressed
|
|
55
55
|
* @param event
|
|
56
56
|
*/
|
|
57
|
-
onSubmitEditing?: (event?: SyntheticEvent) => void;
|
|
57
|
+
readonly onSubmitEditing?: (event?: SyntheticEvent) => void;
|
|
58
58
|
/**
|
|
59
59
|
* Callback that is called when the text input is focused
|
|
60
60
|
* @param event
|
|
61
61
|
*/
|
|
62
|
-
onFocus?: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
62
|
+
readonly onFocus?: (event?: NativeSyntheticEvent<TextInputFocusEventData>) => void;
|
|
63
63
|
/**
|
|
64
64
|
* Callback that is called when the text input is blurred
|
|
65
65
|
*/
|
|
66
|
-
onBlur?: () => void;
|
|
66
|
+
readonly onBlur?: () => void;
|
|
67
67
|
/**
|
|
68
68
|
* VoiceOver will read this string when a user selects the associated element
|
|
69
69
|
*/
|
|
@@ -125,7 +125,7 @@ export interface InputTextProps {
|
|
|
125
125
|
* "input" is a function that transform the value to the string format that should be shown to the user
|
|
126
126
|
* "output" is a function that transform the string representation of the value to the value that is sent to onChange and the form
|
|
127
127
|
*/
|
|
128
|
-
transform?: {
|
|
128
|
+
readonly transform?: {
|
|
129
129
|
input?: (v: any) => string | undefined;
|
|
130
130
|
output?: (v: string | undefined) => any;
|
|
131
131
|
};
|
|
@@ -140,7 +140,7 @@ export interface InputTextProps {
|
|
|
140
140
|
/**
|
|
141
141
|
* Used to locate this view in end-to-end tests
|
|
142
142
|
*/
|
|
143
|
-
testID?: string;
|
|
143
|
+
readonly testID?: string;
|
|
144
144
|
/**
|
|
145
145
|
* Use secure text entry
|
|
146
146
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"build:clean": "rm -rf ./dist"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@jobber/design": "^0.47.
|
|
39
|
+
"@jobber/design": "^0.47.2",
|
|
40
40
|
"@jobber/hooks": "^2.7.2",
|
|
41
41
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
42
42
|
"@react-native-picker/picker": "^2.4.10",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-native-reanimated": "^2.17.0",
|
|
85
85
|
"react-native-safe-area-context": "^4.5.2"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "b6dbe9fe7f60bc1102c8aec4d8e8486706e3727c"
|
|
88
88
|
}
|
package/src/Form/Form.tsx
CHANGED
|
@@ -39,6 +39,7 @@ export function Form<T extends FieldValues, S>({
|
|
|
39
39
|
...rest
|
|
40
40
|
}: FormProps<T, S>): JSX.Element {
|
|
41
41
|
const child = initialLoading ? <FormMask /> : <InternalForm {...rest} />;
|
|
42
|
+
|
|
42
43
|
return (
|
|
43
44
|
<InputAccessoriesProvider>
|
|
44
45
|
<ErrorMessageProvider>{child}</ErrorMessageProvider>
|
|
@@ -223,6 +224,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
223
224
|
</FormProvider>
|
|
224
225
|
);
|
|
225
226
|
|
|
227
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
228
|
function handleKeyboardShow(frames: Record<string, any>) {
|
|
227
229
|
setKeyboardScreenY(frames.endCoordinates.screenY);
|
|
228
230
|
setKeyboardHeight(frames.endCoordinates.height);
|
|
@@ -245,6 +247,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
245
247
|
|
|
246
248
|
async function internalSubmit(data: FormValues<T>) {
|
|
247
249
|
let performSubmit = true;
|
|
250
|
+
|
|
248
251
|
if (onBeforeSubmit) {
|
|
249
252
|
performSubmit = await onBeforeSubmit(data);
|
|
250
253
|
}
|
|
@@ -280,8 +283,10 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
280
283
|
// when the form had no internet connection
|
|
281
284
|
formMethods.clearErrors("offline");
|
|
282
285
|
}
|
|
286
|
+
|
|
283
287
|
function handleRetry() {
|
|
284
288
|
clearFormErrors();
|
|
289
|
+
|
|
285
290
|
return handleSubmit(internalSubmit)();
|
|
286
291
|
}
|
|
287
292
|
|
|
@@ -65,7 +65,7 @@ export interface InputTextProps {
|
|
|
65
65
|
/**
|
|
66
66
|
* Determines what keyboard is shown
|
|
67
67
|
*/
|
|
68
|
-
keyboard?:
|
|
68
|
+
readonly keyboard?:
|
|
69
69
|
| "default"
|
|
70
70
|
| "numeric"
|
|
71
71
|
| "phone-pad"
|
|
@@ -97,24 +97,26 @@ export interface InputTextProps {
|
|
|
97
97
|
* Simplified callback that only provides the new value
|
|
98
98
|
* @param newValue
|
|
99
99
|
*/
|
|
100
|
-
onChangeText?: (newValue: string) => void;
|
|
100
|
+
readonly onChangeText?: (newValue: string) => void;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* Callback that is called when the text input's submit button is pressed
|
|
104
104
|
* @param event
|
|
105
105
|
*/
|
|
106
|
-
onSubmitEditing?: (event?: SyntheticEvent) => void;
|
|
106
|
+
readonly onSubmitEditing?: (event?: SyntheticEvent) => void;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Callback that is called when the text input is focused
|
|
110
110
|
* @param event
|
|
111
111
|
*/
|
|
112
|
-
onFocus?: (
|
|
112
|
+
readonly onFocus?: (
|
|
113
|
+
event?: NativeSyntheticEvent<TextInputFocusEventData>,
|
|
114
|
+
) => void;
|
|
113
115
|
|
|
114
116
|
/**
|
|
115
117
|
* Callback that is called when the text input is blurred
|
|
116
118
|
*/
|
|
117
|
-
onBlur?: () => void;
|
|
119
|
+
readonly onBlur?: () => void;
|
|
118
120
|
|
|
119
121
|
/**
|
|
120
122
|
* VoiceOver will read this string when a user selects the associated element
|
|
@@ -186,8 +188,10 @@ export interface InputTextProps {
|
|
|
186
188
|
* "input" is a function that transform the value to the string format that should be shown to the user
|
|
187
189
|
* "output" is a function that transform the string representation of the value to the value that is sent to onChange and the form
|
|
188
190
|
*/
|
|
189
|
-
transform?: {
|
|
191
|
+
readonly transform?: {
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
193
|
input?: (v: any) => string | undefined;
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
191
195
|
output?: (v: string | undefined) => any;
|
|
192
196
|
};
|
|
193
197
|
|
|
@@ -203,7 +207,7 @@ export interface InputTextProps {
|
|
|
203
207
|
/**
|
|
204
208
|
* Used to locate this view in end-to-end tests
|
|
205
209
|
*/
|
|
206
|
-
testID?: string;
|
|
210
|
+
readonly testID?: string;
|
|
207
211
|
|
|
208
212
|
/**
|
|
209
213
|
* Use secure text entry
|
|
@@ -486,5 +490,6 @@ function useMiniLabel(internalValue: string): {
|
|
|
486
490
|
useEffect(() => {
|
|
487
491
|
setHasMiniLabel(Boolean(internalValue));
|
|
488
492
|
}, [internalValue]);
|
|
493
|
+
|
|
489
494
|
return { hasMiniLabel, setHasMiniLabel };
|
|
490
495
|
}
|