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 +13 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
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
|
-
|
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 (
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
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
|
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
|
*
|