react-native-input-select 1.3.6 → 1.3.8
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/lib/commonjs/components/CheckBox/checkbox.types.js.map +1 -1
- package/lib/commonjs/components/CheckBox/index.js +22 -25
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CustomModal/index.js +23 -26
- package/lib/commonjs/components/CustomModal/index.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +30 -30
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js +39 -44
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +22 -24
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js +47 -54
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +48 -57
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/components/Input/index.js +13 -15
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/Others/index.js +18 -22
- package/lib/commonjs/components/Others/index.js.map +1 -1
- package/lib/commonjs/constants/index.js +3 -6
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/index.js +106 -91
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/colors.js +1 -2
- package/lib/commonjs/styles/colors.js.map +1 -1
- package/lib/commonjs/styles/input.js +1 -2
- package/lib/commonjs/styles/input.js.map +1 -1
- package/lib/commonjs/styles/typography.js +1 -2
- package/lib/commonjs/styles/typography.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/CheckBox/checkbox.types.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +20 -22
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CustomModal/index.js +21 -23
- package/lib/module/components/CustomModal/index.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +28 -27
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js +35 -39
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +18 -19
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js +43 -49
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +46 -54
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/components/Input/index.js +10 -11
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/Others/index.js +17 -21
- package/lib/module/components/Others/index.js.map +1 -1
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/index.js +104 -88
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/colors.js.map +1 -1
- package/lib/module/styles/input.js.map +1 -1
- package/lib/module/styles/typography.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/jest-setup.d.ts +2 -0
- package/lib/typescript/jest-setup.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/CheckBox/checkbox.types.d.ts +1 -0
- package/lib/typescript/src/components/CheckBox/checkbox.types.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/CheckBox/index.d.ts +3 -2
- package/lib/typescript/src/components/CheckBox/index.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomModal/index.d.ts +6 -0
- package/lib/typescript/src/components/CustomModal/index.d.ts.map +1 -0
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +4 -0
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/Dropdown/DropdownFlatList.d.ts +3 -2
- package/lib/typescript/src/components/Dropdown/DropdownFlatList.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/Dropdown/DropdownListItem.d.ts +2 -1
- package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/Dropdown/DropdownSectionList.d.ts +3 -2
- package/lib/typescript/src/components/Dropdown/DropdownSectionList.d.ts.map +1 -0
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts +4 -0
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/Input/index.d.ts +3 -2
- package/lib/typescript/src/components/Input/index.d.ts.map +1 -0
- package/lib/typescript/{components → src/components}/Others/index.d.ts +8 -7
- package/lib/typescript/src/components/Others/index.d.ts.map +1 -0
- package/lib/typescript/{constants → src/constants}/index.d.ts +1 -0
- package/lib/typescript/src/constants/index.d.ts.map +1 -0
- package/lib/typescript/{index.d.ts → src/index.d.ts} +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/styles/colors.d.ts +2 -0
- package/lib/typescript/src/styles/colors.d.ts.map +1 -0
- package/lib/typescript/{styles → src/styles}/input.d.ts +1 -0
- package/lib/typescript/src/styles/input.d.ts.map +1 -0
- package/lib/typescript/src/styles/typography.d.ts +2 -0
- package/lib/typescript/src/styles/typography.d.ts.map +1 -0
- package/lib/typescript/{types → src/types}/index.types.d.ts +6 -2
- package/lib/typescript/src/types/index.types.d.ts.map +1 -0
- package/lib/typescript/{utils → src/utils}/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +28 -21
- package/src/components/CustomModal/index.tsx +5 -3
- package/src/components/Dropdown/Dropdown.tsx +4 -2
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +5 -5
- package/src/index.tsx +37 -7
- package/src/types/index.types.ts +4 -2
- package/lib/typescript/components/CustomModal/index.d.ts +0 -5
- package/lib/typescript/components/Dropdown/Dropdown.d.ts +0 -3
- package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +0 -3
- package/lib/typescript/styles/colors.d.ts +0 -1
- package/lib/typescript/styles/typography.d.ts +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
export declare const ListEmptyComponent: ({ listEmptyComponentStyle, emptyListMessage, }: any) => JSX.Element;
|
|
3
|
+
export declare const ListEmptyComponent: ({ listEmptyComponentStyle, emptyListMessage, }: any) => React.JSX.Element;
|
|
4
4
|
export declare const ItemSeparatorComponent: ({ itemSeparatorStyle, }: {
|
|
5
5
|
itemSeparatorStyle: ViewStyle;
|
|
6
|
-
}) => JSX.Element;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
7
|
export declare const ListItemContainer: ({ children, listItemContainerStyle, }: {
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
listItemContainerStyle: ViewStyle;
|
|
10
|
-
}) => JSX.Element;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
11
|
export declare const SectionHeaderTitle: ({ title, sectionHeaderStyle, onPress, isExpanded, }: {
|
|
12
12
|
title: string;
|
|
13
|
-
sectionHeaderStyle?: TextStyle
|
|
14
|
-
onPress?: (
|
|
13
|
+
sectionHeaderStyle?: TextStyle;
|
|
14
|
+
onPress?: () => void;
|
|
15
15
|
isExpanded: Boolean;
|
|
16
|
-
}) => JSX.Element;
|
|
16
|
+
}) => React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Others/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAKL,SAAS,EAET,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,kBAAkB,mDAG5B,GAAG,sBAQL,CAAC;AAEF,eAAO,MAAM,sBAAsB,4BAEhC;IACD,kBAAkB,EAAE,SAAS,CAAC;CAC/B,sBAEA,CAAC;AAEF,eAAO,MAAM,iBAAiB,0CAG3B;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,sBAAsB,EAAE,SAAS,CAAC;CACnC,sBAMA,CAAC;AAEF,eAAO,MAAM,kBAAkB,wDAK5B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;CACrB,sBAaA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAC5C,eAAO,MAAM,aAAa,KAAK,CAAC"}
|
|
@@ -0,0 +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,EAKd,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAsblD,CAAC;AAUF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../src/styles/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE,GASpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/styles/input.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,EAAE,GAsBxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../src/styles/typography.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,EAAE,GAOvB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ViewStyle, ColorValue, TextStyle, ModalProps, TextInputProps } from 'react-native';
|
|
3
2
|
export type DropdownProps = CommonDropdownProps & TDropdownInputProps & TSearchControls & TCheckboxControls & TCustomModalControls & TListControls;
|
|
4
3
|
export type CommonDropdownProps = {
|
|
@@ -71,8 +70,11 @@ export type TCustomModalControls = {
|
|
|
71
70
|
modalControls?: {
|
|
72
71
|
modalBackgroundStyle?: ViewStyle;
|
|
73
72
|
modalOptionsContainerStyle?: ViewStyle;
|
|
74
|
-
modalProps?: ModalProps;
|
|
73
|
+
modalProps?: ModalProps & TCloseModal;
|
|
75
74
|
};
|
|
75
|
+
} & TCloseModal;
|
|
76
|
+
type TCloseModal = {
|
|
77
|
+
closeModal?: () => void;
|
|
76
78
|
};
|
|
77
79
|
export type TListControls = {
|
|
78
80
|
listHeaderComponent?: React.ReactNode;
|
|
@@ -100,3 +102,5 @@ export type TSectionListItem = {
|
|
|
100
102
|
title: string;
|
|
101
103
|
data: TFlatList;
|
|
102
104
|
};
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=index.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../../../../src/types/index.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT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AAO,MAAM,YAAY,SAAU,MAAM,WAExC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-input-select",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
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",
|
|
7
|
-
"types": "lib/typescript/index.d.ts",
|
|
7
|
+
"types": "lib/typescript/src/types/index.types.d.ts",
|
|
8
8
|
"react-native": "src/index",
|
|
9
9
|
"source": "src/index",
|
|
10
10
|
"files": [
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"android": "yarn example android",
|
|
35
35
|
"ios": "yarn example ios",
|
|
36
36
|
"clean": "yarn example clean",
|
|
37
|
+
"troubleshoot": "react-native doctor",
|
|
37
38
|
"watchman:clear": "watchman watch-del-all"
|
|
38
39
|
},
|
|
39
40
|
"keywords": [
|
|
@@ -55,25 +56,31 @@
|
|
|
55
56
|
"registry": "https://registry.npmjs.org/"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"prettier": "^
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"react-native-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
59
|
+
"@babel/plugin-transform-private-methods": "^7.24.7",
|
|
60
|
+
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
|
|
61
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
62
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
63
|
+
"@react-native-community/eslint-config": "^3.2.0",
|
|
64
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
|
65
|
+
"@testing-library/react-native": "^12.5.1",
|
|
66
|
+
"@types/jest": "^29.5.12",
|
|
67
|
+
"@types/react": "18.3.2",
|
|
68
|
+
"@types/react-native": "^0.73.0",
|
|
69
|
+
"commitlint": "^19.3.0",
|
|
70
|
+
"eslint": "^9.2.0",
|
|
71
|
+
"eslint-config-prettier": "^9.1.0",
|
|
72
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
73
|
+
"husky": "^9.0.11",
|
|
74
|
+
"jest": "^29.7.0",
|
|
75
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
76
|
+
"pod-install": "^0.2.2",
|
|
77
|
+
"prettier": "^3.2.5",
|
|
78
|
+
"react": "^18.3.1",
|
|
79
|
+
"react-native": "^0.74.1",
|
|
80
|
+
"react-native-builder-bob": "^0.23.2",
|
|
81
|
+
"react-test-renderer": "^18.3.1",
|
|
82
|
+
"release-it": "^17.2.1",
|
|
83
|
+
"typescript": "^5.4.5"
|
|
77
84
|
},
|
|
78
85
|
"peerDependencies": {
|
|
79
86
|
"react": "*",
|
|
@@ -32,7 +32,7 @@ const ModalContentWrapper = ({
|
|
|
32
32
|
|
|
33
33
|
const CustomModal = ({
|
|
34
34
|
visible,
|
|
35
|
-
|
|
35
|
+
closeModal,
|
|
36
36
|
modalBackgroundStyle, //kept for backwards compatibility
|
|
37
37
|
modalOptionsContainerStyle, //kept for backwards compatibility
|
|
38
38
|
modalControls,
|
|
@@ -43,7 +43,7 @@ const CustomModal = ({
|
|
|
43
43
|
<Modal
|
|
44
44
|
transparent={true}
|
|
45
45
|
visible={visible}
|
|
46
|
-
onRequestClose={() =>
|
|
46
|
+
onRequestClose={() => closeModal?.()}
|
|
47
47
|
animationType="fade"
|
|
48
48
|
{...modalControls?.modalProps}
|
|
49
49
|
{...modalProps} //kept for backwards compatibility
|
|
@@ -51,7 +51,9 @@ const CustomModal = ({
|
|
|
51
51
|
{/*Used to fix the select with search box behavior in iOS*/}
|
|
52
52
|
<ModalContentWrapper>
|
|
53
53
|
<TouchableOpacity
|
|
54
|
-
onPress={() =>
|
|
54
|
+
onPress={() =>
|
|
55
|
+
closeModal?.() || modalControls?.modalProps?.closeModal?.()
|
|
56
|
+
}
|
|
55
57
|
style={[
|
|
56
58
|
styles.modalContainer,
|
|
57
59
|
styles.modalBackgroundStyle,
|
|
@@ -10,7 +10,8 @@ const Dropdown = ({
|
|
|
10
10
|
helperText,
|
|
11
11
|
error,
|
|
12
12
|
getSelectedItemsLabel,
|
|
13
|
-
|
|
13
|
+
openModal,
|
|
14
|
+
closeModal,
|
|
14
15
|
isMultiple,
|
|
15
16
|
selectedItem,
|
|
16
17
|
selectedItems,
|
|
@@ -39,7 +40,8 @@ const Dropdown = ({
|
|
|
39
40
|
placeholder={placeholder}
|
|
40
41
|
error={error}
|
|
41
42
|
getSelectedItemsLabel={getSelectedItemsLabel}
|
|
42
|
-
|
|
43
|
+
openModal={openModal}
|
|
44
|
+
closeModal={closeModal}
|
|
43
45
|
isMultiple={isMultiple}
|
|
44
46
|
selectedItem={selectedItem}
|
|
45
47
|
selectedItems={selectedItems}
|
|
@@ -15,7 +15,7 @@ const DropdownSelectedItemsView = ({
|
|
|
15
15
|
placeholder,
|
|
16
16
|
error,
|
|
17
17
|
getSelectedItemsLabel,
|
|
18
|
-
|
|
18
|
+
openModal,
|
|
19
19
|
isMultiple,
|
|
20
20
|
selectedItem,
|
|
21
21
|
selectedItems,
|
|
@@ -32,7 +32,7 @@ const DropdownSelectedItemsView = ({
|
|
|
32
32
|
}: any) => {
|
|
33
33
|
return (
|
|
34
34
|
<Pressable
|
|
35
|
-
onPress={() =>
|
|
35
|
+
onPress={() => openModal()}
|
|
36
36
|
style={({ pressed }) => [
|
|
37
37
|
pressed && {
|
|
38
38
|
...inputStyles.inputFocusState,
|
|
@@ -61,7 +61,7 @@ const DropdownSelectedItemsView = ({
|
|
|
61
61
|
getSelectedItemsLabel()?.map((label: string, i: Number) => (
|
|
62
62
|
<DropdownContent
|
|
63
63
|
onPress={() => {
|
|
64
|
-
|
|
64
|
+
openModal();
|
|
65
65
|
setIndexOfSelectedItem(label); // immediately scrolls to list item with the specified label when modal
|
|
66
66
|
}}
|
|
67
67
|
key={`react-native-input-select-${Math.random()}-${i}`}
|
|
@@ -77,7 +77,7 @@ const DropdownSelectedItemsView = ({
|
|
|
77
77
|
) : (
|
|
78
78
|
<DropdownContent
|
|
79
79
|
onPress={() => {
|
|
80
|
-
|
|
80
|
+
openModal();
|
|
81
81
|
setIndexOfSelectedItem(getSelectedItemsLabel()); // immediately scrolls to list item with the specified label when modal
|
|
82
82
|
}}
|
|
83
83
|
style={[styles.blackText, selectedItemStyle]}
|
|
@@ -87,7 +87,7 @@ const DropdownSelectedItemsView = ({
|
|
|
87
87
|
)}
|
|
88
88
|
{!selectedItem && selectedItems?.length === 0 && (
|
|
89
89
|
<DropdownContent
|
|
90
|
-
onPress={() =>
|
|
90
|
+
onPress={() => openModal()}
|
|
91
91
|
style={[styles.blackText, placeholderStyle]}
|
|
92
92
|
label={placeholder ?? 'Select an option'}
|
|
93
93
|
disabled={disabled}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { TouchableOpacity, StyleSheet, View } from 'react-native';
|
|
1
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
+
import { TouchableOpacity, StyleSheet, View, Platform } from 'react-native';
|
|
3
3
|
import Input from './components/Input';
|
|
4
4
|
import CheckBox from './components/CheckBox';
|
|
5
5
|
import Dropdown from './components/Dropdown/Dropdown';
|
|
@@ -274,15 +274,44 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
|
|
|
274
274
|
return searchResults;
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* To prevent triggering on modalProps.onDismiss on first render, we perform this check
|
|
279
|
+
*/
|
|
280
|
+
const hasComponentBeenRendered = useRef(false);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Explicitly adding this here because the onDismiss only works on iOS Modals
|
|
284
|
+
* https://reactnative.dev/docs/modal#ondismiss-ios
|
|
285
|
+
*/
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
if (
|
|
288
|
+
hasComponentBeenRendered.current &&
|
|
289
|
+
!open &&
|
|
290
|
+
Platform.OS === 'android'
|
|
291
|
+
) {
|
|
292
|
+
modalControls?.modalProps?.onDismiss?.();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
hasComponentBeenRendered.current = true;
|
|
296
|
+
}, [open]);
|
|
297
|
+
|
|
277
298
|
/*===========================================
|
|
278
299
|
* Modal
|
|
279
300
|
*==========================================*/
|
|
280
|
-
const
|
|
301
|
+
const openModal = () => {
|
|
281
302
|
if (disabled) {
|
|
282
|
-
// protecting any toggleModal invocation when Dropdown is disabled by not activating state
|
|
283
303
|
return;
|
|
284
304
|
}
|
|
285
|
-
setOpen(
|
|
305
|
+
setOpen(true);
|
|
306
|
+
resetComponent();
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const closeModal = () => {
|
|
310
|
+
setOpen(false);
|
|
311
|
+
resetComponent();
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const resetComponent = () => {
|
|
286
315
|
setSearchValue('');
|
|
287
316
|
setNewOptions(options);
|
|
288
317
|
setListIndex({ itemIndex: -1, sectionIndex: -1 });
|
|
@@ -330,7 +359,8 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
|
|
|
330
359
|
getSelectedItemsLabel={getSelectedItemsLabel}
|
|
331
360
|
selectedItem={selectedItem}
|
|
332
361
|
selectedItems={selectedItems}
|
|
333
|
-
|
|
362
|
+
openModal={openModal}
|
|
363
|
+
closeModal={closeModal}
|
|
334
364
|
labelStyle={labelStyle}
|
|
335
365
|
dropdownIcon={dropdownIcon}
|
|
336
366
|
dropdownStyle={dropdownStyle}
|
|
@@ -352,7 +382,7 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
|
|
|
352
382
|
visible={open}
|
|
353
383
|
modalBackgroundStyle={modalBackgroundStyle} // kept for backwards compatibility
|
|
354
384
|
modalOptionsContainerStyle={modalOptionsContainerStyle} // kept for backwards compatibility
|
|
355
|
-
|
|
385
|
+
closeModal={closeModal}
|
|
356
386
|
modalControls={modalControls}
|
|
357
387
|
modalProps={modalProps} // kept for backwards compatibility
|
|
358
388
|
>
|
package/src/types/index.types.ts
CHANGED
|
@@ -93,9 +93,11 @@ export type TCustomModalControls = {
|
|
|
93
93
|
modalControls?: {
|
|
94
94
|
modalBackgroundStyle?: ViewStyle;
|
|
95
95
|
modalOptionsContainerStyle?: ViewStyle;
|
|
96
|
-
modalProps?: ModalProps;
|
|
96
|
+
modalProps?: ModalProps & TCloseModal;
|
|
97
97
|
};
|
|
98
|
-
};
|
|
98
|
+
} & TCloseModal;
|
|
99
|
+
|
|
100
|
+
type TCloseModal = { closeModal?: () => void };
|
|
99
101
|
|
|
100
102
|
export type TListControls = {
|
|
101
103
|
listHeaderComponent?: React.ReactNode;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ModalProps } from 'react-native';
|
|
3
|
-
import { TCustomModalControls } from 'src/types/index.types';
|
|
4
|
-
declare const CustomModal: ({ visible, onRequestClose, modalBackgroundStyle, modalOptionsContainerStyle, modalControls, modalProps, children, }: TCustomModalControls & ModalProps) => JSX.Element;
|
|
5
|
-
export default CustomModal;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const Dropdown: ({ label, placeholder, helperText, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, dropdownIcon, labelStyle, dropdownStyle, dropdownIconStyle, dropdownContainerStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, dropdownErrorTextStyle, dropdownHelperTextStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => JSX.Element;
|
|
3
|
-
export default Dropdown;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const DropdownSelectedItemsView: ({ placeholder, error, getSelectedItemsLabel, handleToggleModal, isMultiple, selectedItem, selectedItems, dropdownIcon, dropdownStyle, dropdownIconStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => JSX.Element;
|
|
3
|
-
export default DropdownSelectedItemsView;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const colors: any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const typography: any;
|