react-native-input-select 1.1.1 → 1.1.3
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 +18 -0
- package/lib/commonjs/components/CheckBox/index.js +20 -9
- package/lib/commonjs/components/CheckBox/index.js.map +1 -1
- package/lib/commonjs/components/CheckBox/types.js.map +1 -1
- package/lib/commonjs/components/Dropdown/Dropdown.js +4 -2
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js +34 -6
- package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownListItem.js +4 -2
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js +29 -2
- package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +41 -9
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/commonjs/index.js +64 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/index.types.js.map +1 -1
- package/lib/module/components/CheckBox/index.js +20 -8
- package/lib/module/components/CheckBox/index.js.map +1 -1
- package/lib/module/components/CheckBox/types.js.map +1 -1
- package/lib/module/components/Dropdown/Dropdown.js +4 -2
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownFlatList.js +32 -6
- package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownListItem.js +4 -2
- package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSectionList.js +30 -3
- package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +42 -10
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
- package/lib/module/index.js +65 -17
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.types.js.map +1 -1
- package/lib/typescript/components/CheckBox/index.d.ts +17 -5
- package/lib/typescript/components/CheckBox/types.d.ts +2 -0
- package/lib/typescript/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownFlatList.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownListItem.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSectionList.d.ts +1 -1
- package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
- package/lib/typescript/types/index.types.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/CheckBox/index.tsx +42 -22
- package/src/components/CheckBox/types.ts +2 -0
- package/src/components/Dropdown/Dropdown.tsx +3 -0
- package/src/components/Dropdown/DropdownFlatList.tsx +27 -1
- package/src/components/Dropdown/DropdownListItem.tsx +2 -0
- package/src/components/Dropdown/DropdownSectionList.tsx +30 -1
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +32 -13
- package/src/index.tsx +64 -18
- package/src/types/index.types.ts +1 -0
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
[](https://nodei.co/npm/react-native-input-select/)
|
|
2
|
+
|
|
1
3
|
[](https://github.com/azeezat/react-native-select/actions/workflows/codeql.yml) [](https://github.com/azeezat/react-native-select/actions/workflows/release-and-publish-to-npm.yml)
|
|
4
|
+
|
|
2
5
|
# react-native-input-select
|
|
3
6
|
|
|
4
7
|
A fully customizable dropdown selection package for react-native android and iOS with multiple select and search capabilities.
|
|
@@ -17,6 +20,9 @@ With yarn
|
|
|
17
20
|
yarn add react-native-input-select
|
|
18
21
|
```
|
|
19
22
|
|
|
23
|
+
## Sandbox
|
|
24
|
+
[Sandbox](https://azeezat.github.io/react-native-select/)
|
|
25
|
+
|
|
20
26
|
## Basic Usage
|
|
21
27
|
|
|
22
28
|
```js
|
|
@@ -93,6 +99,7 @@ export default function App() {
|
|
|
93
99
|
backgroundColor: 'rgba(196, 198, 246, 0.5)',
|
|
94
100
|
}}
|
|
95
101
|
helperText="The placeholder has been styled"
|
|
102
|
+
checkboxComponent={<View style={styles.radioButton} />}
|
|
96
103
|
checkboxComponentStyles={{
|
|
97
104
|
checkboxSize: 20,
|
|
98
105
|
checkboxStyle: {
|
|
@@ -156,6 +163,13 @@ const styles = StyleSheet.create({
|
|
|
156
163
|
width: 20,
|
|
157
164
|
height: 20,
|
|
158
165
|
},
|
|
166
|
+
radioButton: {
|
|
167
|
+
width: 20,
|
|
168
|
+
height: 20,
|
|
169
|
+
borderRadius: 20 / 2,
|
|
170
|
+
borderWidth: 3,
|
|
171
|
+
borderColor: 'white',
|
|
172
|
+
},
|
|
159
173
|
});
|
|
160
174
|
```
|
|
161
175
|
|
|
@@ -258,6 +272,10 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
|
|
|
258
272
|
| hideModal | `Boolean` | Use this to hide the modal as needed |
|
|
259
273
|
| listComponentStyles | `Object` | `{listEmptyComponentStyle: ViewStyle, itemSeparatorStyle: ViewStyle, sectionHeaderStyle: TextStyle}` |
|
|
260
274
|
| checkboxComponentStyles | `Object` | `{checkboxSize?: number, checkboxStyle?: ViewStyle, checkboxLabelStyle: TextStyle}` |
|
|
275
|
+
| checkboxComponent | `React Component` | `<View style={styles.radioButton} />` |
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
261
279
|
|
|
262
280
|
|
|
263
281
|
## Deprecation Notice
|
|
@@ -9,13 +9,23 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _colors = require("../../styles/colors");
|
|
10
10
|
var _constants = require("../../constants");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
/* eslint-disable react-native/no-inline-styles */
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
* Individual props `checkboxSize`, `checkboxStyle`, `checkboxLabelStyle` would be replaced in future releases
|
|
14
|
+
* and replaced with a single object `checkboxComponentStyles` e.g
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
const checkboxComponentStyles = {
|
|
18
|
+
checkboxSize: 20,
|
|
19
|
+
checkboxStyle: {
|
|
20
|
+
backgroundColor: 'purple',
|
|
21
|
+
borderRadius: 30,
|
|
22
|
+
padding: 10,
|
|
23
|
+
borderColor: 'red',
|
|
24
|
+
},
|
|
25
|
+
checkboxLabelStyle: { color: 'red', fontSize: 20 },
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
19
29
|
|
|
20
30
|
const CheckBox = _ref => {
|
|
21
31
|
var _checkboxComponentSty, _checkboxComponentSty2;
|
|
@@ -28,10 +38,11 @@ const CheckBox = _ref => {
|
|
|
28
38
|
checkboxStyle,
|
|
29
39
|
checkboxLabelStyle,
|
|
30
40
|
checkboxComponentStyles,
|
|
41
|
+
checkboxComponent,
|
|
31
42
|
onChange
|
|
32
43
|
} = _ref;
|
|
33
44
|
// const { checkboxSize, checkboxStyle, checkboxLabelStyle } =
|
|
34
|
-
// checkboxComponentStyles;
|
|
45
|
+
// checkboxComponentStyles || undefined;
|
|
35
46
|
const fillColor = {
|
|
36
47
|
backgroundColor: disabled ? '#d3d3d3' : value ? (checkboxComponentStyles === null || checkboxComponentStyles === void 0 || (_checkboxComponentSty = checkboxComponentStyles.checkboxStyle) === null || _checkboxComponentSty === void 0 ? void 0 : _checkboxComponentSty.backgroundColor) || (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.backgroundColor) || primaryColor || 'green' : 'white',
|
|
37
48
|
borderColor: disabled ? _colors.colors.disabled : (checkboxComponentStyles === null || checkboxComponentStyles === void 0 || (_checkboxComponentSty2 = checkboxComponentStyles.checkboxStyle) === null || _checkboxComponentSty2 === void 0 ? void 0 : _checkboxComponentSty2.borderColor) || (checkboxStyle === null || checkboxStyle === void 0 ? void 0 : checkboxStyle.borderColor) || styles.checkbox.borderColor
|
|
@@ -41,8 +52,8 @@ const CheckBox = _ref => {
|
|
|
41
52
|
style: [styles.checkboxContainer],
|
|
42
53
|
disabled: disabled
|
|
43
54
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
44
|
-
style: [styles.checkbox, checkboxStyle, fillColor]
|
|
45
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
55
|
+
style: [styles.checkbox, (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle, fillColor]
|
|
56
|
+
}, checkboxComponent || /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
46
57
|
source: require('../../asset/check.png'),
|
|
47
58
|
style: [{
|
|
48
59
|
height: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize || _constants.CHECKBOX_SIZE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_constants","obj","__esModule","default","CheckBox","_ref","_checkboxComponentSty","_checkboxComponentSty2","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","onChange","fillColor","backgroundColor","borderColor","colors","styles","checkbox","createElement","Pressable","onPress","style","checkboxContainer","View","Image","source","height","CHECKBOX_SIZE","width","Text","labelStyle","StyleSheet","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft","_default","exports"],"sources":["index.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_constants","obj","__esModule","default","CheckBox","_ref","_checkboxComponentSty","_checkboxComponentSty2","label","value","disabled","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","onChange","fillColor","backgroundColor","borderColor","colors","styles","checkbox","createElement","Pressable","onPress","style","checkboxContainer","View","Image","source","height","CHECKBOX_SIZE","width","Text","labelStyle","StyleSheet","create","flexDirection","flexWrap","alignItems","padding","borderWidth","borderStyle","borderRadius","marginLeft","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport { Pressable, Text, StyleSheet, Image, View } from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { CHECKBOX_SIZE } from '../../constants';\nimport type { CheckboxProps } from './types';\n\n/**\n * Individual props `checkboxSize`, `checkboxStyle`, `checkboxLabelStyle` would be replaced in future releases\n * and replaced with a single object `checkboxComponentStyles` e.g\n\n```js\nconst checkboxComponentStyles = {\n checkboxSize: 20,\n checkboxStyle: {\n backgroundColor: 'purple',\n borderRadius: 30,\n padding: 10,\n borderColor: 'red',\n },\n checkboxLabelStyle: { color: 'red', fontSize: 20 },\n};\n```\n */\n\nconst CheckBox = ({\n label,\n value,\n disabled,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n onChange,\n}: CheckboxProps) => {\n // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =\n // checkboxComponentStyles || undefined;\n const fillColor = {\n backgroundColor: disabled\n ? '#d3d3d3'\n : value\n ? checkboxComponentStyles?.checkboxStyle?.backgroundColor ||\n checkboxStyle?.backgroundColor ||\n primaryColor ||\n 'green'\n : 'white',\n borderColor: disabled\n ? colors.disabled\n : checkboxComponentStyles?.checkboxStyle?.borderColor ||\n checkboxStyle?.borderColor ||\n styles.checkbox.borderColor,\n };\n\n return (\n <Pressable\n onPress={onChange ? () => onChange(!value) : null}\n style={[styles.checkboxContainer]}\n disabled={disabled}\n >\n <View\n style={[\n styles.checkbox,\n checkboxComponentStyles?.checkboxStyle || checkboxStyle,\n fillColor,\n ]}\n >\n {checkboxComponent || (\n <Image\n source={require('../../asset/check.png')}\n style={[\n {\n height:\n checkboxComponentStyles?.checkboxSize ||\n checkboxSize ||\n CHECKBOX_SIZE,\n width:\n checkboxComponentStyles?.checkboxSize ||\n checkboxSize ||\n CHECKBOX_SIZE,\n },\n ]}\n />\n )}\n </View>\n {label && (\n <Text\n style={[\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle,\n styles.labelStyle,\n ]}\n >\n {label}\n </Text>\n )}\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n checkboxContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n checkbox: {\n padding: 4,\n borderWidth: 1,\n borderStyle: 'solid',\n borderRadius: 4,\n borderColor: 'black',\n },\n labelStyle: { marginLeft: 10 },\n});\n\nexport default CheckBox;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAgD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMG,QAAQ,GAAGC,IAAA,IAWI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAXH;IAChBC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC,iBAAiB;IACjBC;EACa,CAAC,GAAAZ,IAAA;EACd;EACA;EACA,MAAMa,SAAS,GAAG;IAChBC,eAAe,EAAET,QAAQ,GACrB,SAAS,GACTD,KAAK,GACL,CAAAM,uBAAuB,aAAvBA,uBAAuB,gBAAAT,qBAAA,GAAvBS,uBAAuB,CAAEF,aAAa,cAAAP,qBAAA,uBAAtCA,qBAAA,CAAwCa,eAAe,MACvDN,aAAa,aAAbA,aAAa,uBAA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CAAAQ,OAAA,CAAAqB,aAAA,CAAC1B,YAAA,CAAAqC,IAAI;IACHR,KAAK,EAAE,CACL,CAAAZ,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAED,kBAAkB,KAAIA,kBAAkB,EACjEQ,MAAM,CAACc,UAAU;EACjB,GAED5B,KACG,CAEC,CAAC;AAEhB,CAAC;AAED,MAAMc,MAAM,GAAGe,uBAAU,CAACC,MAAM,CAAC;EAC/BV,iBAAiB,EAAE;IACjBW,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDlB,QAAQ,EAAE;IACRmB,OAAO,EAAE,CAAC;IACVC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,OAAO;IACpBC,YAAY,EAAE,CAAC;IACfzB,WAAW,EAAE;EACf,CAAC;EACDgB,UAAU,EAAE;IAAEU,UAAU,EAAE;EAAG;AAC/B,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY3C,QAAQ;AAAA4C,OAAA,CAAA7C,OAAA,GAAA4C,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n disabled?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React from 'react';\nimport type { ColorValue, ViewStyle, TextStyle } from 'react-native';\n\nexport type CheckboxProps = {\n label?: string;\n value?: boolean;\n disabled?: boolean;\n primaryColor?: ColorValue;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n checkboxComponent?: React.ReactNode;\n onChange?: (value: boolean | string | number) => void;\n};\n"],"mappings":""}
|
|
@@ -33,7 +33,8 @@ const Dropdown = _ref => {
|
|
|
33
33
|
dropdownErrorTextStyle,
|
|
34
34
|
dropdownHelperTextStyle,
|
|
35
35
|
primaryColor,
|
|
36
|
-
disabled
|
|
36
|
+
disabled,
|
|
37
|
+
setIndexOfSelectedItem
|
|
37
38
|
} = _ref;
|
|
38
39
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
39
40
|
style: [styles.dropdownInputContainer, dropdownContainerStyle]
|
|
@@ -55,7 +56,8 @@ const Dropdown = _ref => {
|
|
|
55
56
|
dropdownErrorStyle: dropdownErrorStyle,
|
|
56
57
|
primaryColor: primaryColor,
|
|
57
58
|
disabled: disabled,
|
|
58
|
-
placeholderStyle: placeholderStyle
|
|
59
|
+
placeholderStyle: placeholderStyle,
|
|
60
|
+
setIndexOfSelectedItem: setIndexOfSelectedItem
|
|
59
61
|
}), error && error !== '' && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
60
62
|
style: [styles.error, dropdownErrorTextStyle]
|
|
61
63
|
}, error), helperText && helperText !== '' && !error && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownSelectedItemsView","_colors","_typography","obj","__esModule","default","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","labelStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","createElement","View","style","styles","dropdownInputContainer","Text","helper","StyleSheet","create","marginBottom","color","colors","gray","typography","caption","red","marginTop","primary","width","blackText","black","_default","exports"],"sources":["Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport DropdownSelectedItemsView from './DropdownSelectedItemsView';\nimport { colors } from '../../styles/colors';\nimport { typography } from '../../styles/typography';\n\nconst Dropdown = ({\n label,\n placeholder,\n helperText,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n labelStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <View style={[styles.dropdownInputContainer, dropdownContainerStyle]}>\n {label && label !== '' && (\n <Text style={[styles.label, labelStyle]}>{label}</Text>\n )}\n <DropdownSelectedItemsView\n placeholder={placeholder}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n handleToggleModal={handleToggleModal}\n isMultiple={isMultiple}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n />\n\n {error && error !== '' && (\n <Text style={[styles.error, dropdownErrorTextStyle]}>{error}</Text>\n )}\n\n {helperText && helperText !== '' && !error && (\n <Text style={[styles.helper, dropdownHelperTextStyle]}>\n {helperText}\n </Text>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n label: { marginBottom: 16, color: colors.gray, ...typography.caption },\n error: { color: colors.red, marginTop: 8, ...typography.caption },\n helper: { marginTop: 8, color: colors.primary, ...typography.caption },\n dropdownInputContainer: { marginBottom: 23, width: '100%' },\n blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAqD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAErD,MAAMG,QAAQ,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownSelectedItemsView","_colors","_typography","obj","__esModule","default","Dropdown","_ref","label","placeholder","helperText","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","labelStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","primaryColor","disabled","setIndexOfSelectedItem","createElement","View","style","styles","dropdownInputContainer","Text","helper","StyleSheet","create","marginBottom","color","colors","gray","typography","caption","red","marginTop","primary","width","blackText","black","_default","exports"],"sources":["Dropdown.tsx"],"sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet } from 'react-native';\nimport DropdownSelectedItemsView from './DropdownSelectedItemsView';\nimport { colors } from '../../styles/colors';\nimport { typography } from '../../styles/typography';\n\nconst Dropdown = ({\n label,\n placeholder,\n helperText,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n labelStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n primaryColor,\n disabled,\n setIndexOfSelectedItem,\n}: any) => {\n return (\n <View style={[styles.dropdownInputContainer, dropdownContainerStyle]}>\n {label && label !== '' && (\n <Text style={[styles.label, labelStyle]}>{label}</Text>\n )}\n\n <DropdownSelectedItemsView\n placeholder={placeholder}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n handleToggleModal={handleToggleModal}\n isMultiple={isMultiple}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n primaryColor={primaryColor}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n setIndexOfSelectedItem={setIndexOfSelectedItem}\n />\n\n {error && error !== '' && (\n <Text style={[styles.error, dropdownErrorTextStyle]}>{error}</Text>\n )}\n\n {helperText && helperText !== '' && !error && (\n <Text style={[styles.helper, dropdownHelperTextStyle]}>\n {helperText}\n </Text>\n )}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n label: { marginBottom: 16, color: colors.gray, ...typography.caption },\n error: { color: colors.red, marginTop: 8, ...typography.caption },\n helper: { marginTop: 8, color: colors.primary, ...typography.caption },\n dropdownInputContainer: { marginBottom: 23, width: '100%' },\n blackText: { color: colors.black },\n});\n\nexport default Dropdown;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAqD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF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
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _DropdownListItem = _interopRequireDefault(require("./DropdownListItem"));
|
|
10
10
|
var _Others = require("../Others");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* eslint-disable react-native/no-inline-styles */
|
|
13
15
|
const DropdownFlatList = _ref => {
|
|
14
16
|
let {
|
|
@@ -29,9 +31,22 @@ const DropdownFlatList = _ref => {
|
|
|
29
31
|
checkboxLabelStyle,
|
|
30
32
|
// kept for backwards compatibility to be removed in future release
|
|
31
33
|
checkboxComponentStyles,
|
|
34
|
+
checkboxComponent,
|
|
32
35
|
listComponentStyles,
|
|
36
|
+
listIndex,
|
|
33
37
|
...rest
|
|
34
38
|
} = _ref;
|
|
39
|
+
const flatlistRef = (0, _react.useRef)(null);
|
|
40
|
+
const scrollToItem = index => {
|
|
41
|
+
var _flatlistRef$current;
|
|
42
|
+
(_flatlistRef$current = flatlistRef.current) === null || _flatlistRef$current === void 0 ? void 0 : _flatlistRef$current.scrollToIndex({
|
|
43
|
+
index,
|
|
44
|
+
animated: true
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
scrollToItem(listIndex.itemIndex);
|
|
49
|
+
}, [listIndex]);
|
|
35
50
|
return /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, _extends({
|
|
36
51
|
data: options,
|
|
37
52
|
extraData: isMultiple ? selectedItems : selectedItem,
|
|
@@ -51,6 +66,7 @@ const DropdownFlatList = _ref => {
|
|
|
51
66
|
isMultiple,
|
|
52
67
|
selectedOption: isMultiple ? selectedItems : selectedItem,
|
|
53
68
|
onChange: isMultiple ? handleMultipleSelections : handleSingleSelection,
|
|
69
|
+
scrollToItem,
|
|
54
70
|
primaryColor,
|
|
55
71
|
checkboxSize,
|
|
56
72
|
// kept for backwards compatibility
|
|
@@ -58,15 +74,25 @@ const DropdownFlatList = _ref => {
|
|
|
58
74
|
// kept for backwards compatibility
|
|
59
75
|
checkboxLabelStyle,
|
|
60
76
|
// kept for backwards compatibility
|
|
61
|
-
checkboxComponentStyles
|
|
77
|
+
checkboxComponentStyles,
|
|
78
|
+
checkboxComponent
|
|
62
79
|
}),
|
|
63
|
-
keyExtractor: (_item, index) => `Options${index}
|
|
80
|
+
keyExtractor: (_item, index) => `Options${index}`,
|
|
81
|
+
ref: flatlistRef,
|
|
82
|
+
onScrollToIndexFailed: _ref2 => {
|
|
83
|
+
let {
|
|
84
|
+
index
|
|
85
|
+
} = _ref2;
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
scrollToItem(index);
|
|
88
|
+
}, 500);
|
|
89
|
+
}
|
|
64
90
|
}, rest));
|
|
65
91
|
};
|
|
66
|
-
const _renderItem = (
|
|
92
|
+
const _renderItem = (_ref3, props) => {
|
|
67
93
|
let {
|
|
68
94
|
item
|
|
69
|
-
} =
|
|
95
|
+
} = _ref3;
|
|
70
96
|
return /*#__PURE__*/_react.default.createElement(_DropdownListItem.default, {
|
|
71
97
|
item: item,
|
|
72
98
|
optionLabel: props.optionLabel,
|
|
@@ -78,7 +104,9 @@ const _renderItem = (_ref2, props) => {
|
|
|
78
104
|
checkboxSize: props.checkboxSize,
|
|
79
105
|
checkboxStyle: props.checkboxStyle,
|
|
80
106
|
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
81
|
-
|
|
107
|
+
scrollToItem: props.scrollToItem,
|
|
108
|
+
checkboxComponentStyles: props.checkboxComponentStyles,
|
|
109
|
+
checkboxComponent: props.checkboxComponent
|
|
82
110
|
});
|
|
83
111
|
};
|
|
84
112
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","flatlistRef","useRef","scrollToItem","index","_flatlistRef$current","current","scrollToIndex","animated","useEffect","itemIndex","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","ref","onScrollToIndexFailed","_ref2","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"sources":["DropdownFlatList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useRef } from 'react';\nimport { FlatList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { ItemSeparatorComponent, ListEmptyComponent } from '../Others';\nimport { TFlatList } from 'src/types/index.types';\n\nconst DropdownFlatList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility to be removed in future release\n checkboxStyle, // kept for backwards compatibility to be removed in future release\n checkboxLabelStyle, // kept for backwards compatibility to be removed in future release\n checkboxComponentStyles,\n checkboxComponent,\n listComponentStyles,\n listIndex,\n ...rest\n}: any) => {\n const flatlistRef = useRef<FlatList<TFlatList>>(null);\n\n const scrollToItem = (index: number) => {\n flatlistRef.current?.scrollToIndex({\n index,\n animated: true,\n });\n };\n\n useEffect(() => {\n scrollToItem(listIndex.itemIndex);\n }, [listIndex]);\n\n return (\n <FlatList\n data={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n scrollToItem,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n checkboxComponent\n })\n }\n keyExtractor={(_item, index) => `Options${index}`}\n ref={flatlistRef}\n onScrollToIndexFailed={({ index }) => {\n setTimeout(() => {\n scrollToItem(index);\n }, 500);\n }}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ item }: any, props: any) => {\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n scrollToItem={props.scrollToItem}\n checkboxComponentStyles={props.checkboxComponentStyles}\n checkboxComponent={props.checkboxComponent}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownFlatList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAAuE,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAM,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UA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T,cAAe;IACrCC,QAAQ,EAAEQ,KAAK,CAACR,QAAS;IACzBnC,YAAY,EAAE2C,KAAK,CAAC3C,YAAa;IACjCC,YAAY,EAAE0C,KAAK,CAAC1C,YAAa;IACjCC,aAAa,EAAEyC,KAAK,CAACzC,aAAc;IACnCC,kBAAkB,EAAEwC,KAAK,CAACxC,kBAAmB;IAC7CQ,YAAY,EAAEgC,KAAK,CAAChC,YAAa;IACjCP,uBAAuB,EAAEuC,KAAK,CAACvC,uBAAwB;IACvDC,iBAAiB,EAAEsC,KAAK,CAACtC;EAAkB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMuB,MAAM,GAAGgB,uBAAU,CAACC,MAAM,CAAC;EAC/BnB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAAmB,QAAA,GAEYzD,gBAAgB;AAAA0D,OAAA,CAAAvF,OAAA,GAAAsF,QAAA"}
|
|
@@ -22,7 +22,8 @@ const DropdownListItem = _ref => {
|
|
|
22
22
|
checkboxSize,
|
|
23
23
|
checkboxStyle,
|
|
24
24
|
checkboxLabelStyle,
|
|
25
|
-
checkboxComponentStyles
|
|
25
|
+
checkboxComponentStyles,
|
|
26
|
+
checkboxComponent
|
|
26
27
|
} = _ref;
|
|
27
28
|
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
28
29
|
style: styles.listItemContainerStyle,
|
|
@@ -35,7 +36,8 @@ const DropdownListItem = _ref => {
|
|
|
35
36
|
checkboxSize: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize,
|
|
36
37
|
checkboxStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle,
|
|
37
38
|
checkboxLabelStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxLabelStyle) || checkboxLabelStyle,
|
|
38
|
-
disabled: item.disabled
|
|
39
|
+
disabled: item.disabled,
|
|
40
|
+
checkboxComponent: checkboxComponent
|
|
39
41
|
}));
|
|
40
42
|
};
|
|
41
43
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","createElement","TouchableOpacity","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default","memo","exports"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,GAAA,EAAAgB,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAhB,GAAA,CAAAgB,GAAA,SAAAL,MAAA,CAAAT,OAAA,GAAAF,GAAA,MAAAQ,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAArB,GAAA,EAAAW,MAAA,YAAAA,MAAA;AAEnC,MAAMW,gBAAgB,GAAGC,IAAA,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","createElement","TouchableOpacity","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default","memo","exports"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,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AAQ,EAAEA,CAAA,KAAMA,QAAQ,CAACL,IAAI,CAACE,WAAW,CAAC,CAAE;IAC5CI,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAE,CAAAG,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEH,YAAY,KAAIA,YAAa;IACpEC,aAAa,EAAE,CAAAE,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEF,aAAa,KAAIA,aAAc;IACvEC,kBAAkB,EAChB,CAAAC,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAED,kBAAkB,KAAIA,kBAChD;IACDS,QAAQ,EAAElB,IAAI,CAACkB,QAAS;IACxBP,iBAAiB,EAAEA;EAAkB,CACtC,CACe,CAAC;AAEvB,CAAC;AAED,MAAMI,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC/BP,sBAAsB,EAAE;IACtBQ,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,gBAEY,IAAAC,WAAI,EAAC/B,gBAAgB,CAAC;AAAAgC,OAAA,CAAApD,OAAA,GAAAkD,QAAA"}
|
|
@@ -29,7 +29,9 @@ const DropdownSectionList = _ref => {
|
|
|
29
29
|
checkboxStyle,
|
|
30
30
|
checkboxLabelStyle,
|
|
31
31
|
checkboxComponentStyles,
|
|
32
|
+
checkboxComponent,
|
|
32
33
|
listComponentStyles,
|
|
34
|
+
listIndex,
|
|
33
35
|
...rest
|
|
34
36
|
} = _ref;
|
|
35
37
|
const [expandedSections, setExpandedSections] = (0, _react.useState)(new Set());
|
|
@@ -57,6 +59,23 @@ const DropdownSectionList = _ref => {
|
|
|
57
59
|
return next;
|
|
58
60
|
});
|
|
59
61
|
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @description Scroll to item location
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
const sectionlistRef = (0, _react.useRef)(null);
|
|
68
|
+
const scrollToLocation = listIndex => {
|
|
69
|
+
var _sectionlistRef$curre;
|
|
70
|
+
(_sectionlistRef$curre = sectionlistRef.current) === null || _sectionlistRef$curre === void 0 ? void 0 : _sectionlistRef$curre.scrollToLocation({
|
|
71
|
+
sectionIndex: listIndex.sectionIndex,
|
|
72
|
+
animated: true,
|
|
73
|
+
itemIndex: listIndex.itemIndex
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
(0, _react.useEffect)(() => {
|
|
77
|
+
scrollToLocation(listIndex);
|
|
78
|
+
}, [listIndex]);
|
|
60
79
|
return /*#__PURE__*/_react.default.createElement(_reactNative.SectionList, _extends({
|
|
61
80
|
sections: options,
|
|
62
81
|
extraData: isMultiple ? selectedItems : selectedItem,
|
|
@@ -84,6 +103,7 @@ const DropdownSectionList = _ref => {
|
|
|
84
103
|
checkboxLabelStyle,
|
|
85
104
|
// kept for backwards compatibility
|
|
86
105
|
checkboxComponentStyles,
|
|
106
|
+
checkboxComponent,
|
|
87
107
|
expandedSections
|
|
88
108
|
}),
|
|
89
109
|
renderSectionHeader: _ref2 => {
|
|
@@ -101,7 +121,13 @@ const DropdownSectionList = _ref => {
|
|
|
101
121
|
});
|
|
102
122
|
},
|
|
103
123
|
keyExtractor: (_item, index) => `Options${index}`,
|
|
104
|
-
stickySectionHeadersEnabled: false
|
|
124
|
+
stickySectionHeadersEnabled: false,
|
|
125
|
+
ref: sectionlistRef,
|
|
126
|
+
onScrollToIndexFailed: () => {
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
scrollToLocation(listIndex);
|
|
129
|
+
}, 500);
|
|
130
|
+
}
|
|
105
131
|
}, rest));
|
|
106
132
|
};
|
|
107
133
|
const _renderItem = (_ref3, props) => {
|
|
@@ -126,7 +152,8 @@ const _renderItem = (_ref3, props) => {
|
|
|
126
152
|
checkboxSize: props.checkboxSize,
|
|
127
153
|
checkboxStyle: props.checkboxStyle,
|
|
128
154
|
checkboxLabelStyle: props.checkboxLabelStyle,
|
|
129
|
-
checkboxComponentStyles: props.checkboxComponentStyles
|
|
155
|
+
checkboxComponentStyles: props.checkboxComponentStyles,
|
|
156
|
+
checkboxComponent: props.checkboxComponent
|
|
130
157
|
});
|
|
131
158
|
};
|
|
132
159
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","_utils","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","rest","expandedSections","setExpandedSections","useState","Set","useEffect","initialState","extractPropertyFromArray","handleToggleListExpansion","title","expandedSectionsState","next","delete","add","createElement","SectionList","sections","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","SectionHeaderTitle","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","_ref3","props","StyleSheet","create","_default","exports"],"sources":["DropdownSectionList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useState } from 'react';\nimport { SectionList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport {\n ItemSeparatorComponent,\n ListEmptyComponent,\n SectionHeaderTitle,\n} from '../Others';\nimport { extractPropertyFromArray } from '../../utils';\n\nconst DropdownSectionList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n listComponentStyles,\n ...rest\n}: any) => {\n const [expandedSections, setExpandedSections] = useState(new Set());\n\n /**\n * Expand all sections\n */\n useEffect(() => {\n let initialState = new Set(extractPropertyFromArray(options, 'title'));\n setExpandedSections(initialState);\n }, [options]);\n\n /**\n * @param title\n */\n const handleToggleListExpansion = (title: string) => {\n setExpandedSections((expandedSectionsState) => {\n // Using Set here but you can use an array too\n const next = new Set(expandedSectionsState);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n return (\n <SectionList\n sections={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title, data } }) =>\n data.length > 0 && (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )\n }\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ section: { title }, item }: any, props: any) => {\n const isExpanded = props?.expandedSections.has(title);\n\n //return null if it is not expanded\n if (!isExpanded) return null;\n\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAuD,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA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AAC;AAEN,CAAC;AAED,MAAM4B,WAAW,GAAGA,CAAAe,KAAA,EAAoCC,KAAU,KAAK;EAAA,IAAlD;IAAEX,OAAO,EAAE;MAAExB;IAAM,CAAC;IAAEkB;EAAU,CAAC,GAAAgB,KAAA;EACpD,MAAML,UAAU,GAAGM,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE3C,gBAAgB,CAACxC,GAAG,CAACgD,KAAK,CAAC;;EAErD;EACA,IAAI,CAAC6B,UAAU,EAAE,OAAO,IAAI;EAE5B,oBACE9F,MAAA,CAAAU,OAAA,CAAA4D,aAAA,CAAClE,iBAAA,CAAAM,OAAgB;IACfyE,IAAI,EAAEA,IAAK;IACXzC,WAAW,EAAE0D,KAAK,CAAC1D,WAAY;IAC/BC,WAAW,EAAEyD,KAAK,CAACzD,WAAY;IAC/BC,UAAU,EAAEwD,KAAK,CAACxD,UAAW;IAC7ByC,cAAc,EAAEe,KAAK,CAACf,cAAe;IACrCC,QAAQ,EAAEc,KAAK,CAACd,QAAS;IACzBpC,YAAY,EAAEkD,KAAK,CAAClD,YAAa;IACjCC,YAAY,EAAEiD,KAAK,CAACjD,YAAa;IACjCC,aAAa,EAAEgD,KAAK,CAAChD,aAAc;IACnCC,kBAAkB,EAAE+C,KAAK,CAAC/C,kBAAmB;IAC7CC,uBAAuB,EAAE8C,KAAK,CAAC9C;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAMyB,MAAM,GAAGsB,uBAAU,CAACC,MAAM,CAAC;EAC/BzB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAAyB,QAAA,GAEYhE,mBAAmB;AAAAiE,OAAA,CAAA9F,OAAA,GAAA6F,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DropdownListItem","_interopRequireDefault","_Others","_utils","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","expandedSections","setExpandedSections","useState","Set","useEffect","initialState","extractPropertyFromArray","handleToggleListExpansion","title","expandedSectionsState","next","delete","add","sectionlistRef","useRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","SectionList","sections","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","SectionHeaderTitle","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","StyleSheet","create","_default","exports"],"sources":["DropdownSectionList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React, { useEffect, useState, useRef } from 'react';\nimport { SectionList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport {\n ItemSeparatorComponent,\n ListEmptyComponent,\n SectionHeaderTitle,\n} from '../Others';\nimport { extractPropertyFromArray } from '../../utils';\nimport { TSectionList } from 'src/types/index.types';\n\nconst DropdownSectionList = ({\n options,\n optionLabel,\n optionValue,\n isMultiple,\n isSearchable,\n selectedItems,\n selectedItem,\n handleMultipleSelections,\n handleSingleSelection,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n listComponentStyles,\n listIndex,\n ...rest\n}: any) => {\n const [expandedSections, setExpandedSections] = useState(new Set());\n\n /**\n * Expand all sections\n */\n useEffect(() => {\n let initialState = new Set(extractPropertyFromArray(options, 'title'));\n setExpandedSections(initialState);\n }, [options]);\n\n /**\n * @param title\n */\n const handleToggleListExpansion = (title: string) => {\n setExpandedSections((expandedSectionsState) => {\n // Using Set here but you can use an array too\n const next = new Set(expandedSectionsState);\n if (next.has(title)) {\n next.delete(title);\n } else {\n next.add(title);\n }\n return next;\n });\n };\n\n /**\n * @description Scroll to item location\n */\n\n const sectionlistRef = useRef<SectionList<TSectionList>>(null);\n\n const scrollToLocation = (listIndex: any) => {\n sectionlistRef.current?.scrollToLocation({\n sectionIndex: listIndex.sectionIndex,\n animated: true,\n itemIndex: listIndex.itemIndex,\n });\n };\n\n useEffect(() => {\n scrollToLocation(listIndex);\n }, [listIndex]);\n\n return (\n <SectionList\n sections={options}\n extraData={isMultiple ? selectedItems : selectedItem}\n initialNumToRender={5}\n ListEmptyComponent={\n <ListEmptyComponent\n listEmptyComponentStyle={listComponentStyles?.listEmptyComponentStyle}\n />\n }\n contentContainerStyle={[\n isSearchable ? { paddingTop: 0 } : styles.contentContainerStyle,\n ]}\n ItemSeparatorComponent={() => (\n <ItemSeparatorComponent\n itemSeparatorStyle={listComponentStyles?.itemSeparatorStyle}\n />\n )}\n renderItem={(item) =>\n _renderItem(item, {\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption: isMultiple ? selectedItems : selectedItem,\n onChange: isMultiple\n ? handleMultipleSelections\n : handleSingleSelection,\n primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n checkboxComponent,\n expandedSections,\n })\n }\n renderSectionHeader={({ section: { title, data } }) =>\n data.length > 0 && (\n <SectionHeaderTitle\n title={title}\n sectionHeaderStyle={listComponentStyles?.sectionHeaderStyle}\n onPress={() => handleToggleListExpansion(title)}\n isExpanded={expandedSections.has(title)}\n />\n )\n }\n keyExtractor={(_item, index) => `Options${index}`}\n stickySectionHeadersEnabled={false}\n ref={sectionlistRef}\n onScrollToIndexFailed={() => {\n setTimeout(() => {\n scrollToLocation(listIndex);\n }, 500);\n }}\n {...rest}\n />\n );\n};\n\nconst _renderItem = ({ section: { title }, item }: any, props: any) => {\n const isExpanded = props?.expandedSections.has(title);\n\n //return null if it is not expanded\n if (!isExpanded) return null;\n\n return (\n <DropdownListItem\n item={item}\n optionLabel={props.optionLabel}\n optionValue={props.optionValue}\n isMultiple={props.isMultiple}\n selectedOption={props.selectedOption}\n onChange={props.onChange}\n primaryColor={props.primaryColor}\n checkboxSize={props.checkboxSize}\n checkboxStyle={props.checkboxStyle}\n checkboxLabelStyle={props.checkboxLabelStyle}\n checkboxComponentStyles={props.checkboxComponentStyles}\n checkboxComponent={props.checkboxComponent}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownSectionList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAuD,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ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EuE,KAAK,CAACvE,WAAY;IAC/BC,WAAW,EAAEsE,KAAK,CAACtE,WAAY;IAC/BC,UAAU,EAAEqE,KAAK,CAACrE,UAAW;IAC7BmD,cAAc,EAAEkB,KAAK,CAAClB,cAAe;IACrCC,QAAQ,EAAEiB,KAAK,CAACjB,QAAS;IACzB9C,YAAY,EAAE+D,KAAK,CAAC/D,YAAa;IACjCC,YAAY,EAAE8D,KAAK,CAAC9D,YAAa;IACjCC,aAAa,EAAE6D,KAAK,CAAC7D,aAAc;IACnCC,kBAAkB,EAAE4D,KAAK,CAAC5D,kBAAmB;IAC7CC,uBAAuB,EAAE2D,KAAK,CAAC3D,uBAAwB;IACvDC,iBAAiB,EAAE0D,KAAK,CAAC1D;EAAkB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMkC,MAAM,GAAGyB,uBAAU,CAACC,MAAM,CAAC;EAC/B5B,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAA4B,QAAA,GAEY7E,mBAAmB;AAAA8E,OAAA,CAAA3G,OAAA,GAAA0G,QAAA"}
|
|
@@ -9,6 +9,7 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _colors = require("../../styles/colors");
|
|
10
10
|
var _input = require("../../styles/input");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
13
|
const DropdownSelectedItemsView = _ref => {
|
|
13
14
|
var _getSelectedItemsLabe;
|
|
14
15
|
let {
|
|
@@ -27,7 +28,8 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
27
28
|
multipleSelectedItemStyle,
|
|
28
29
|
dropdownErrorStyle,
|
|
29
30
|
primaryColor,
|
|
30
|
-
disabled
|
|
31
|
+
disabled,
|
|
32
|
+
setIndexOfSelectedItem
|
|
31
33
|
} = _ref;
|
|
32
34
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
|
|
33
35
|
onPress: () => handleToggleModal(),
|
|
@@ -38,7 +40,10 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
38
40
|
return [pressed && {
|
|
39
41
|
..._input.inputStyles.inputFocusState,
|
|
40
42
|
borderColor: primaryColor
|
|
41
|
-
},
|
|
43
|
+
}, {
|
|
44
|
+
..._input.inputStyles.input,
|
|
45
|
+
...dropdownStyle
|
|
46
|
+
}, error &&
|
|
42
47
|
//this must be last
|
|
43
48
|
error !== '' && !pressed && {
|
|
44
49
|
..._input.inputStyles.inputFocusErrorState,
|
|
@@ -53,21 +58,48 @@ const DropdownSelectedItemsView = _ref => {
|
|
|
53
58
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
54
59
|
style: styles.selectedItemsContainer,
|
|
55
60
|
onStartShouldSetResponder: () => true
|
|
56
|
-
}, isMultiple ? (_getSelectedItemsLabe = getSelectedItemsLabel()) === null || _getSelectedItemsLabe === void 0 ? void 0 : _getSelectedItemsLabe.map((
|
|
61
|
+
}, isMultiple ? (_getSelectedItemsLabe = getSelectedItemsLabel()) === null || _getSelectedItemsLabe === void 0 ? void 0 : _getSelectedItemsLabe.map((label, i) => /*#__PURE__*/_react.default.createElement(DropdownContent, {
|
|
62
|
+
onPress: () => {
|
|
63
|
+
handleToggleModal();
|
|
64
|
+
setIndexOfSelectedItem(label); // immediately scrolls to list item with the specified label when modal
|
|
65
|
+
},
|
|
66
|
+
|
|
57
67
|
key: `react-native-input-select-${Math.random()}-${i}`,
|
|
58
68
|
style: [styles.selectedItems, {
|
|
59
69
|
backgroundColor: primaryColor
|
|
60
|
-
}, multipleSelectedItemStyle]
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
}, multipleSelectedItemStyle],
|
|
71
|
+
label: label
|
|
72
|
+
})) : /*#__PURE__*/_react.default.createElement(DropdownContent, {
|
|
73
|
+
onPress: () => {
|
|
74
|
+
handleToggleModal();
|
|
75
|
+
setIndexOfSelectedItem(getSelectedItemsLabel()); // immediately scrolls to list item with the specified label when modal
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
style: [styles.blackText, selectedItemStyle],
|
|
79
|
+
label: getSelectedItemsLabel()
|
|
80
|
+
}), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/_react.default.createElement(DropdownContent, {
|
|
81
|
+
onPress: () => handleToggleModal(),
|
|
82
|
+
style: [styles.blackText, placeholderStyle],
|
|
83
|
+
label: placeholder ?? 'Select an option'
|
|
84
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
66
85
|
style: [styles.iconStyle, dropdownIconStyle]
|
|
67
86
|
}, dropdownIcon || /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
68
87
|
source: require('../../asset/arrow-down.png')
|
|
69
88
|
})));
|
|
70
89
|
};
|
|
90
|
+
const DropdownContent = _ref3 => {
|
|
91
|
+
let {
|
|
92
|
+
onPress,
|
|
93
|
+
style,
|
|
94
|
+
label,
|
|
95
|
+
...rest
|
|
96
|
+
} = _ref3;
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, _extends({
|
|
98
|
+
onPress: () => onPress()
|
|
99
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
100
|
+
style: style
|
|
101
|
+
}, label));
|
|
102
|
+
};
|
|
71
103
|
const styles = _reactNative.StyleSheet.create({
|
|
72
104
|
iconStyle: {
|
|
73
105
|
position: 'absolute',
|