aport-tools 4.4.28 → 4.4.30

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.28 | ISC */
1
+ /*! aport-tools v4.4.30 | ISC */
2
2
  import React, { useContext, useState, createContext, useRef, useEffect, useMemo, useCallback } 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';
@@ -403,18 +403,32 @@ var Form = function Form(_a) {
403
403
  };
404
404
  var handleSubmit = function handleSubmit() {
405
405
  return __awaiter(void 0, void 0, void 0, function () {
406
- var validationErrors;
406
+ var modifiedFields, validationErrors;
407
407
  return __generator(this, function (_a) {
408
408
  switch (_a.label) {
409
409
  case 0:
410
- return [4 /*yield*/, onSubmit(formValues)];
410
+ modifiedFields = Object.keys(formValues).reduce(function (acc, key) {
411
+ var currentField = formValues[key];
412
+ // Check if firstValue exists
413
+ if ((currentField === null || currentField === void 0 ? void 0 : currentField.firstValue) !== undefined) {
414
+ // Only include the field if the value has changed
415
+ if (currentField.value !== currentField.firstValue) {
416
+ acc[key] = currentField.value;
417
+ }
418
+ } else {
419
+ // Include the field if firstValue is not defined
420
+ acc[key] = currentField.value;
421
+ }
422
+ return acc;
423
+ }, {});
424
+ return [4 /*yield*/, onSubmit(modifiedFields)];
411
425
  case 1:
412
426
  validationErrors = _a.sent();
413
427
  // Set the validation errors in state
414
428
  setErrors(validationErrors);
415
- // Prevent submission if there are any errors
429
+ // Prevent submission if there are validation errors
416
430
  if (Object.keys(validationErrors).length > 0) {
417
- return [2 /*return*/]; // Prevent submission
431
+ return [2 /*return*/]; // Exit early if errors are present
418
432
  }
419
433
  return [2 /*return*/];
420
434
  }