aport-tools 4.4.24 → 4.4.25
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 +19 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -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.25 | 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,24 @@ 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
|
+
// Initialize with firstValue or an empty array
|
1151
|
+
var _h = useState(function () {
|
1152
|
+
return Array.isArray(firstValue) ? firstValue.slice(0, amount) : [];
|
1153
|
+
}),
|
1154
|
+
selectedFiles = _h[0],
|
1155
|
+
setSelectedFiles = _h[1];
|
1156
|
+
// Update the form context on mount with firstValue if provided
|
1157
|
+
useEffect(function () {
|
1158
|
+
if (firstValue.length > 0) {
|
1159
|
+
setFormValue(name, firstValue.slice(0, amount));
|
1160
|
+
}
|
1161
|
+
}, [firstValue, name, setFormValue, amount]);
|
1151
1162
|
var theme = useContext(ThemeContext).theme;
|
1152
1163
|
var colors = theme.colors;
|
1153
1164
|
var pickImage = function pickImage() {
|