react-native-input-select 1.3.18 → 2.1.0

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.
Files changed (125) hide show
  1. package/README.md +40 -95
  2. package/lib/commonjs/components/CheckBox/index.js +19 -13
  3. package/lib/commonjs/components/CheckBox/index.js.map +1 -1
  4. package/lib/commonjs/components/CustomModal/index.js +12 -16
  5. package/lib/commonjs/components/CustomModal/index.js.map +1 -1
  6. package/lib/commonjs/components/Dropdown/Dropdown.js +3 -2
  7. package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
  8. package/lib/commonjs/components/Dropdown/DropdownListItem.js +2 -11
  9. package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
  10. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +14 -14
  11. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  12. package/lib/commonjs/components/Input/index.js.map +1 -1
  13. package/lib/commonjs/components/{Dropdown → List}/DropdownFlatList.js +7 -28
  14. package/lib/commonjs/components/List/DropdownFlatList.js.map +1 -0
  15. package/lib/commonjs/components/{Dropdown → List}/DropdownSectionList.js +6 -24
  16. package/lib/commonjs/components/List/DropdownSectionList.js.map +1 -0
  17. package/lib/commonjs/hooks/index.js +61 -0
  18. package/lib/commonjs/hooks/index.js.map +1 -0
  19. package/lib/commonjs/hooks/use-index-of-selected-item.js +49 -0
  20. package/lib/commonjs/hooks/use-index-of-selected-item.js.map +1 -0
  21. package/lib/commonjs/hooks/use-modal.js +37 -0
  22. package/lib/commonjs/hooks/use-modal.js.map +1 -0
  23. package/lib/commonjs/hooks/use-search.js +58 -0
  24. package/lib/commonjs/hooks/use-search.js.map +1 -0
  25. package/lib/commonjs/hooks/use-select-all.js +70 -0
  26. package/lib/commonjs/hooks/use-select-all.js.map +1 -0
  27. package/lib/commonjs/hooks/use-selection-handler.js +62 -0
  28. package/lib/commonjs/hooks/use-selection-handler.js.map +1 -0
  29. package/lib/commonjs/index.js +120 -260
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/utils/index.js +40 -5
  32. package/lib/commonjs/utils/index.js.map +1 -1
  33. package/lib/module/components/CheckBox/index.js +19 -13
  34. package/lib/module/components/CheckBox/index.js.map +1 -1
  35. package/lib/module/components/CustomModal/index.js +12 -15
  36. package/lib/module/components/CustomModal/index.js.map +1 -1
  37. package/lib/module/components/Dropdown/Dropdown.js +3 -2
  38. package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
  39. package/lib/module/components/Dropdown/DropdownListItem.js +2 -11
  40. package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
  41. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +14 -14
  42. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  43. package/lib/module/components/Input/index.js.map +1 -1
  44. package/lib/module/components/{Dropdown → List}/DropdownFlatList.js +7 -28
  45. package/lib/module/components/List/DropdownFlatList.js.map +1 -0
  46. package/lib/module/components/{Dropdown → List}/DropdownSectionList.js +6 -24
  47. package/lib/module/components/List/DropdownSectionList.js.map +1 -0
  48. package/lib/module/hooks/index.js +6 -0
  49. package/lib/module/hooks/index.js.map +1 -0
  50. package/lib/module/hooks/use-index-of-selected-item.js +42 -0
  51. package/lib/module/hooks/use-index-of-selected-item.js.map +1 -0
  52. package/lib/module/hooks/use-modal.js +30 -0
  53. package/lib/module/hooks/use-modal.js.map +1 -0
  54. package/lib/module/hooks/use-search.js +51 -0
  55. package/lib/module/hooks/use-search.js.map +1 -0
  56. package/lib/module/hooks/use-select-all.js +63 -0
  57. package/lib/module/hooks/use-select-all.js.map +1 -0
  58. package/lib/module/hooks/use-selection-handler.js +55 -0
  59. package/lib/module/hooks/use-selection-handler.js.map +1 -0
  60. package/lib/module/index.js +123 -262
  61. package/lib/module/index.js.map +1 -1
  62. package/lib/module/utils/index.js +36 -4
  63. package/lib/module/utils/index.js.map +1 -1
  64. package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts +4 -2
  65. package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts.map +1 -1
  66. package/lib/typescript/src/components/CheckBox/index.d.ts +2 -2
  67. package/lib/typescript/src/components/CheckBox/index.d.ts.map +1 -1
  68. package/lib/typescript/src/components/CustomModal/index.d.ts +3 -1
  69. package/lib/typescript/src/components/CustomModal/index.d.ts.map +1 -1
  70. package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +1 -1
  71. package/lib/typescript/src/components/Dropdown/Dropdown.d.ts.map +1 -1
  72. package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts +1 -1
  73. package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts.map +1 -1
  74. package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
  75. package/lib/typescript/src/components/Input/index.d.ts +5 -1
  76. package/lib/typescript/src/components/Input/index.d.ts.map +1 -1
  77. package/lib/typescript/src/components/List/DropdownFlatList.d.ts +6 -0
  78. package/lib/typescript/src/components/List/DropdownFlatList.d.ts.map +1 -0
  79. package/lib/typescript/src/components/List/DropdownSectionList.d.ts +4 -0
  80. package/lib/typescript/src/components/List/DropdownSectionList.d.ts.map +1 -0
  81. package/lib/typescript/src/hooks/index.d.ts +6 -0
  82. package/lib/typescript/src/hooks/index.d.ts.map +1 -0
  83. package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts +23 -0
  84. package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts.map +1 -0
  85. package/lib/typescript/src/hooks/use-modal.d.ts +13 -0
  86. package/lib/typescript/src/hooks/use-modal.d.ts.map +1 -0
  87. package/lib/typescript/src/hooks/use-search.d.ts +16 -0
  88. package/lib/typescript/src/hooks/use-search.d.ts.map +1 -0
  89. package/lib/typescript/src/hooks/use-select-all.d.ts +18 -0
  90. package/lib/typescript/src/hooks/use-select-all.d.ts.map +1 -0
  91. package/lib/typescript/src/hooks/use-selection-handler.d.ts +19 -0
  92. package/lib/typescript/src/hooks/use-selection-handler.d.ts.map +1 -0
  93. package/lib/typescript/src/index.d.ts +19 -2
  94. package/lib/typescript/src/index.d.ts.map +1 -1
  95. package/lib/typescript/src/types/index.types.d.ts +33 -53
  96. package/lib/typescript/src/types/index.types.d.ts.map +1 -1
  97. package/lib/typescript/src/utils/index.d.ts +17 -3
  98. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  99. package/package.json +21 -7
  100. package/src/components/CheckBox/checkbox.types.ts +2 -2
  101. package/src/components/CheckBox/index.tsx +23 -47
  102. package/src/components/CustomModal/index.tsx +15 -23
  103. package/src/components/Dropdown/Dropdown.tsx +3 -2
  104. package/src/components/Dropdown/DropdownListItem.tsx +1 -14
  105. package/src/components/Dropdown/DropdownSelectedItemsView.tsx +13 -13
  106. package/src/components/Input/index.tsx +13 -2
  107. package/src/components/{Dropdown → List}/DropdownFlatList.tsx +11 -23
  108. package/src/components/{Dropdown → List}/DropdownSectionList.tsx +10 -22
  109. package/src/hooks/index.ts +5 -0
  110. package/src/hooks/use-index-of-selected-item.ts +49 -0
  111. package/src/hooks/use-modal.ts +40 -0
  112. package/src/hooks/use-search.ts +95 -0
  113. package/src/hooks/use-select-all.ts +79 -0
  114. package/src/hooks/use-selection-handler.ts +81 -0
  115. package/src/index.tsx +277 -443
  116. package/src/types/index.types.ts +41 -56
  117. package/src/utils/index.ts +60 -3
  118. package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +0 -1
  119. package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +0 -1
  120. package/lib/module/components/Dropdown/DropdownFlatList.js.map +0 -1
  121. package/lib/module/components/Dropdown/DropdownSectionList.js.map +0 -1
  122. package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts +0 -6
  123. package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts.map +0 -1
  124. package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts +0 -4
  125. package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare const Dropdown: ({ testID, label, placeholder, helperText, error, getSelectedItemsLabel, openModal, closeModal, isMultiple, selectedItem, selectedItems, dropdownIcon, labelStyle, dropdownStyle, dropdownIconStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
2
+ declare const Dropdown: ({ testID, label, placeholder, helperText, error, labelsOfSelectedItems, openModal, closeModal, isMultiple, selectedItem, selectedItems, dropdownIcon, labelStyle, dropdownStyle, dropdownIconStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
3
3
  export default Dropdown;
4
4
  //# sourceMappingURL=Dropdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,QAAQ,uZA0BX,GAAG,sBA2CL,CAAC;AAUF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,QAAA,MAAM,QAAQ,uZA0BX,GAAG,sBA4CL,CAAC;AAUF,eAAe,QAAQ,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, }: any) => React.JSX.Element>;
2
+ declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxControls, }: any) => React.JSX.Element>;
3
3
  export default _default;
4
4
  //# sourceMappingURL=DropdownListItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;2PAkBjC,GAAG;AAuCN,wBAAsC"}
1
+ {"version":3,"file":"DropdownListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;8JAajC,GAAG;AA+BN,wBAAsC"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- declare const DropdownSelectedItemsView: ({ placeholder, error, getSelectedItemsLabel, openModal, isMultiple, selectedItem, selectedItems, dropdownIcon, dropdownStyle, dropdownIconStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
2
+ declare const DropdownSelectedItemsView: ({ placeholder, error, labelsOfSelectedItems, openModal, isMultiple, selectedItem, selectedItems, dropdownIcon, dropdownStyle, dropdownIconStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
3
3
  export default DropdownSelectedItemsView;
4
4
  //# sourceMappingURL=DropdownSelectedItemsView.d.ts.map
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
- export declare const Input: ({ placeholder, value, onChangeText, style, primaryColor, textInputContainerStyle, ...rest }: any) => React.JSX.Element;
2
+ import { TextInputProps, ViewStyle, ColorValue } from 'react-native';
3
+ export declare const Input: ({ placeholder, value, onChangeText, style, primaryColor, textInputContainerStyle, ...rest }: {
4
+ primaryColor?: ColorValue;
5
+ textInputContainerStyle?: ViewStyle;
6
+ } & TextInputProps) => React.JSX.Element;
3
7
  export default Input;
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,eAAO,MAAM,KAAK,gGAQf,GAAG,sBA4BL,CAAC;AAMF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAKL,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,KAAK,gGAQf;IACD,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,uBAAuB,CAAC,EAAE,SAAS,CAAC;CACrC,GAAG,cAAc,sBA4BjB,CAAC;AAMF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { FlatListProps } from 'react-native';
3
+ import { TFlatList } from '../../types/index.types';
4
+ declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxControls, listComponentStyles, listIndex, emptyListMessage, listEmptyComponent, ...rest }: any & FlatListProps<TFlatList>) => React.JSX.Element;
5
+ export default DropdownFlatList;
6
+ //# sourceMappingURL=DropdownFlatList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownFlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/DropdownFlatList.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAY,aAAa,EAAc,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAA,MAAM,gBAAgB,iQAiBnB,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,sBAkEhC,CAAC;AAsBF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxControls, listComponentStyles, listIndex, emptyListMessage, listEmptyComponent, ...rest }: any) => React.JSX.Element;
3
+ export default DropdownSectionList;
4
+ //# sourceMappingURL=DropdownSectionList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownSectionList.d.ts","sourceRoot":"","sources":["../../../../../src/components/List/DropdownSectionList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAW3D,QAAA,MAAM,mBAAmB,iQAiBtB,GAAG,sBA0GL,CAAC;AA0BF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './use-search';
2
+ export * from './use-selection-handler';
3
+ export * from './use-index-of-selected-item';
4
+ export * from './use-modal';
5
+ export * from './use-select-all';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { TFlatListItem, TSectionListItem } from '../types/index.types';
2
+ interface UseIndexOfSelectedItemProps {
3
+ options: (TFlatListItem | TSectionListItem)[];
4
+ optionLabel: string;
5
+ isSectionList: boolean;
6
+ }
7
+ /**
8
+ *
9
+ * @description for scrollToIndex in Sectionlist and Flatlist
10
+ */
11
+ export declare const useIndexOfSelectedItem: ({ options, optionLabel, isSectionList, }: UseIndexOfSelectedItemProps) => {
12
+ listIndex: {
13
+ sectionIndex?: number;
14
+ itemIndex: number;
15
+ };
16
+ setListIndex: import("react").Dispatch<import("react").SetStateAction<{
17
+ sectionIndex?: number;
18
+ itemIndex: number;
19
+ }>>;
20
+ setIndexOfSelectedItem: (selectedLabel: string) => void;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=use-index-of-selected-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-index-of-selected-item.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-index-of-selected-item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,UAAU,2BAA2B;IACnC,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AAEH,eAAO,MAAM,sBAAsB,6CAIhC,2BAA2B;;uBAEX,MAAM;mBACV,MAAM;;;uBADF,MAAM;mBACV,MAAM;;4CAID,MAAM;CAuBzB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { TCustomModalControls } from '../types/index.types';
2
+ interface UseModalProps {
3
+ resetOptionsRelatedState: () => void;
4
+ disabled?: boolean;
5
+ modalControls?: TCustomModalControls;
6
+ }
7
+ export declare const useModal: ({ resetOptionsRelatedState, disabled, modalControls, }: UseModalProps) => {
8
+ isVisible: boolean;
9
+ openModal: () => void;
10
+ closeModal: () => void;
11
+ };
12
+ export {};
13
+ //# sourceMappingURL=use-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-modal.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-modal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,aAAa;IACrB,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,eAAO,MAAM,QAAQ,2DAIlB,aAAa;;;;CAyBf,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { TFlatList, TSectionList } from '../types/index.types';
2
+ interface UseSearchProps {
3
+ initialOptions: TFlatList | TSectionList;
4
+ optionLabel: string;
5
+ optionValue: string;
6
+ searchCallback: (value: string) => void;
7
+ }
8
+ export declare const useSearch: ({ initialOptions, optionLabel, optionValue, searchCallback, }: UseSearchProps) => {
9
+ searchValue: string;
10
+ setSearchValue: import("react").Dispatch<import("react").SetStateAction<string>>;
11
+ filteredOptions: TFlatList | TSectionList;
12
+ setFilteredOptions: import("react").Dispatch<import("react").SetStateAction<TFlatList | TSectionList>>;
13
+ isSectionList: boolean;
14
+ };
15
+ export {};
16
+ //# sourceMappingURL=use-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAG9B,UAAU,cAAc;IACtB,cAAc,EAAE,SAAS,GAAG,YAAY,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,SAAS,kEAKnB,cAAc;;;;;;CAyEhB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { TFlatListItem, TSelectedItem } from '../types/index.types';
2
+ interface UseCheckSelectAllProps {
3
+ options: TFlatListItem[];
4
+ selectedItems: TSelectedItem[];
5
+ isMultiple: boolean;
6
+ onValueChange: (selectedValues: TSelectedItem[]) => void;
7
+ listControls?: {
8
+ selectAllCallback?: () => void;
9
+ unselectAllCallback?: () => void;
10
+ };
11
+ optionValue: string;
12
+ }
13
+ export declare const useSelectAll: ({ options, selectedItems, isMultiple, onValueChange, listControls, optionValue, }: UseCheckSelectAllProps) => {
14
+ selectAll: boolean;
15
+ handleSelectAll: () => void;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=use-select-all.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-select-all.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-select-all.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGpE,UAAU,sBAAsB;IAC9B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACzD,YAAY,CAAC,EAAE;QACb,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;QAC/B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;KAClC,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,sFAOtB,sBAAsB;;;CAuDxB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { TSelectedItem } from '../types/index.types';
2
+ interface UseSelectionHandlerProps {
3
+ initialSelectedValue: TSelectedItem | TSelectedItem[];
4
+ isMultiple: boolean;
5
+ maxSelectableItems?: number;
6
+ onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
7
+ closeModal: () => void;
8
+ autoCloseOnSelect: boolean;
9
+ }
10
+ export declare const useSelectionHandler: ({ initialSelectedValue, isMultiple, maxSelectableItems, onValueChange, closeModal, autoCloseOnSelect, }: UseSelectionHandlerProps) => {
11
+ selectedItem: TSelectedItem;
12
+ selectedItems: TSelectedItem[];
13
+ handleSingleSelection: (value: TSelectedItem) => void;
14
+ handleMultipleSelections: (value: TSelectedItem) => void;
15
+ setSelectedItems: import("react").Dispatch<import("react").SetStateAction<TSelectedItem[]>>;
16
+ setSelectedItem: import("react").Dispatch<import("react").SetStateAction<TSelectedItem>>;
17
+ };
18
+ export {};
19
+ //# sourceMappingURL=use-selection-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-selection-handler.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-selection-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,UAAU,wBAAwB;IAChC,oBAAoB,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,EAAE,KAAK,IAAI,CAAC;IACxE,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,4GAO7B,wBAAwB;;;mCAUf,aAAa;sCAiBb,aAAa;;;CAkCxB,CAAC"}
@@ -1,5 +1,22 @@
1
1
  import React from 'react';
2
- import type { DropdownProps } from './types/index.types';
3
- export declare const DropdownSelect: React.FC<DropdownProps>;
2
+ import type { DropdownSelectHandle } from './types/index.types';
3
+ export declare const DropdownSelect: React.ForwardRefExoticComponent<import("./types/index.types").CommonDropdownProps & import("./types/index.types").TDropdownInputProps & {
4
+ searchControls?: {
5
+ textInputStyle?: import("react-native").ViewStyle | import("react-native").TextStyle;
6
+ textInputContainerStyle?: import("react-native").ViewStyle;
7
+ textInputProps?: import("react-native").TextInputProps;
8
+ searchCallback?: (value: string) => void;
9
+ };
10
+ checkboxControls?: import("./types/index.types").TCheckboxControls;
11
+ modalControls?: import("./types/index.types").TCustomModalControls;
12
+ listControls?: {
13
+ selectAllText?: string;
14
+ unselectAllText?: string;
15
+ selectAllCallback?: () => void;
16
+ unselectAllCallback?: () => void;
17
+ hideSelectAll?: boolean;
18
+ emptyListMessage?: string;
19
+ };
20
+ } & import("./types/index.types").TListProps & React.RefAttributes<DropdownSelectHandle>>;
4
21
  export default DropdownSelect;
5
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAUxE,OAAO,KAAK,EACV,aAAa,EAMd,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA2blD,CAAC;AAUF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAEV,oBAAoB,EAErB,MAAM,qBAAqB,CAAC;AAU7B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;yFA6Q1B,CAAC;AASF,eAAe,cAAc,CAAC"}
@@ -1,15 +1,16 @@
1
1
  import React from 'react';
2
2
  import type { ViewStyle, ColorValue, TextStyle, ModalProps, TextInputProps } from 'react-native';
3
- export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TSearchControls & TCheckboxControls & TCustomModalControls & TListControls;
3
+ export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TControls & TListProps;
4
4
  export type CommonDropdownProps = {
5
5
  testID?: string;
6
6
  label?: string;
7
7
  options: TFlatList | TSectionList;
8
8
  optionLabel?: string;
9
9
  optionValue?: string;
10
- onValueChange: Function;
11
- selectedValue?: TSelectedItem | TSelectedItem[];
10
+ onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
11
+ selectedValue: TSelectedItem | TSelectedItem[];
12
12
  autoCloseOnSelect?: boolean;
13
+ maxSelectableItems?: number;
13
14
  };
14
15
  export type TDropdownInputProps = {
15
16
  placeholder?: string;
@@ -30,59 +31,33 @@ export type TDropdownInputProps = {
30
31
  primaryColor?: ColorValue;
31
32
  disabled?: boolean;
32
33
  placeholderStyle?: TextStyle;
33
- hideModal?: boolean;
34
34
  };
35
- export type TSearchControls = {
36
- /** @deprecated Use `searchControls = {{textInputStyle: ViewStyle | TextStyle }}` instead.*/
37
- searchInputStyle?: ViewStyle;
38
- searchControls?: {
39
- textInputStyle?: ViewStyle | TextStyle;
40
- textInputContainerStyle?: ViewStyle;
41
- textInputProps?: TextInputProps;
42
- searchCallback?: (value: string) => void;
43
- };
35
+ type TControls = {
36
+ searchControls?: TSearchControls;
37
+ checkboxControls?: TCheckboxControls;
38
+ modalControls?: TCustomModalControls;
39
+ listControls?: TListControls;
40
+ };
41
+ type TSearchControls = {
42
+ textInputStyle?: ViewStyle | TextStyle;
43
+ textInputContainerStyle?: ViewStyle;
44
+ textInputProps?: TextInputProps;
45
+ searchCallback?: (value: string) => void;
44
46
  };
45
47
  export type TCheckboxControls = {
46
- /** @deprecated Use `checkboxControls = {{checkboxSize: number }}` instead.*/
47
48
  checkboxSize?: number;
48
- /** @deprecated Use `checkboxControls = {{checkboxStyle: ViewStyle }}` instead.*/
49
49
  checkboxStyle?: ViewStyle;
50
- /** @deprecated Use `checkboxControls = {{checkboxLabelStyle: TextStyle }}` instead.*/
51
50
  checkboxLabelStyle?: TextStyle;
52
- /** @deprecated Use `checkboxControls` instead.*/
53
- checkboxComponentStyles?: {
54
- checkboxSize?: number;
55
- checkboxStyle?: ViewStyle;
56
- checkboxLabelStyle?: TextStyle;
57
- };
58
- /** @deprecated Use `checkboxControls = {{checkboxComponent: <View></View> }}` instead.*/
59
51
  checkboxComponent?: React.ReactNode;
60
- checkboxControls?: {
61
- checkboxSize?: number;
62
- checkboxStyle?: ViewStyle;
63
- checkboxLabelStyle?: TextStyle;
64
- checkboxComponent?: React.ReactNode;
65
- checkboxDisabledStyle?: ViewStyle;
66
- checkboxUnselectedColor?: ColorValue;
67
- };
52
+ checkboxDisabledStyle?: ViewStyle;
53
+ checkboxUnselectedColor?: ColorValue;
68
54
  };
69
55
  export type TCustomModalControls = {
70
- /** @deprecated Use `modalControls = {{modalBackgroundStyle: ViewStyle}} instead.*/
71
56
  modalBackgroundStyle?: ViewStyle;
72
- /** @deprecated Use `modalControls = {{ modalOptionsContainerStyle: ViewStyle}} instead.*/
73
57
  modalOptionsContainerStyle?: ViewStyle;
74
- /** @deprecated Use `modalControls = {{modalProps: ModalProps }}` instead.*/
75
58
  modalProps?: ModalProps;
76
- modalControls?: {
77
- modalBackgroundStyle?: ViewStyle;
78
- modalOptionsContainerStyle?: ViewStyle;
79
- modalProps?: ModalProps & TCloseModal;
80
- };
81
- } & TCloseModal;
82
- type TCloseModal = {
83
- closeModal?: () => void;
84
59
  };
85
- export type TListControls = {
60
+ export type TListProps = {
86
61
  listHeaderComponent?: React.ReactNode;
87
62
  listFooterComponent?: React.ReactNode;
88
63
  listComponentStyles?: {
@@ -91,24 +66,29 @@ export type TListControls = {
91
66
  sectionHeaderStyle?: TextStyle;
92
67
  };
93
68
  listEmptyComponent?: React.ReactNode;
94
- listControls?: {
95
- selectAllText?: string;
96
- unselectAllText?: string;
97
- selectAllCallback?: () => void;
98
- unselectAllCallback?: () => void;
99
- hideSelectAll?: boolean;
100
- emptyListMessage?: string;
101
- };
102
69
  };
103
- export type TSelectedItem = string | number | boolean;
70
+ type TListControls = {
71
+ selectAllText?: string;
72
+ unselectAllText?: string;
73
+ selectAllCallback?: () => void;
74
+ unselectAllCallback?: () => void;
75
+ hideSelectAll?: boolean;
76
+ emptyListMessage?: string;
77
+ };
78
+ export type TSelectedItem = string | number | boolean | undefined;
79
+ export type TSelectedItemWithReactComponent = TSelectedItem | React.ReactElement;
104
80
  export type TFlatList = TFlatListItem[];
105
81
  export type TFlatListItem = {
106
- [key: string]: TSelectedItem | React.JSX.Element;
82
+ [key: string]: TSelectedItemWithReactComponent;
107
83
  };
108
84
  export type TSectionList = TSectionListItem[];
109
85
  export type TSectionListItem = {
110
86
  title: string;
111
87
  data: TFlatList;
112
88
  };
89
+ export interface DropdownSelectHandle {
90
+ open: () => void;
91
+ close: () => void;
92
+ }
113
93
  export {};
114
94
  //# sourceMappingURL=index.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../../../src/types/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAC7C,mBAAmB,GACnB,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,aAAa,CAAC;AAEhB,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,GAAG,YAAY,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,QAAQ,CAAC;IACxB,aAAa,CAAC,EAAE,aAAa,GAAG,aAAa,EAAE,CAAC;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,sBAAsB,CAAC,EAAE,SAAS,CAAC;IACnC,k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gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAElE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
@@ -1,6 +1,20 @@
1
- /**
2
- * Extract property from array
3
- */
1
+ import { TSelectedItem } from '../types/index.types';
2
+ import { TFlatList, TFlatListItem, TSectionList, TSelectedItemWithReactComponent } from '../types/index.types';
4
3
  export declare const extractPropertyFromArray: (arr: any[], property: string) => any[];
5
4
  export declare const escapeRegExp: (text: string) => string;
5
+ export declare const removeDisabledItems: (items: TFlatList) => TFlatListItem[];
6
+ export declare const isSectionList: (options: TFlatList | TSectionList) => boolean;
7
+ /**
8
+ *
9
+ * @description get the labels of the items that were selected from the options array for either multiple or single selections
10
+ * @returns
11
+ */
12
+ export declare const getLabelsOfSelectedItems: ({ isMultiple, optionLabel, optionValue, selectedItem, selectedItems, modifiedOptions, }: {
13
+ isMultiple: boolean;
14
+ optionLabel: string;
15
+ optionValue: string;
16
+ selectedItem: TSelectedItem;
17
+ selectedItems: TSelectedItem[];
18
+ modifiedOptions: TFlatList;
19
+ }) => TSelectedItemWithReactComponent | TSelectedItemWithReactComponent[];
6
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,wBAAwB,QAAS,GAAG,EAAE,YAAY,MAAM,UAIpE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,WAExC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,+BAA+B,EAChC,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,wBAAwB,QAAS,GAAG,EAAE,YAAY,MAAM,UAIpE,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,WAExC,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,SAAS,oBAEnD,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,SAAS,GAAG,YAAY,KAAG,OAIjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,4FAOlC;IACD,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,aAAa,CAAC;IAC5B,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,eAAe,EAAE,SAAS,CAAC;CAC5B,wEAsBA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-input-select",
3
- "version": "1.3.18",
3
+ "version": "2.1.0",
4
4
  "description": "A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -68,14 +68,14 @@
68
68
  "@types/react": "18.3.2",
69
69
  "@types/react-native": "^0.73.0",
70
70
  "commitlint": "^19.3.0",
71
- "eslint": "^9.2.0",
72
- "eslint-config-prettier": "^9.1.0",
73
- "eslint-plugin-prettier": "^5.1.3",
71
+ "eslint": "^7.2.0",
72
+ "eslint-config-prettier": "^7.0.0",
73
+ "eslint-plugin-prettier": "^3.1.3",
74
74
  "husky": "^9.0.11",
75
75
  "jest": "^29.7.0",
76
76
  "metro-react-native-babel-preset": "^0.77.0",
77
77
  "pod-install": "^0.2.2",
78
- "prettier": "^3.2.5",
78
+ "prettier": "^2.0.5",
79
79
  "react": "^18.3.1",
80
80
  "react-native": "^0.74.1",
81
81
  "react-native-builder-bob": "^0.23.2",
@@ -92,7 +92,19 @@
92
92
  "modulePathIgnorePatterns": [
93
93
  "<rootDir>/example/node_modules",
94
94
  "<rootDir>/lib/"
95
- ]
95
+ ],
96
+ "coverageReporters": [
97
+ "html",
98
+ "text"
99
+ ],
100
+ "coverageThreshold": {
101
+ "global": {
102
+ "branches": 94,
103
+ "functions": 94,
104
+ "lines": 94,
105
+ "statements": 94
106
+ }
107
+ }
96
108
  },
97
109
  "commitlint": {
98
110
  "extends": [
@@ -120,7 +132,9 @@
120
132
  },
121
133
  "eslintIgnore": [
122
134
  "node_modules/",
123
- "lib/"
135
+ "lib/",
136
+ "coverage/",
137
+ "src/__tests__/**"
124
138
  ],
125
139
  "prettier": {
126
140
  "quoteProps": "consistent",
@@ -1,5 +1,5 @@
1
1
  import type { ColorValue } from 'react-native';
2
- import { TCheckboxControls } from 'src/types/index.types';
2
+ import { TCheckboxControls } from '../../types/index.types';
3
3
 
4
4
  export type CheckboxProps = {
5
5
  label?: string;
@@ -7,4 +7,4 @@ export type CheckboxProps = {
7
7
  disabled?: boolean;
8
8
  primaryColor?: ColorValue;
9
9
  onChange?: (value: boolean | string | number) => void;
10
- } & TCheckboxControls;
10
+ } & { checkboxControls?: TCheckboxControls };
@@ -2,85 +2,61 @@ import React from 'react';
2
2
  import { Pressable, Text, StyleSheet, Image, View } from 'react-native';
3
3
  import { colors } from '../../styles/colors';
4
4
  import { CHECKBOX_SIZE } from '../../constants';
5
- import type { CheckboxProps } from './checkbox.types';
5
+ import { CheckboxProps } from './checkbox.types';
6
6
 
7
7
  const CheckBox = ({
8
8
  label,
9
9
  value,
10
10
  disabled,
11
11
  primaryColor,
12
- checkboxSize,
13
- checkboxStyle,
14
- checkboxLabelStyle,
15
- checkboxComponentStyles,
16
- checkboxComponent,
17
12
  checkboxControls,
18
13
  onChange,
19
14
  }: CheckboxProps) => {
15
+ const {
16
+ checkboxSize,
17
+ checkboxComponent,
18
+ checkboxDisabledStyle,
19
+ checkboxStyle,
20
+ checkboxUnselectedColor,
21
+ checkboxLabelStyle,
22
+ } = checkboxControls ?? {};
23
+
20
24
  const fillColor = {
21
25
  backgroundColor: disabled
22
- ? checkboxControls?.checkboxDisabledStyle?.backgroundColor ||
23
- colors.disabled
26
+ ? checkboxDisabledStyle?.backgroundColor || colors.disabled
24
27
  : value
25
- ? checkboxControls?.checkboxStyle?.backgroundColor ||
26
- checkboxComponentStyles?.checkboxStyle?.backgroundColor ||
27
- checkboxStyle?.backgroundColor ||
28
- primaryColor
29
- : checkboxControls?.checkboxUnselectedColor || 'white',
28
+ ? checkboxStyle?.backgroundColor || primaryColor
29
+ : checkboxUnselectedColor || 'white',
30
30
  borderColor: disabled
31
- ? checkboxControls?.checkboxDisabledStyle?.borderColor || colors.disabled
32
- : checkboxControls?.checkboxStyle?.borderColor ||
33
- checkboxComponentStyles?.checkboxStyle?.borderColor ||
34
- checkboxStyle?.borderColor ||
35
- styles.checkbox.borderColor,
31
+ ? checkboxDisabledStyle?.borderColor || colors.disabled
32
+ : checkboxStyle?.borderColor || styles.checkbox.borderColor,
36
33
  };
37
-
34
+ label = typeof label === 'object' ? label : String(label);
38
35
  return (
39
36
  <Pressable
40
37
  onPress={onChange ? () => onChange(!value) : null}
41
38
  style={[styles.checkboxContainer]}
42
39
  disabled={disabled}
40
+ aria-label={typeof label === 'string' ? label : ''}
43
41
  >
44
42
  <View
45
- style={[
46
- styles.checkbox,
47
- checkboxControls?.checkboxStyle ||
48
- checkboxComponentStyles?.checkboxStyle ||
49
- checkboxStyle,
50
- fillColor,
51
- ]}
43
+ style={[styles.checkbox, checkboxStyle, fillColor]}
44
+ aria-checked={value}
52
45
  >
53
- {checkboxControls?.checkboxComponent || checkboxComponent || (
46
+ {checkboxComponent || (
54
47
  <Image
55
48
  source={require('../../asset/check.png')}
56
49
  style={[
57
50
  {
58
- height:
59
- checkboxControls?.checkboxSize ||
60
- checkboxComponentStyles?.checkboxSize ||
61
- checkboxSize ||
62
- CHECKBOX_SIZE,
63
- width:
64
- checkboxControls?.checkboxSize ||
65
- checkboxComponentStyles?.checkboxSize ||
66
- checkboxSize ||
67
- CHECKBOX_SIZE,
51
+ height: checkboxSize || CHECKBOX_SIZE,
52
+ width: checkboxSize || CHECKBOX_SIZE,
68
53
  },
69
54
  ]}
70
55
  />
71
56
  )}
72
57
  </View>
73
58
  {label && label !== '' && (
74
- <Text
75
- style={[
76
- checkboxControls?.checkboxLabelStyle ||
77
- checkboxComponentStyles?.checkboxLabelStyle ||
78
- checkboxLabelStyle,
79
- styles.labelStyle,
80
- ]}
81
- >
82
- {label}
83
- </Text>
59
+ <Text style={[checkboxLabelStyle, styles.labelStyle]}>{label}</Text>
84
60
  )}
85
61
  </Pressable>
86
62
  );