aport-tools 4.3.2 → 4.3.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.3.2 | ISC */
1
+ /*! aport-tools v4.3.3 | ISC */
2
2
  import React, { useContext, useState, createContext, useCallback, useMemo } from 'react';
3
3
  import { StyleSheet, Text as Text$1, View, TextInput, TouchableOpacity, Modal, Pressable, FlatList, Keyboard, Platform, Image, Alert, ActivityIndicator } from 'react-native';
4
4
  import { ThemeContext } from 'aport-themes';
@@ -386,13 +386,12 @@ var TextArea = function TextArea(_a) {
386
386
  style: [styles$6.textArea, style, {
387
387
  backgroundColor: colors.body.hex,
388
388
  color: colors.text.hex,
389
- borderColor: colors.placeHolder.hex
389
+ borderColor: formErrors[name] ? colors.error.hex : "#CCC"
390
390
  }],
391
391
  value: formValues[name] || '',
392
392
  onChangeText: handleChange,
393
393
  placeholder: label,
394
- placeholderTextColor: "#888" // Can be themed if needed
395
- ,
394
+ placeholderTextColor: colors.placeHolder.hex,
396
395
  multiline: true,
397
396
  numberOfLines: 4,
398
397
  textAlignVertical: "top"
@@ -471,7 +470,8 @@ var InputList = function InputList(_a) {
471
470
  onChange = _a.onChange;
472
471
  var _h = useFormContext(),
473
472
  formValues = _h.formValues,
474
- setFormValue = _h.setFormValue;
473
+ setFormValue = _h.setFormValue,
474
+ formErrors = _h.errors;
475
475
  var _j = useState(false),
476
476
  isDropdownVisible = _j[0],
477
477
  setIsDropdownVisible = _j[1];
@@ -548,14 +548,18 @@ var InputList = function InputList(_a) {
548
548
  marginBottom: 4
549
549
  }
550
550
  }, name), /*#__PURE__*/React.createElement(TouchableOpacity, {
551
- style: styles$4.inputContainer,
551
+ style: [styles$4.inputContainer, {
552
+ borderColor: formErrors[name] ? colors.error.hex : "#CCC"
553
+ }],
552
554
  onPress: toggleDropdown,
553
555
  disabled: disabled
554
556
  }, /*#__PURE__*/React.createElement(Text$1, {
555
557
  style: {
556
558
  color: colors.text.hex
557
559
  }
558
- }, renderSelectedText())), /*#__PURE__*/React.createElement(Modal, {
560
+ }, renderSelectedText())), formErrors[name] && formErrors[name].length > 0 && (/*#__PURE__*/React.createElement(ErrorList, {
561
+ errors: formErrors[name]
562
+ })), /*#__PURE__*/React.createElement(Modal, {
559
563
  visible: isDropdownVisible,
560
564
  transparent: true,
561
565
  animationType: "fade"
@@ -604,11 +608,12 @@ var InputList = function InputList(_a) {
604
608
  }))));
605
609
  };
606
610
  var styles$4 = StyleSheet.create({
607
- container: {},
611
+ container: {
612
+ marginVertical: 10
613
+ },
608
614
  inputContainer: {
609
615
  padding: 12,
610
616
  borderWidth: 1,
611
- borderColor: '#ccc',
612
617
  borderRadius: 5
613
618
  },
614
619
  dropdownContainer: {
@@ -833,9 +838,8 @@ var InputAttach = function InputAttach(_a) {
833
838
  _e = _a.placeholder,
834
839
  placeholder = _e === void 0 ? "Upload an image" : _e;
835
840
  var _f = useFormContext(),
836
- setFormValue = _f.setFormValue;
837
- _f.formValues;
838
- var errors = _f.errors;
841
+ setFormValue = _f.setFormValue,
842
+ errors = _f.errors;
839
843
  var _g = useState([]),
840
844
  selectedFiles = _g[0],
841
845
  setSelectedFiles = _g[1];
@@ -856,7 +860,9 @@ var InputAttach = function InputAttach(_a) {
856
860
  return [2 /*return*/];
857
861
  }
858
862
  return [4 /*yield*/, ImagePicker.launchImageLibraryAsync({
859
- mediaTypes: ImagePicker.MediaTypeOptions.Images,
863
+ mediaTypes: ["images"],
864
+ // Updated usage
865
+ allowsEditing: true,
860
866
  allowsMultipleSelection: amount > 1,
861
867
  quality: 1
862
868
  })];
@@ -949,7 +955,7 @@ var styles$1 = StyleSheet.create({
949
955
  marginVertical: 10
950
956
  },
951
957
  label: {
952
- marginBottom: 5
958
+ marginTop: 5
953
959
  },
954
960
  fileContainer: {
955
961
  flexDirection: "row",