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.
@@ -11,7 +11,7 @@ interface InputProps extends TextInputProps {
11
11
  /**
12
12
  * Optional first value if you want to set values with fetch or dont have empty inputs.
13
13
  */
14
- firstValue?: string;
14
+ firstValue?: string | number;
15
15
  /**
16
16
  * The text label displayed above the input field.
17
17
  */
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.4.45 | 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';
@@ -569,6 +569,7 @@ var Input = function Input(_a) {
569
569
  if (isFirstRender.current) {
570
570
  isFirstRender.current = false;
571
571
  if (firstValue !== undefined) {
572
+ firstValue = firstValue.toString();
572
573
  setInternalValue(firstValue);
573
574
  setFormValue(name, firstValue, firstValue); // Pass firstValue here
574
575
  } else {
@@ -1427,7 +1428,7 @@ var Button = function Button(_a) {
1427
1428
  onPress = _a.onPress;
1428
1429
  var theme = useContext(ThemeContext).theme;
1429
1430
  var colors = theme.colors;
1430
- var handleSubmit = useFormContext().handleSubmit;
1431
+ useFormContext().handleSubmit;
1431
1432
  var computedStyles = useMemo(function () {
1432
1433
  return StyleSheet.flatten([styles.button, typeStyles(type, disabled, colors), rounded && {
1433
1434
  borderRadius: borderRadius
@@ -1442,11 +1443,19 @@ var Button = function Button(_a) {
1442
1443
  color: colors.textButton.hex
1443
1444
  };
1444
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
+ }();
1445
1454
  var handlePress = function handlePress() {
1446
- if (type === 'submit') {
1447
- handleSubmit(); // Call the form's submit handler
1455
+ if (type === 'submit' && (formContext === null || formContext === void 0 ? void 0 : formContext.handleSubmit)) {
1456
+ formContext.handleSubmit();
1448
1457
  } else if (onPress) {
1449
- onPress(); // Call a custom handler if needed
1458
+ onPress();
1450
1459
  }
1451
1460
  };
1452
1461
  return /*#__PURE__*/React.createElement(TouchableOpacity, {