@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/dist/package.json +2 -3
- package/dist/src/Form/Form.js +15 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/src/Form/Form.tsx +17 -8
package/dist/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.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": "
|
|
82
|
+
"gitHead": "d44fac22c580ff68fe8dc51bfb60d678e4d0e691"
|
|
84
83
|
}
|
package/dist/src/Form/Form.js
CHANGED
|
@@ -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:
|
|
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(
|
|
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
|
+
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;
|
|
@@ -149,11 +161,6 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
|
|
|
149
161
|
if (performSubmit) {
|
|
150
162
|
Keyboard.dismiss();
|
|
151
163
|
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
164
|
.catch(handleSubmitCatch);
|
|
158
165
|
}
|
|
159
166
|
});
|
|
@@ -176,7 +183,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
|
|
|
176
183
|
}
|
|
177
184
|
function handleRetry() {
|
|
178
185
|
clearFormErrors();
|
|
179
|
-
return
|
|
186
|
+
return callHandleSubmit();
|
|
180
187
|
}
|
|
181
188
|
function calculateSaveButtonOffset() {
|
|
182
189
|
if (saveButtonOffset) {
|