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.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.47 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -1449,7 +1449,7 @@ var Button = function Button(_a) {
|
|
1449
1449
|
onPress = _a.onPress;
|
1450
1450
|
var theme = React.useContext(aportThemes.ThemeContext).theme;
|
1451
1451
|
var colors = theme.colors;
|
1452
|
-
|
1452
|
+
useFormContext().handleSubmit;
|
1453
1453
|
var computedStyles = React.useMemo(function () {
|
1454
1454
|
return reactNative.StyleSheet.flatten([styles.button, typeStyles(type, disabled, colors), rounded && {
|
1455
1455
|
borderRadius: borderRadius
|
@@ -1464,11 +1464,19 @@ var Button = function Button(_a) {
|
|
1464
1464
|
color: colors.textButton.hex
|
1465
1465
|
};
|
1466
1466
|
}, [type, colors]);
|
1467
|
+
// Safely try to access handleSubmit from the form context
|
1468
|
+
var formContext = function () {
|
1469
|
+
try {
|
1470
|
+
return useFormContext();
|
1471
|
+
} catch (_a) {
|
1472
|
+
return null;
|
1473
|
+
}
|
1474
|
+
}();
|
1467
1475
|
var handlePress = function handlePress() {
|
1468
|
-
if (type === 'submit') {
|
1469
|
-
handleSubmit();
|
1476
|
+
if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
|
1477
|
+
formContext.handleSubmit();
|
1470
1478
|
} else if (onPress) {
|
1471
|
-
onPress();
|
1479
|
+
onPress();
|
1472
1480
|
}
|
1473
1481
|
};
|
1474
1482
|
return /*#__PURE__*/React.createElement(reactNative.TouchableOpacity, {
|