aport-tools 4.4.27 → 4.4.28
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/InputCheck.d.ts +1 -1
- package/dist/index.esm.js +24 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
@@ -13,7 +13,7 @@ interface InputCheckProps {
|
|
13
13
|
rowAmount?: number;
|
14
14
|
iconPosition?: "row" | "column";
|
15
15
|
disabled?: boolean;
|
16
|
-
firstValue
|
16
|
+
firstValue?: InputOption[];
|
17
17
|
}
|
18
18
|
declare const InputCheck: React.FC<InputCheckProps>;
|
19
19
|
export default InputCheck;
|
package/dist/index.esm.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.28 | 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';
|
@@ -1015,38 +1015,33 @@ var InputCheck = function InputCheck(_a) {
|
|
1015
1015
|
max = _a.max,
|
1016
1016
|
_c = _a.rowAmount,
|
1017
1017
|
rowAmount = _c === void 0 ? 3 : _c,
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
setSelectedValues = _h[1];
|
1018
|
+
firstValue = _a.firstValue,
|
1019
|
+
_d = _a.iconPosition,
|
1020
|
+
iconPosition = _d === void 0 ? "row" : _d,
|
1021
|
+
_e = _a.disabled,
|
1022
|
+
disabled = _e === void 0 ? false : _e;
|
1023
|
+
var _f = useFormContext();
|
1024
|
+
_f.formValues;
|
1025
|
+
var setFormValue = _f.setFormValue,
|
1026
|
+
formErrors = _f.errors;
|
1027
|
+
var _g = useState([]),
|
1028
|
+
selectedValues = _g[0],
|
1029
|
+
setSelectedValues = _g[1];
|
1031
1030
|
var theme = useContext(ThemeContext).theme;
|
1032
1031
|
var colors = theme.colors;
|
1033
|
-
|
1032
|
+
var isFirstRender = useRef(true);
|
1033
|
+
// Initialize selectedValues on first render if firstValue is provided
|
1034
1034
|
useEffect(function () {
|
1035
|
-
|
1036
|
-
|
1037
|
-
return
|
1035
|
+
if (isFirstRender.current && firstValue) {
|
1036
|
+
var initialSelectedValues = options.filter(function (option) {
|
1037
|
+
return firstValue.some(function (fv) {
|
1038
|
+
return fv.value === option.value;
|
1039
|
+
});
|
1038
1040
|
});
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
return {
|
1044
|
-
id: id,
|
1045
|
-
value: value
|
1046
|
-
};
|
1047
|
-
});
|
1048
|
-
setSelectedValues(formattedValues);
|
1049
|
-
setFormValue(name, formattedValues); // Update form context
|
1041
|
+
setSelectedValues(initialSelectedValues);
|
1042
|
+
setFormValue(name, initialSelectedValues); // Update form context
|
1043
|
+
isFirstRender.current = false; // Prevent subsequent updates
|
1044
|
+
}
|
1050
1045
|
}, [firstValue, name, options, setFormValue]);
|
1051
1046
|
var handleSelect = function handleSelect(id, value) {
|
1052
1047
|
if (disabled) return;
|