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.
@@ -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.24 | ISC */
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
- var _f = useFormContext(),
1146
- setFormValue = _f.setFormValue,
1147
- formErrors = _f.errors;
1148
- var _g = useState([]),
1149
- selectedFiles = _g[0],
1150
- setSelectedFiles = _g[1];
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() {