aport-tools 4.4.22 → 4.4.23

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 CHANGED
@@ -1,5 +1,5 @@
1
- /*! aport-tools v4.4.22 | ISC */
2
- import React, { useContext, useState, createContext, useEffect, useMemo, useCallback } from 'react';
1
+ /*! aport-tools v4.4.23 | ISC */
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';
5
5
  import * as ImagePicker from 'expo-image-picker';
@@ -529,15 +529,19 @@ var Input = function Input(_a) {
529
529
  var _c = useState(""),
530
530
  internalValue = _c[0],
531
531
  setInternalValue = _c[1];
532
- // Initialize the internal value based on `firstValue` or `formValues`
532
+ var isFirstRender = useRef(true); // Track the first render
533
+ // Initialize the internal value when `firstValue` changes or on first render
533
534
  useEffect(function () {
534
- if (firstValue) {
535
- setInternalValue(firstValue);
536
- setFormValue(name, firstValue);
537
- } else {
538
- setInternalValue(formValues[name] || "");
535
+ if (isFirstRender.current) {
536
+ isFirstRender.current = false;
537
+ if (firstValue !== undefined) {
538
+ setInternalValue(firstValue);
539
+ setFormValue(name, firstValue);
540
+ } else {
541
+ setInternalValue(formValues[name] || "");
542
+ }
539
543
  }
540
- }, [firstValue, formValues[name]]);
544
+ }, [firstValue]); // Only re-run if `firstValue` changes
541
545
  /**
542
546
  * Handles text changes in the input field, applying formatting based on the inputType.
543
547
  *