aport-tools 4.4.24 → 4.4.26
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/InputAttach.d.ts +6 -0
- package/dist/index.esm.js +20 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
@@ -1,10 +1,16 @@
|
|
1
1
|
import React from "react";
|
2
|
+
interface FileData {
|
3
|
+
uri: string;
|
4
|
+
name: string;
|
5
|
+
type: string;
|
6
|
+
}
|
2
7
|
interface InputAttachProps {
|
3
8
|
name: string;
|
4
9
|
type?: string[];
|
5
10
|
amount?: number;
|
6
11
|
disabled?: boolean;
|
7
12
|
placeholder?: string;
|
13
|
+
firstValue?: FileData[];
|
8
14
|
}
|
9
15
|
declare const InputAttach: React.FC<InputAttachProps>;
|
10
16
|
export default InputAttach;
|
package/dist/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.26 | 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';
|
@@ -1141,13 +1141,25 @@ var InputAttach = function InputAttach(_a) {
|
|
1141
1141
|
_d = _a.disabled,
|
1142
1142
|
disabled = _d === void 0 ? false : _d,
|
1143
1143
|
_e = _a.placeholder,
|
1144
|
-
placeholder = _e === void 0 ? "Upload an image" : _e
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1144
|
+
placeholder = _e === void 0 ? "Upload an image" : _e,
|
1145
|
+
_f = _a.firstValue,
|
1146
|
+
firstValue = _f === void 0 ? [] : _f;
|
1147
|
+
var _g = useFormContext(),
|
1148
|
+
setFormValue = _g.setFormValue,
|
1149
|
+
formErrors = _g.errors;
|
1150
|
+
var _h = useState([]),
|
1151
|
+
selectedFiles = _h[0],
|
1152
|
+
setSelectedFiles = _h[1];
|
1153
|
+
// Ref to track initialization
|
1154
|
+
var isInitialized = useRef(false);
|
1155
|
+
// Sync firstValue with selectedFiles when it changes
|
1156
|
+
useEffect(function () {
|
1157
|
+
if (!isInitialized.current) {
|
1158
|
+
setSelectedFiles(firstValue);
|
1159
|
+
setFormValue(name, firstValue); // Update form context
|
1160
|
+
isInitialized.current = true;
|
1161
|
+
}
|
1162
|
+
}, [firstValue, name, setFormValue]);
|
1151
1163
|
var theme = useContext(ThemeContext).theme;
|
1152
1164
|
var colors = theme.colors;
|
1153
1165
|
var pickImage = function pickImage() {
|