aport-tools 4.4.11 → 4.4.12

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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.4.11 | ISC */
1
+ /*! aport-tools v4.4.12 | ISC */
2
2
  import React, { useContext, useState, createContext, useCallback, useMemo } from 'react';
3
3
  import { StyleSheet, Text as Text$1, Animated, View, TouchableOpacity, Image, TextInput, Modal, Pressable, FlatList, Keyboard, Platform, Alert, ActivityIndicator } from 'react-native';
4
4
  import { ThemeContext } from 'aport-themes';
@@ -193,37 +193,26 @@ var Stepper = function Stepper(_a) {
193
193
  seterrorBack = _f[1];
194
194
  var handleStepPress = function handleStepPress(stepIndex) {
195
195
  return __awaiter(void 0, void 0, void 0, function () {
196
- var current, target, errors;
196
+ var targetStep, errors;
197
197
  return __generator(this, function (_a) {
198
198
  switch (_a.label) {
199
199
  case 0:
200
200
  if (!presseable || stepIndex === currentStep) return [2 /*return*/];
201
- current = currentStep;
202
- target = stepIndex;
203
- _a.label = 1;
204
- case 1:
205
- if (!(current !== target)) return [3 /*break*/, 5];
206
- if (!(target > current)) return [3 /*break*/, 3];
201
+ targetStep = stepIndex > currentStep ? currentStep + 1 : currentStep - 1;
202
+ if (!(targetStep > currentStep)) return [3 /*break*/, 2];
207
203
  return [4 /*yield*/, handleFormSubmit(formValues)];
208
- case 2:
204
+ case 1:
209
205
  errors = _a.sent();
210
206
  if (Object.keys(errors).length > 0) {
211
- console.log("Validation failed at step ".concat(current + 1, ". Cannot proceed to step ").concat(current + 2, "."));
207
+ console.log("Validation failed at step ".concat(currentStep, ". Cannot proceed to step ").concat(targetStep, "."));
212
208
  seterrorBack(true);
213
- return [2 /*return*/]; // Stop if the current step has errors
209
+ return [2 /*return*/]; // Stop if current step has errors
214
210
  }
211
+ _a.label = 2;
212
+ case 2:
213
+ // Update step
215
214
  seterrorBack(false);
216
- current += 1; // Move to the next step
217
- return [3 /*break*/, 4];
218
- case 3:
219
- // Moving backward: No validation required
220
- current -= 1;
221
- _a.label = 4;
222
- case 4:
223
- // Update the current step visually for each intermediate step
224
- onPress === null || onPress === void 0 ? void 0 : onPress(current);
225
- return [3 /*break*/, 1];
226
- case 5:
215
+ onPress === null || onPress === void 0 ? void 0 : onPress(targetStep);
227
216
  return [2 /*return*/];
228
217
  }
229
218
  });