@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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.75.3-NAZARIIad-655df4e.237+655df4e1",
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": "655df4e193b5e3dffbb266c5a644be3c88d86df3"
82
+ "gitHead": "b57471fec4113fb6fb2f3e0fb76273ad024896d9"
83
83
  }
@@ -105,7 +105,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
105
105
  React.createElement(React.Fragment, null,
106
106
  (isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
107
107
  React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
108
- React.createElement(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: handleSubmit(internalSubmit), isFormSubmitting: isSubmitting, saveButtonLabel: saveButtonLabel, shouldRenderActionBar: saveButtonPosition === "sticky", renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, saveButtonOffset: saveButtonOffset },
108
+ React.createElement(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: callHandleSubmit, isFormSubmitting: isSubmitting, saveButtonLabel: saveButtonLabel, shouldRenderActionBar: saveButtonPosition === "sticky", renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, saveButtonOffset: saveButtonOffset },
109
109
  React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
110
110
  React.createElement(View, { onLayout: ({ nativeEvent }) => {
111
111
  setFormContentHeight(nativeEvent.layout.height);
@@ -116,7 +116,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
116
116
  React.createElement(View, { style: styles.formChildContainer },
117
117
  React.createElement(React.Fragment, null,
118
118
  React.createElement(View, { style: styles.formContent }, children),
119
- saveButtonPosition === "inline" && (React.createElement(View, { style: styles.fixedSaveButton }, renderStickySection ? (renderStickySection(handleSubmit(internalSubmit), saveButtonLabel, isSubmitting)) : (React.createElement(FormSaveButton, { primaryAction: handleSubmit(internalSubmit), label: saveButtonLabel, loading: isSubmitting, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, onOpenBottomSheet: () => setIsBottomSheetOpen(true), onCloseBottomSheet: () => setIsBottomSheetOpen(false) })))),
119
+ saveButtonPosition === "inline" && (React.createElement(View, { style: styles.fixedSaveButton }, renderStickySection ? (renderStickySection(callHandleSubmit, saveButtonLabel, isSubmitting)) : (React.createElement(FormSaveButton, { primaryAction: callHandleSubmit, label: saveButtonLabel, loading: isSubmitting, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, onOpenBottomSheet: () => setIsBottomSheetOpen(true), onCloseBottomSheet: () => setIsBottomSheetOpen(false) })))),
120
120
  renderFooter))),
121
121
  React.createElement(View, { style: styles.safeArea, ref: bottomViewRef })))),
122
122
  React.createElement(FormMessage, null)));
@@ -140,6 +140,18 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
140
140
  setKeyboardHeight(0);
141
141
  setKeyboardScreenY(0);
142
142
  }
143
+ function callHandleSubmit() {
144
+ let result;
145
+ handleSubmit(data => {
146
+ return internalSubmit(data).then(saveResult => {
147
+ result = saveResult;
148
+ });
149
+ })().then(() => {
150
+ var _a;
151
+ (_a = removeListenerRef.current) === null || _a === void 0 ? void 0 : _a.call(removeListenerRef);
152
+ onSubmitSuccess(result);
153
+ });
154
+ }
143
155
  function internalSubmit(data) {
144
156
  return __awaiter(this, void 0, void 0, function* () {
145
157
  let performSubmit = true;
@@ -148,13 +160,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
148
160
  }
149
161
  if (performSubmit) {
150
162
  Keyboard.dismiss();
151
- return onSubmit(data)
152
- .then((result) => {
153
- var _a;
154
- (_a = removeListenerRef.current) === null || _a === void 0 ? void 0 : _a.call(removeListenerRef);
155
- onSubmitSuccess(result);
156
- })
157
- .catch(handleSubmitCatch);
163
+ return onSubmit(data).catch(handleSubmitCatch);
158
164
  }
159
165
  });
160
166
  }
@@ -176,7 +182,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
176
182
  }
177
183
  function handleRetry() {
178
184
  clearFormErrors();
179
- return handleSubmit(internalSubmit)();
185
+ return callHandleSubmit();
180
186
  }
181
187
  function calculateSaveButtonOffset() {
182
188
  if (saveButtonOffset) {