@jobber/components-native 0.75.3-NAZARIIad-655df4e.237 → 0.75.3-POC-fixing-d44fac2.136
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.75.3-
|
|
3
|
+
"version": "0.75.3-POC-fixing-d44fac2.136+b57471fe",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"react-native-safe-area-context": "^4.5.2",
|
|
80
80
|
"react-native-svg": ">=12.0.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "b57471fec4113fb6fb2f3e0fb76273ad024896d9"
|
|
83
83
|
}
|
package/src/Form/Form.tsx
CHANGED
|
@@ -150,7 +150,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
150
150
|
|
|
151
151
|
<FormBody
|
|
152
152
|
keyboardHeight={calculateSaveButtonOffset()}
|
|
153
|
-
submit={
|
|
153
|
+
submit={callHandleSubmit}
|
|
154
154
|
isFormSubmitting={isSubmitting}
|
|
155
155
|
saveButtonLabel={saveButtonLabel}
|
|
156
156
|
shouldRenderActionBar={saveButtonPosition === "sticky"}
|
|
@@ -193,13 +193,13 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
193
193
|
<View style={styles.fixedSaveButton}>
|
|
194
194
|
{renderStickySection ? (
|
|
195
195
|
renderStickySection(
|
|
196
|
-
|
|
196
|
+
callHandleSubmit,
|
|
197
197
|
saveButtonLabel,
|
|
198
198
|
isSubmitting,
|
|
199
199
|
)
|
|
200
200
|
) : (
|
|
201
201
|
<FormSaveButton
|
|
202
|
-
primaryAction={
|
|
202
|
+
primaryAction={callHandleSubmit}
|
|
203
203
|
label={saveButtonLabel}
|
|
204
204
|
loading={isSubmitting}
|
|
205
205
|
secondaryActions={secondaryActions}
|
|
@@ -245,6 +245,19 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
245
245
|
setKeyboardScreenY(0);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
function callHandleSubmit() {
|
|
249
|
+
let result: S;
|
|
250
|
+
|
|
251
|
+
handleSubmit(data => {
|
|
252
|
+
return internalSubmit(data).then(saveResult => {
|
|
253
|
+
result = saveResult as S;
|
|
254
|
+
});
|
|
255
|
+
})().then(() => {
|
|
256
|
+
removeListenerRef.current?.();
|
|
257
|
+
onSubmitSuccess(result);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
248
261
|
async function internalSubmit(data: FormValues<T>) {
|
|
249
262
|
let performSubmit = true;
|
|
250
263
|
|
|
@@ -255,12 +268,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
255
268
|
if (performSubmit) {
|
|
256
269
|
Keyboard.dismiss();
|
|
257
270
|
|
|
258
|
-
return onSubmit(data)
|
|
259
|
-
.then((result: S) => {
|
|
260
|
-
removeListenerRef.current?.();
|
|
261
|
-
onSubmitSuccess(result);
|
|
262
|
-
})
|
|
263
|
-
.catch(handleSubmitCatch);
|
|
271
|
+
return onSubmit(data).catch(handleSubmitCatch);
|
|
264
272
|
}
|
|
265
273
|
}
|
|
266
274
|
|
|
@@ -287,7 +295,7 @@ function InternalForm<T extends FieldValues, S>({
|
|
|
287
295
|
function handleRetry() {
|
|
288
296
|
clearFormErrors();
|
|
289
297
|
|
|
290
|
-
return
|
|
298
|
+
return callHandleSubmit();
|
|
291
299
|
}
|
|
292
300
|
|
|
293
301
|
function calculateSaveButtonOffset() {
|