aport-tools 4.4.5 → 4.4.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.7 | 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';
|
@@ -188,6 +188,9 @@ var Stepper = function Stepper(_a) {
|
|
188
188
|
var _e = useFormContext(),
|
189
189
|
formValues = _e.formValues,
|
190
190
|
handleFormSubmit = _e.handleFormSubmit;
|
191
|
+
var _f = useState(false),
|
192
|
+
errorBack = _f[0],
|
193
|
+
seterrorBack = _f[1];
|
191
194
|
var handleStepPress = function handleStepPress(stepIndex) {
|
192
195
|
return __awaiter(void 0, void 0, void 0, function () {
|
193
196
|
var errors;
|
@@ -195,13 +198,17 @@ var Stepper = function Stepper(_a) {
|
|
195
198
|
switch (_a.label) {
|
196
199
|
case 0:
|
197
200
|
if (!presseable || stepIndex === currentStep) return [2 /*return*/];
|
201
|
+
if (!(stepIndex > currentStep)) return [3 /*break*/, 2];
|
198
202
|
return [4 /*yield*/, handleFormSubmit(formValues)];
|
199
203
|
case 1:
|
200
204
|
errors = _a.sent();
|
201
205
|
if (Object.keys(errors).length > 0) {
|
202
206
|
console.log("Validation failed. Cannot proceed to step", stepIndex);
|
207
|
+
seterrorBack(true);
|
203
208
|
return [2 /*return*/]; // Prevent step change
|
204
209
|
}
|
210
|
+
_a.label = 2;
|
211
|
+
case 2:
|
205
212
|
// Proceed to change step
|
206
213
|
onPress === null || onPress === void 0 ? void 0 : onPress(stepIndex);
|
207
214
|
return [2 /*return*/];
|
@@ -299,7 +306,7 @@ var Stepper = function Stepper(_a) {
|
|
299
306
|
}
|
300
307
|
}, /*#__PURE__*/React.createElement(View, {
|
301
308
|
style: [styles$9.step, stepStyle === "square" && styles$9.squareStep, {
|
302
|
-
backgroundColor: currentStep >= index ? colors.primary.hex : colors.body.hex
|
309
|
+
backgroundColor: !errorBack ? currentStep >= index ? colors.primary.hex : colors.body.hex : colors.error.hex
|
303
310
|
}]
|
304
311
|
}, renderStepContent(index)), steps && /*#__PURE__*/React.createElement(Text, {
|
305
312
|
style: styles$9.stepText
|