react-native-input-select 1.3.17 → 2.0.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.
- package/README.md +38 -36
- package/lib/commonjs/components/CheckBox/index.js +4 -2
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +11 -9
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +3 -2
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +13 -13
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/{Dropdown → List}/DropdownFlatList.js +7 -5
- package/lib/commonjs/components/List/DropdownFlatList.js.map +1 -0
- package/lib/commonjs/components/{Dropdown → List}/DropdownSectionList.js +6 -4
- package/lib/commonjs/components/List/DropdownSectionList.js.map +1 -0
- package/lib/commonjs/hooks/index.js +61 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/use-index-of-selected-item.js +49 -0
- package/lib/commonjs/hooks/use-index-of-selected-item.js.map +1 -0
- package/lib/commonjs/hooks/use-modal.js +40 -0
- package/lib/commonjs/hooks/use-modal.js.map +1 -0
- package/lib/commonjs/hooks/use-search.js +58 -0
- package/lib/commonjs/hooks/use-search.js.map +1 -0
- package/lib/commonjs/hooks/use-select-all.js +70 -0
- package/lib/commonjs/hooks/use-select-all.js.map +1 -0
- package/lib/commonjs/hooks/use-selection-handler.js +62 -0
- package/lib/commonjs/hooks/use-selection-handler.js.map +1 -0
- package/lib/commonjs/index.js +118 -226
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +40 -5
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +4 -2
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CustomModal/index.js +11 -8
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +3 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +13 -13
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/{Dropdown → List}/DropdownFlatList.js +7 -5
- package/lib/module/components/List/DropdownFlatList.js.map +1 -0
- package/lib/module/components/{Dropdown → List}/DropdownSectionList.js +6 -4
- package/lib/module/components/List/DropdownSectionList.js.map +1 -0
- package/lib/module/hooks/index.js +6 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/use-index-of-selected-item.js +42 -0
- package/lib/module/hooks/use-index-of-selected-item.js.map +1 -0
- package/lib/module/hooks/use-modal.js +33 -0
- package/lib/module/hooks/use-modal.js.map +1 -0
- package/lib/module/hooks/use-search.js +51 -0
- package/lib/module/hooks/use-search.js.map +1 -0
- package/lib/module/hooks/use-select-all.js +63 -0
- package/lib/module/hooks/use-select-all.js.map +1 -0
- package/lib/module/hooks/use-selection-handler.js +55 -0
- package/lib/module/hooks/use-selection-handler.js.map +1 -0
- package/lib/module/index.js +121 -228
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/index.js +36 -4
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts +4 -2
- package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts.map +1 -1
- package/lib/typescript/src/components/CheckBox/index.d.ts +1 -1
- package/lib/typescript/src/components/CheckBox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomModal/index.d.ts +4 -2
- package/lib/typescript/src/components/CustomModal/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
- package/lib/typescript/src/components/Input/index.d.ts +5 -1
- package/lib/typescript/src/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/{Dropdown → List}/DropdownFlatList.d.ts +1 -1
- package/lib/typescript/src/components/List/DropdownFlatList.d.ts.map +1 -0
- package/lib/typescript/src/components/List/DropdownSectionList.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +6 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts +23 -0
- package/lib/typescript/src/hooks/use-index-of-selected-item.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-modal.d.ts +15 -0
- package/lib/typescript/src/hooks/use-modal.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-search.d.ts +16 -0
- package/lib/typescript/src/hooks/use-search.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-select-all.d.ts +18 -0
- package/lib/typescript/src/hooks/use-select-all.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-selection-handler.d.ts +19 -0
- package/lib/typescript/src/hooks/use-selection-handler.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +19 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.types.d.ts +55 -38
- package/lib/typescript/src/types/index.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +17 -3
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/package.json +21 -7
- package/src/components/CheckBox/checkbox.types.ts +2 -2
- package/src/components/CheckBox/index.tsx +8 -6
- package/src/components/CustomModal/index.tsx +14 -17
- package/src/components/Dropdown/Dropdown.tsx +3 -2
- package/src/components/Dropdown/DropdownListItem.tsx +1 -3
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +12 -12
- package/src/components/Input/index.tsx +13 -2
- package/src/components/{Dropdown → List}/DropdownFlatList.tsx +11 -8
- package/src/components/{Dropdown → List}/DropdownSectionList.tsx +10 -7
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-index-of-selected-item.ts +49 -0
- package/src/hooks/use-modal.ts +44 -0
- package/src/hooks/use-search.ts +95 -0
- package/src/hooks/use-select-all.ts +79 -0
- package/src/hooks/use-selection-handler.ts +81 -0
- package/src/index.tsx +301 -443
- package/src/types/index.types.ts +69 -47
- package/src/utils/index.ts +60 -3
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +0 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts.map +0 -1
- /package/lib/typescript/src/components/{Dropdown → List}/DropdownSectionList.d.ts +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
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;
|
|
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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FlatListProps } from 'react-native';
|
|
3
|
-
import { TFlatList } from '
|
|
3
|
+
import { TFlatList } from '../../types/index.types';
|
|
4
4
|
declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, checkboxControls, listComponentStyles, listIndex, emptyListMessage, listEmptyComponent, ...rest }: any & FlatListProps<TFlatList>) => React.JSX.Element;
|
|
5
5
|
export default DropdownFlatList;
|
|
6
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,8VAsBnB,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,sBAuEhC,CAAC;AA2BF,eAAe,gBAAgB,CAAC"}
|
|
@@ -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,8VAsBtB,GAAG,sBA+GL,CAAC;AA+BF,eAAe,mBAAmB,CAAC"}
|
|
@@ -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,15 @@
|
|
|
1
|
+
import { ModalProps } from 'react-native';
|
|
2
|
+
import { TCustomModalControls } from '../types/index.types';
|
|
3
|
+
interface UseModalProps {
|
|
4
|
+
resetOptionsRelatedState: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
modalProps?: ModalProps;
|
|
7
|
+
modalControls?: TCustomModalControls;
|
|
8
|
+
}
|
|
9
|
+
export declare const useModal: ({ resetOptionsRelatedState, disabled, modalProps, modalControls, }: UseModalProps) => {
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
openModal: () => void;
|
|
12
|
+
closeModal: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# 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":"AACA,OAAO,EAAE,UAAU,EAAY,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,aAAa;IACrB,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,eAAO,MAAM,QAAQ,uEAKlB,aAAa;;;;CA2Bf,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 {
|
|
3
|
-
export declare const DropdownSelect: React.
|
|
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 & import("./types/index.types").TSearchProps & import("./types/index.types").TCheckboxProps & import("./types/index.types").TCustomModalProps & import("./types/index.types").TListProps & {
|
|
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
|
+
} & 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,
|
|
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;;;;;;;;;;;;;;;;;8CAoS1B,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 &
|
|
3
|
+
export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TSearchProps & TCheckboxProps & TCustomModalProps & TListProps & TControls;
|
|
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:
|
|
11
|
-
selectedValue
|
|
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,19 +31,26 @@ export type TDropdownInputProps = {
|
|
|
30
31
|
primaryColor?: ColorValue;
|
|
31
32
|
disabled?: boolean;
|
|
32
33
|
placeholderStyle?: TextStyle;
|
|
34
|
+
/** @deprecated Use useRef to access the open and close props.*/
|
|
33
35
|
hideModal?: boolean;
|
|
34
36
|
};
|
|
35
|
-
|
|
37
|
+
type TControls = {
|
|
38
|
+
searchControls?: TSearchControls;
|
|
39
|
+
checkboxControls?: TCheckboxControls;
|
|
40
|
+
modalControls?: TCustomModalControls;
|
|
41
|
+
listControls?: TListControls;
|
|
42
|
+
};
|
|
43
|
+
export type TSearchProps = {
|
|
36
44
|
/** @deprecated Use `searchControls = {{textInputStyle: ViewStyle | TextStyle }}` instead.*/
|
|
37
45
|
searchInputStyle?: ViewStyle;
|
|
38
|
-
searchControls?: {
|
|
39
|
-
textInputStyle?: ViewStyle | TextStyle;
|
|
40
|
-
textInputContainerStyle?: ViewStyle;
|
|
41
|
-
textInputProps?: TextInputProps;
|
|
42
|
-
searchCallback?: (value: string) => void;
|
|
43
|
-
};
|
|
44
46
|
};
|
|
45
|
-
|
|
47
|
+
type TSearchControls = {
|
|
48
|
+
textInputStyle?: ViewStyle | TextStyle;
|
|
49
|
+
textInputContainerStyle?: ViewStyle;
|
|
50
|
+
textInputProps?: TextInputProps;
|
|
51
|
+
searchCallback?: (value: string) => void;
|
|
52
|
+
};
|
|
53
|
+
export type TCheckboxProps = {
|
|
46
54
|
/** @deprecated Use `checkboxControls = {{checkboxSize: number }}` instead.*/
|
|
47
55
|
checkboxSize?: number;
|
|
48
56
|
/** @deprecated Use `checkboxControls = {{checkboxStyle: ViewStyle }}` instead.*/
|
|
@@ -57,32 +65,35 @@ export type TCheckboxControls = {
|
|
|
57
65
|
};
|
|
58
66
|
/** @deprecated Use `checkboxControls = {{checkboxComponent: <View></View> }}` instead.*/
|
|
59
67
|
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
|
-
};
|
|
68
68
|
};
|
|
69
|
-
export type
|
|
69
|
+
export type TCheckboxControls = {
|
|
70
|
+
checkboxSize?: number;
|
|
71
|
+
checkboxStyle?: ViewStyle;
|
|
72
|
+
checkboxLabelStyle?: TextStyle;
|
|
73
|
+
checkboxComponent?: React.ReactNode;
|
|
74
|
+
checkboxDisabledStyle?: ViewStyle;
|
|
75
|
+
checkboxUnselectedColor?: ColorValue;
|
|
76
|
+
};
|
|
77
|
+
export type TCustomModalProps = {
|
|
70
78
|
/** @deprecated Use `modalControls = {{modalBackgroundStyle: ViewStyle}} instead.*/
|
|
71
79
|
modalBackgroundStyle?: ViewStyle;
|
|
72
80
|
/** @deprecated Use `modalControls = {{ modalOptionsContainerStyle: ViewStyle}} instead.*/
|
|
73
81
|
modalOptionsContainerStyle?: ViewStyle;
|
|
74
82
|
/** @deprecated Use `modalControls = {{modalProps: ModalProps }}` instead.*/
|
|
75
|
-
modalProps?: ModalProps
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
modalOptionsContainerStyle?: ViewStyle;
|
|
79
|
-
modalProps?: ModalProps & TCloseModal;
|
|
83
|
+
modalProps?: ModalProps & {
|
|
84
|
+
/** @deprecated Use `onDismiss` instead.*/
|
|
85
|
+
closeModal?: () => void;
|
|
80
86
|
};
|
|
81
|
-
} & TCloseModal;
|
|
82
|
-
type TCloseModal = {
|
|
83
|
-
closeModal?: () => void;
|
|
84
87
|
};
|
|
85
|
-
export type
|
|
88
|
+
export type TCustomModalControls = {
|
|
89
|
+
modalBackgroundStyle?: ViewStyle;
|
|
90
|
+
modalOptionsContainerStyle?: ViewStyle;
|
|
91
|
+
modalProps?: ModalProps & {
|
|
92
|
+
/** @deprecated Use `onDismiss` instead.*/
|
|
93
|
+
closeModal?: () => void;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type TListProps = {
|
|
86
97
|
listHeaderComponent?: React.ReactNode;
|
|
87
98
|
listFooterComponent?: React.ReactNode;
|
|
88
99
|
listComponentStyles?: {
|
|
@@ -91,23 +102,29 @@ export type TListControls = {
|
|
|
91
102
|
sectionHeaderStyle?: TextStyle;
|
|
92
103
|
};
|
|
93
104
|
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
105
|
};
|
|
106
|
+
type TListControls = {
|
|
107
|
+
selectAllText?: string;
|
|
108
|
+
unselectAllText?: string;
|
|
109
|
+
selectAllCallback?: () => void;
|
|
110
|
+
unselectAllCallback?: () => void;
|
|
111
|
+
hideSelectAll?: boolean;
|
|
112
|
+
emptyListMessage?: string;
|
|
113
|
+
};
|
|
114
|
+
export type TSelectedItem = string | number | boolean;
|
|
115
|
+
export type TSelectedItemWithReactComponent = TSelectedItem | React.ReactElement;
|
|
103
116
|
export type TFlatList = TFlatListItem[];
|
|
104
117
|
export type TFlatListItem = {
|
|
105
|
-
[key: string]:
|
|
118
|
+
[key: string]: TSelectedItemWithReactComponent;
|
|
106
119
|
};
|
|
107
120
|
export type TSectionList = TSectionListItem[];
|
|
108
121
|
export type TSectionListItem = {
|
|
109
122
|
title: string;
|
|
110
123
|
data: TFlatList;
|
|
111
124
|
};
|
|
125
|
+
export interface DropdownSelectHandle {
|
|
126
|
+
open: () => void;
|
|
127
|
+
close: () => void;
|
|
128
|
+
}
|
|
112
129
|
export {};
|
|
113
130
|
//# 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,
|
|
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,YAAY,GACZ,cAAc,GACd,iBAAiB,GACjB,UAAU,GACV,SAAS,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC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,MAAM,aAAa,GAAG;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,+BAA+B,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAC;AAC9C,MAAM,MAAM,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
|
-
|
|
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[] | undefined;
|
|
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
|
|
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,oFAsBA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-input-select",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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": "^
|
|
72
|
-
"eslint-config-prettier": "^
|
|
73
|
-
"eslint-plugin-prettier": "^
|
|
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": "^
|
|
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 '
|
|
2
|
+
import { TCheckboxControls, TCheckboxProps } 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 } & TCheckboxProps;
|
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import { CheckboxProps } from './checkbox.types';
|
|
6
6
|
|
|
7
7
|
const CheckBox = ({
|
|
8
8
|
label,
|
|
@@ -22,11 +22,11 @@ const CheckBox = ({
|
|
|
22
22
|
? checkboxControls?.checkboxDisabledStyle?.backgroundColor ||
|
|
23
23
|
colors.disabled
|
|
24
24
|
: value
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
? checkboxControls?.checkboxStyle?.backgroundColor ||
|
|
26
|
+
checkboxComponentStyles?.checkboxStyle?.backgroundColor ||
|
|
27
|
+
checkboxStyle?.backgroundColor ||
|
|
28
|
+
primaryColor
|
|
29
|
+
: checkboxControls?.checkboxUnselectedColor || 'white',
|
|
30
30
|
borderColor: disabled
|
|
31
31
|
? checkboxControls?.checkboxDisabledStyle?.borderColor || colors.disabled
|
|
32
32
|
: checkboxControls?.checkboxStyle?.borderColor ||
|
|
@@ -40,6 +40,7 @@ const CheckBox = ({
|
|
|
40
40
|
onPress={onChange ? () => onChange(!value) : null}
|
|
41
41
|
style={[styles.checkboxContainer]}
|
|
42
42
|
disabled={disabled}
|
|
43
|
+
aria-label={typeof label === 'string' ? label : ''}
|
|
43
44
|
>
|
|
44
45
|
<View
|
|
45
46
|
style={[
|
|
@@ -49,6 +50,7 @@ const CheckBox = ({
|
|
|
49
50
|
checkboxStyle,
|
|
50
51
|
fillColor,
|
|
51
52
|
]}
|
|
53
|
+
aria-checked={value}
|
|
52
54
|
>
|
|
53
55
|
{checkboxControls?.checkboxComponent || checkboxComponent || (
|
|
54
56
|
<Image
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable react-native/no-inline-styles */
|
|
2
|
+
import React, { PropsWithChildren, ReactElement } from 'react';
|
|
2
3
|
import {
|
|
3
4
|
KeyboardAvoidingView,
|
|
4
5
|
Modal,
|
|
@@ -10,17 +11,11 @@ import {
|
|
|
10
11
|
TouchableWithoutFeedback,
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import { colors } from '../../styles/colors';
|
|
13
|
-
import { TCustomModalControls } from 'src/types/index.types';
|
|
14
|
-
|
|
15
|
-
type ScreenWrapperProps = {
|
|
16
|
-
children: React.ReactNode;
|
|
17
|
-
};
|
|
14
|
+
import { TCustomModalControls, TCustomModalProps } from 'src/types/index.types';
|
|
18
15
|
|
|
19
16
|
// In iOS, `SafeAreaView` does not automatically account on keyboard.
|
|
20
17
|
// Therefore, for iOS we need to wrap the content in `KeyboardAvoidingView`.
|
|
21
|
-
const ModalContentWrapper = ({
|
|
22
|
-
children,
|
|
23
|
-
}: ScreenWrapperProps): ReactElement => {
|
|
18
|
+
const ModalContentWrapper = ({ children }: PropsWithChildren): ReactElement => {
|
|
24
19
|
return Platform.OS === 'ios' ? (
|
|
25
20
|
<KeyboardAvoidingView style={[{ flex: 1 }]} behavior="padding">
|
|
26
21
|
{children}
|
|
@@ -32,18 +27,20 @@ const ModalContentWrapper = ({
|
|
|
32
27
|
|
|
33
28
|
const CustomModal = ({
|
|
34
29
|
visible,
|
|
35
|
-
closeModal,
|
|
36
30
|
modalBackgroundStyle, //kept for backwards compatibility
|
|
37
31
|
modalOptionsContainerStyle, //kept for backwards compatibility
|
|
38
32
|
modalControls,
|
|
39
33
|
modalProps, //kept for backwards compatibility
|
|
40
34
|
children,
|
|
41
|
-
|
|
35
|
+
onRequestClose,
|
|
36
|
+
}: TCustomModalProps & {
|
|
37
|
+
modalControls?: TCustomModalControls;
|
|
38
|
+
} & ModalProps) => {
|
|
42
39
|
return (
|
|
43
40
|
<Modal
|
|
44
|
-
transparent={true}
|
|
45
41
|
visible={visible}
|
|
46
|
-
|
|
42
|
+
testID="react-native-input-select-modal"
|
|
43
|
+
transparent={true}
|
|
47
44
|
animationType="fade"
|
|
48
45
|
{...modalControls?.modalProps}
|
|
49
46
|
{...modalProps} //kept for backwards compatibility
|
|
@@ -51,23 +48,23 @@ const CustomModal = ({
|
|
|
51
48
|
{/*Used to fix the select with search box behavior in iOS*/}
|
|
52
49
|
<ModalContentWrapper>
|
|
53
50
|
<TouchableOpacity
|
|
54
|
-
onPress={
|
|
55
|
-
closeModal?.() || modalControls?.modalProps?.closeModal?.()
|
|
56
|
-
}
|
|
51
|
+
onPress={onRequestClose}
|
|
57
52
|
style={[
|
|
58
53
|
styles.modalContainer,
|
|
59
54
|
styles.modalBackgroundStyle,
|
|
60
55
|
modalControls?.modalBackgroundStyle || modalBackgroundStyle,
|
|
61
56
|
]}
|
|
57
|
+
aria-label="close modal"
|
|
62
58
|
>
|
|
63
59
|
{/* Added this `TouchableWithoutFeedback` wrapper because of the closing modal on expo web */}
|
|
64
|
-
<TouchableWithoutFeedback
|
|
60
|
+
<TouchableWithoutFeedback accessible={false}>
|
|
65
61
|
<SafeAreaView
|
|
66
62
|
style={[
|
|
67
63
|
styles.modalOptionsContainer,
|
|
68
64
|
modalControls?.modalOptionsContainerStyle ||
|
|
69
65
|
modalOptionsContainerStyle,
|
|
70
66
|
]}
|
|
67
|
+
testID="react-native-input-select-modal-body"
|
|
71
68
|
>
|
|
72
69
|
{children}
|
|
73
70
|
</SafeAreaView>
|
|
@@ -10,7 +10,7 @@ const Dropdown = ({
|
|
|
10
10
|
placeholder,
|
|
11
11
|
helperText,
|
|
12
12
|
error,
|
|
13
|
-
|
|
13
|
+
labelsOfSelectedItems,
|
|
14
14
|
openModal,
|
|
15
15
|
closeModal,
|
|
16
16
|
isMultiple,
|
|
@@ -35,6 +35,7 @@ const Dropdown = ({
|
|
|
35
35
|
<View
|
|
36
36
|
style={[styles.dropdownInputContainer, dropdownContainerStyle]}
|
|
37
37
|
accessibilityRole="combobox"
|
|
38
|
+
pointerEvents="box-none"
|
|
38
39
|
testID={testID}
|
|
39
40
|
>
|
|
40
41
|
{label && label !== '' && (
|
|
@@ -44,7 +45,7 @@ const Dropdown = ({
|
|
|
44
45
|
<DropdownSelectedItemsView
|
|
45
46
|
placeholder={placeholder}
|
|
46
47
|
error={error}
|
|
47
|
-
|
|
48
|
+
labelsOfSelectedItems={labelsOfSelectedItems}
|
|
48
49
|
openModal={openModal}
|
|
49
50
|
closeModal={closeModal}
|
|
50
51
|
isMultiple={isMultiple}
|
|
@@ -20,9 +20,7 @@ const DropdownListItem = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<TouchableOpacity
|
|
22
22
|
style={styles.listItemContainerStyle}
|
|
23
|
-
onPress={
|
|
24
|
-
item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property
|
|
25
|
-
}
|
|
23
|
+
onPress={item.disabled ? () => {} : () => onChange(item[optionValue])}
|
|
26
24
|
>
|
|
27
25
|
<CheckBox
|
|
28
26
|
value={
|