@jobber/components-native 0.75.3-MIKEmake--c9b6b60.253 → 0.75.3-POC-fixing-d44fac2.135

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-MIKEmake--c9b6b60.253+c9b6b608",
3
+ "version": "0.75.3-POC-fixing-d44fac2.135+d44fac22",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -64,7 +64,6 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@babel/core": "^7.4.5",
67
- "@jobber/design": "*",
68
67
  "@react-native-community/datetimepicker": ">=6.7.0",
69
68
  "date-fns": "^2.30.0",
70
69
  "date-fns-tz": "^2.0.0",
@@ -80,5 +79,5 @@
80
79
  "react-native-safe-area-context": "^4.5.2",
81
80
  "react-native-svg": ">=12.0.0"
82
81
  },
83
- "gitHead": "c9b6b608680b2fb8ce6ce0e1f38dcae9849901e4"
82
+ "gitHead": "d44fac22c580ff68fe8dc51bfb60d678e4d0e691"
84
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={handleSubmit(internalSubmit)}
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
- handleSubmit(internalSubmit),
196
+ callHandleSubmit,
197
197
  saveButtonLabel,
198
198
  isSubmitting,
199
199
  )
200
200
  ) : (
201
201
  <FormSaveButton
202
- primaryAction={handleSubmit(internalSubmit)}
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
+ 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
 
@@ -256,10 +269,6 @@ function InternalForm<T extends FieldValues, S>({
256
269
  Keyboard.dismiss();
257
270
 
258
271
  return onSubmit(data)
259
- .then((result: S) => {
260
- removeListenerRef.current?.();
261
- onSubmitSuccess(result);
262
- })
263
272
  .catch(handleSubmitCatch);
264
273
  }
265
274
  }
@@ -287,7 +296,7 @@ function InternalForm<T extends FieldValues, S>({
287
296
  function handleRetry() {
288
297
  clearFormErrors();
289
298
 
290
- return handleSubmit(internalSubmit)();
299
+ return callHandleSubmit();
291
300
  }
292
301
 
293
302
  function calculateSaveButtonOffset() {