aport-tools 4.4.48 → 4.4.51

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 CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.4.48 | ISC */
1
+ /*! aport-tools v4.4.51 | 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';
@@ -805,15 +805,19 @@ var InputList = function InputList(_a) {
805
805
  setSelectedOptions = _l[1];
806
806
  // Update form value when firstValue changes
807
807
  useEffect(function () {
808
+ if (!firstValue || firstValue.length === 0) return;
809
+ var matchedSelections = options.filter(function (opt) {
810
+ return firstValue.includes(opt.value);
811
+ });
808
812
  if (multi) {
809
- setSelectedOptions(initialSelections);
810
- setFormValue(name, initialSelections, initialSelections);
813
+ setSelectedOptions(matchedSelections);
814
+ setFormValue(name, matchedSelections, matchedSelections);
811
815
  } else {
812
- var singleValue = initialSelections[0] || null;
816
+ var singleValue = matchedSelections[0] || null;
813
817
  setSelectedOptions(singleValue);
814
818
  setFormValue(name, singleValue, singleValue);
815
819
  }
816
- }, [firstValue, multi, initialSelections]);
820
+ }, [firstValue, multi]);
817
821
  // Handle option selection
818
822
  var handleSelectOption = function handleSelectOption(option) {
819
823
  var updatedSelections;