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 +13 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -5
- 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.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
|
-
|
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();
|
1455
|
+
if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
|
1456
|
+
formContext.handleSubmit();
|
1449
1457
|
} else if (onPress) {
|
1450
|
-
onPress();
|
1458
|
+
onPress();
|
1451
1459
|
}
|
1452
1460
|
};
|
1453
1461
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|