aport-tools 4.4.46 → 4.4.48
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.48 | 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,6 @@ 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;
|
1432
1431
|
var computedStyles = useMemo(function () {
|
1433
1432
|
return StyleSheet.flatten([styles.button, typeStyles(type, disabled, colors), rounded && {
|
1434
1433
|
borderRadius: borderRadius
|
@@ -1443,11 +1442,20 @@ var Button = function Button(_a) {
|
|
1443
1442
|
color: colors.textButton.hex
|
1444
1443
|
};
|
1445
1444
|
}, [type, colors]);
|
1445
|
+
// Safely try to access handleSubmit from the form context
|
1446
|
+
var formContext = function () {
|
1447
|
+
try {
|
1448
|
+
return useFormContext();
|
1449
|
+
} catch (_a) {
|
1450
|
+
return null;
|
1451
|
+
}
|
1452
|
+
}();
|
1446
1453
|
var handlePress = function handlePress() {
|
1447
|
-
if (type === 'submit') {
|
1448
|
-
|
1454
|
+
if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
|
1455
|
+
console.log("Its submit type");
|
1456
|
+
formContext.handleSubmit();
|
1449
1457
|
} else if (onPress) {
|
1450
|
-
onPress();
|
1458
|
+
onPress();
|
1451
1459
|
}
|
1452
1460
|
};
|
1453
1461
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|