aport-tools 4.4.46 → 4.4.47

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.46 | ISC */
1
+ /*! aport-tools v4.4.47 | 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';
@@ -1428,7 +1428,7 @@ var Button = function Button(_a) {
1428
1428
  onPress = _a.onPress;
1429
1429
  var theme = useContext(ThemeContext).theme;
1430
1430
  var colors = theme.colors;
1431
- var handleSubmit = useFormContext().handleSubmit;
1431
+ useFormContext().handleSubmit;
1432
1432
  var computedStyles = useMemo(function () {
1433
1433
  return StyleSheet.flatten([styles.button, typeStyles(type, disabled, colors), rounded && {
1434
1434
  borderRadius: borderRadius
@@ -1443,11 +1443,19 @@ var Button = function Button(_a) {
1443
1443
  color: colors.textButton.hex
1444
1444
  };
1445
1445
  }, [type, colors]);
1446
+ // Safely try to access handleSubmit from the form context
1447
+ var formContext = function () {
1448
+ try {
1449
+ return useFormContext();
1450
+ } catch (_a) {
1451
+ return null;
1452
+ }
1453
+ }();
1446
1454
  var handlePress = function handlePress() {
1447
- if (type === 'submit') {
1448
- handleSubmit(); // Call the form's submit handler
1455
+ if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
1456
+ formContext.handleSubmit();
1449
1457
  } else if (onPress) {
1450
- onPress(); // Call a custom handler if needed
1458
+ onPress();
1451
1459
  }
1452
1460
  };
1453
1461
  return /*#__PURE__*/React.createElement(TouchableOpacity, {