aport-tools 4.4.7 → 4.4.9
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/index.esm.js +23 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.9 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -214,24 +214,35 @@ var Stepper = function Stepper(_a) {
|
|
214
214
|
seterrorBack = _f[1];
|
215
215
|
var handleStepPress = function handleStepPress(stepIndex) {
|
216
216
|
return __awaiter(void 0, void 0, void 0, function () {
|
217
|
-
var errors;
|
217
|
+
var current, target, errors;
|
218
218
|
return __generator(this, function (_a) {
|
219
219
|
switch (_a.label) {
|
220
220
|
case 0:
|
221
221
|
if (!presseable || stepIndex === currentStep) return [2 /*return*/];
|
222
|
-
|
223
|
-
|
222
|
+
current = currentStep;
|
223
|
+
target = stepIndex;
|
224
|
+
_a.label = 1;
|
224
225
|
case 1:
|
226
|
+
if (!(current !== target)) return [3 /*break*/, 5];
|
227
|
+
if (!(target > current)) return [3 /*break*/, 3];
|
228
|
+
return [4 /*yield*/, handleFormSubmit(formValues)];
|
229
|
+
case 2:
|
225
230
|
errors = _a.sent();
|
226
231
|
if (Object.keys(errors).length > 0) {
|
227
|
-
console.log("Validation failed. Cannot proceed to step",
|
232
|
+
console.log("Validation failed at step ".concat(current + 1, ". Cannot proceed to step ").concat(current + 2, "."));
|
228
233
|
seterrorBack(true);
|
229
|
-
return [2 /*return*/]; //
|
234
|
+
return [2 /*return*/]; // Stop at the first invalid step
|
230
235
|
}
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
236
|
+
seterrorBack(false);
|
237
|
+
current += 1; // Move to the next step
|
238
|
+
return [3 /*break*/, 4];
|
239
|
+
case 3:
|
240
|
+
current -= 1;
|
241
|
+
_a.label = 4;
|
242
|
+
case 4:
|
243
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(current);
|
244
|
+
return [3 /*break*/, 1];
|
245
|
+
case 5:
|
235
246
|
return [2 /*return*/];
|
236
247
|
}
|
237
248
|
});
|
@@ -240,7 +251,7 @@ var Stepper = function Stepper(_a) {
|
|
240
251
|
React.useEffect(function () {
|
241
252
|
reactNative.Animated.timing(progressAnim, {
|
242
253
|
toValue: currentStep,
|
243
|
-
duration:
|
254
|
+
duration: 500,
|
244
255
|
useNativeDriver: false
|
245
256
|
}).start();
|
246
257
|
}, [currentStep]);
|
@@ -327,7 +338,7 @@ var Stepper = function Stepper(_a) {
|
|
327
338
|
}
|
328
339
|
}, /*#__PURE__*/React.createElement(reactNative.View, {
|
329
340
|
style: [styles$9.step, stepStyle === "square" && styles$9.squareStep, {
|
330
|
-
backgroundColor:
|
341
|
+
backgroundColor: currentStep >= index ? !errorBack ? colors.primary.hex : colors.error.hex : colors.body.hex
|
331
342
|
}]
|
332
343
|
}, renderStepContent(index)), steps && /*#__PURE__*/React.createElement(Text, {
|
333
344
|
style: styles$9.stepText
|