aport-tools 4.4.45 → 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/forms/Input.d.ts +1 -1
- package/dist/index.esm.js +14 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -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');
|
@@ -590,6 +590,7 @@ var Input = function Input(_a) {
|
|
590
590
|
if (isFirstRender.current) {
|
591
591
|
isFirstRender.current = false;
|
592
592
|
if (firstValue !== undefined) {
|
593
|
+
firstValue = firstValue.toString();
|
593
594
|
setInternalValue(firstValue);
|
594
595
|
setFormValue(name, firstValue, firstValue); // Pass firstValue here
|
595
596
|
} else {
|
@@ -1448,7 +1449,7 @@ var Button = function Button(_a) {
|
|
1448
1449
|
onPress = _a.onPress;
|
1449
1450
|
var theme = React.useContext(aportThemes.ThemeContext).theme;
|
1450
1451
|
var colors = theme.colors;
|
1451
|
-
|
1452
|
+
useFormContext().handleSubmit;
|
1452
1453
|
var computedStyles = React.useMemo(function () {
|
1453
1454
|
return reactNative.StyleSheet.flatten([styles.button, typeStyles(type, disabled, colors), rounded && {
|
1454
1455
|
borderRadius: borderRadius
|
@@ -1463,11 +1464,19 @@ var Button = function Button(_a) {
|
|
1463
1464
|
color: colors.textButton.hex
|
1464
1465
|
};
|
1465
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
|
+
}();
|
1466
1475
|
var handlePress = function handlePress() {
|
1467
|
-
if (type === 'submit') {
|
1468
|
-
handleSubmit();
|
1476
|
+
if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
|
1477
|
+
formContext.handleSubmit();
|
1469
1478
|
} else if (onPress) {
|
1470
|
-
onPress();
|
1479
|
+
onPress();
|
1471
1480
|
}
|
1472
1481
|
};
|
1473
1482
|
return /*#__PURE__*/React.createElement(reactNative.TouchableOpacity, {
|