react-native-input-select 1.1.6 → 1.1.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.
Files changed (43) hide show
  1. package/README.md +20 -10
  2. package/lib/commonjs/components/CheckBox/index.js +1 -1
  3. package/lib/commonjs/components/CheckBox/index.js.map +1 -1
  4. package/lib/commonjs/components/CustomModal/index.js +1 -2
  5. package/lib/commonjs/components/CustomModal/index.js.map +1 -1
  6. package/lib/commonjs/components/Dropdown/DropdownFlatList.js +4 -2
  7. package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
  8. package/lib/commonjs/components/Dropdown/DropdownSectionList.js +5 -3
  9. package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
  10. package/lib/commonjs/components/Input/index.js +5 -2
  11. package/lib/commonjs/components/Input/index.js.map +1 -1
  12. package/lib/commonjs/index.js +24 -23
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/types/index.types.js.map +1 -1
  15. package/lib/commonjs/utils/index.js +1 -1
  16. package/lib/commonjs/utils/index.js.map +1 -1
  17. package/lib/module/components/CheckBox/index.js +1 -1
  18. package/lib/module/components/CheckBox/index.js.map +1 -1
  19. package/lib/module/components/CustomModal/index.js +1 -2
  20. package/lib/module/components/CustomModal/index.js.map +1 -1
  21. package/lib/module/components/Dropdown/DropdownFlatList.js +4 -2
  22. package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
  23. package/lib/module/components/Dropdown/DropdownSectionList.js +5 -3
  24. package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
  25. package/lib/module/components/Input/index.js +5 -2
  26. package/lib/module/components/Input/index.js.map +1 -1
  27. package/lib/module/index.js +24 -23
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/types/index.types.js.map +1 -1
  30. package/lib/module/utils/index.js +1 -1
  31. package/lib/module/utils/index.js.map +1 -1
  32. package/lib/typescript/components/CustomModal/index.d.ts +1 -1
  33. package/lib/typescript/components/Input/index.d.ts +1 -1
  34. package/lib/typescript/types/index.types.d.ts +2 -1
  35. package/package.json +1 -1
  36. package/src/components/CheckBox/index.tsx +1 -1
  37. package/src/components/CustomModal/index.tsx +1 -2
  38. package/src/components/Dropdown/DropdownFlatList.tsx +5 -3
  39. package/src/components/Dropdown/DropdownSectionList.tsx +6 -3
  40. package/src/components/Input/index.tsx +5 -2
  41. package/src/index.tsx +37 -31
  42. package/src/types/index.types.ts +2 -1
  43. package/src/utils/index.ts +1 -1
package/README.md CHANGED
@@ -271,10 +271,10 @@ For more examples visit our [wiki page](https://github.com/azeezat/react-native-
271
271
  | listFooterComponent | `React Component` | `<Text> You can add any component here <Text>` |
272
272
  | hideModal | `Boolean` | Use this to hide the modal as needed |
273
273
  | listComponentStyles | `Object` | `{listEmptyComponentStyle: ViewStyle, itemSeparatorStyle: ViewStyle, sectionHeaderStyle: TextStyle}` |
274
- | checkboxComponentStyles | `Object` | `{checkboxSize?: number, checkboxStyle?: ViewStyle, checkboxLabelStyle: TextStyle}` |
274
+ | checkboxComponentStyles | `Object` | `{checkboxSize: number, checkboxStyle: ViewStyle, checkboxLabelStyle: TextStyle}` |
275
275
  | checkboxComponent | `React Component` | `<View style={styles.radioButton} />` |
276
- | listControls | `Object` | `{ selectAllText: 'Choose all', unselectAllText: 'Remove all', selectAllCallback?: () => {}, unselectAllCallback?: () => {}}` |
277
- | searchControls | `Object` | `{ searchInputStyle?: ViewStyle | TextStyle, textInputProps: TextInputProps}` |
276
+ | listControls | `Object` | `{ selectAllText: 'Choose all', unselectAllText: 'Remove all', selectAllCallback: () => {}, unselectAllCallback: () => {}}` |
277
+ | searchControls | `Object` | `{ textInputStyle: ViewStyle \| TextStyle, textInputContainerStyle: ViewStyle, textInputProps: TextInputProps}` |
278
278
 
279
279
  ## Deprecation Notice
280
280
 
@@ -295,20 +295,30 @@ checkboxComponentStyles = {
295
295
  };
296
296
  ```
297
297
 
298
- - `searchInputStyle` would now be inside `searchControls`
298
+ - `searchInputStyle` would now be inside replaced with `textInputStyle` in the `searchControls` object
299
299
 
300
300
  ```js
301
- searchControls={{
302
- searchInputStyle: {
303
- backgroundColor: 'yellow',
301
+ searchControls={
302
+ textInputStyle: {
304
303
  color: 'blue',
305
- fontWeight: '900',
304
+ fontWeight: '500',
305
+ minHeight: 10,
306
+ paddingVertical: 10,
307
+ paddingHorizontal: 5,
308
+ width: '70%',
309
+ textAlign: 'center',
310
+ backgroundColor: 'pink',
311
+ },
312
+ textInputContainerStyle: {
313
+ flex: 1,
314
+ justifyContent: 'center',
315
+ alignItems: 'center',
306
316
  },
307
317
  textInputProps: {
308
318
  placeholder: 'Search anything here',
309
- placeholderTextColor: 'gray',
319
+ placeholderTextColor: 'white',
310
320
  },
311
- }}
321
+ }
312
322
  ```
313
323
 
314
324
  ## Contributing
@@ -59,7 +59,7 @@ const CheckBox = _ref => {
59
59
  height: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize || _constants.CHECKBOX_SIZE,
60
60
  width: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize || _constants.CHECKBOX_SIZE
61
61
  }]
62
- })), label && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
62
+ })), label && label !== '' && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
63
63
  style: [(checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxLabelStyle) || checkboxLabelStyle, styles.labelStyle]
64
64
  }, label));
65
65
  };
@@ -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","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,uBAAb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AAAQ,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
+ {"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 && 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,uBAAbA,aAAa,CAAEM,eAAe,KAC9BR,YAAY,IACZ,OAAO,GACP,OAAO;IACXS,WAAW,EAAEV,QAAQ,GACjBW,cAAM,CAACX,QAAQ,GACf,CAAAK,uBAAuB,aAAvBA,uBAAuB,gBAAAR,sBAAA,GAAvBQ,uBAAuB,CAAEF,aAAa,cAAAN,sBAAA,uBAAtCA,sBAAA,CAAwCa,WAAW,MACnDP,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEO,WAAW,KAC1BE,MAAM,CA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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"}
@@ -12,7 +12,6 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
12
12
  const CustomModal = _ref => {
13
13
  let {
14
14
  open,
15
- handleToggleModal,
16
15
  onRequestClose,
17
16
  modalBackgroundStyle,
18
17
  modalOptionsContainerStyle,
@@ -25,7 +24,7 @@ const CustomModal = _ref => {
25
24
  onRequestClose: () => onRequestClose(),
26
25
  animationType: "fade"
27
26
  }, modalProps), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
28
- onPress: () => handleToggleModal(),
27
+ onPress: () => onRequestClose(),
29
28
  style: [styles.modalContainer, styles.modalBackgroundStyle, modalBackgroundStyle]
30
29
  }, /*#__PURE__*/_react.default.createElement(_reactNative.SafeAreaView, {
31
30
  style: [styles.modalOptionsContainer, modalOptionsContainerStyle]
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","CustomModal","_ref","open","handleToggleModal","onRequestClose","modalBackgroundStyle","modalOptionsContainerStyle","modalProps","children","createElement","Modal","transparent","visible","animationType","TouchableOpacity","onPress","style","styles","modalContainer","SafeAreaView","modalOptionsContainer","StyleSheet","create","flex","justifyContent","backgroundColor","maxHeight","colors","white","borderTopLeftRadius","borderTopRightRadius","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Modal,\n TouchableOpacity,\n SafeAreaView,\n StyleSheet,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nconst CustomModal = ({\n open,\n handleToggleModal,\n onRequestClose,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n modalProps,\n children,\n}: any) => {\n return (\n <Modal\n transparent={true}\n visible={open}\n onRequestClose={() => onRequestClose()}\n animationType=\"fade\"\n {...modalProps}\n >\n <TouchableOpacity\n onPress={() => handleToggleModal()}\n style={[\n styles.modalContainer,\n styles.modalBackgroundStyle,\n modalBackgroundStyle,\n ]}\n >\n <SafeAreaView\n style={[styles.modalOptionsContainer, modalOptionsContainerStyle]}\n >\n {children}\n </SafeAreaView>\n </TouchableOpacity>\n </Modal>\n );\n};\n\nconst styles = StyleSheet.create({\n modalContainer: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n modalBackgroundStyle: { backgroundColor: 'rgba(0, 0, 0, 0.5)' },\n modalOptionsContainer: {\n maxHeight: '50%',\n backgroundColor: colors.white,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n});\n\nexport default CustomModal;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AAA6C,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,SAAA,IAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,GAAAF,SAAA,CAAAD,CAAA,YAAAI,GAAA,IAAAD,MAAA,QAAAP,MAAA,CAAAS,SAA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AAK;IAC7BC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY/B,WAAW;AAAAgC,OAAA,CAAA/C,OAAA,GAAA8C,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","CustomModal","_ref","open","onRequestClose","modalBackgroundStyle","modalOptionsContainerStyle","modalProps","children","createElement","Modal","transparent","visible","animationType","TouchableOpacity","onPress","style","styles","modalContainer","SafeAreaView","modalOptionsContainer","StyleSheet","create","flex","justifyContent","backgroundColor","maxHeight","colors","white","borderTopLeftRadius","borderTopRightRadius","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Modal,\n TouchableOpacity,\n SafeAreaView,\n StyleSheet,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\n\nconst CustomModal = ({\n open,\n onRequestClose,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n modalProps,\n children,\n}: any) => {\n return (\n <Modal\n transparent={true}\n visible={open}\n onRequestClose={() => onRequestClose()}\n animationType=\"fade\"\n {...modalProps}\n >\n <TouchableOpacity\n onPress={() => onRequestClose()}\n style={[\n styles.modalContainer,\n styles.modalBackgroundStyle,\n modalBackgroundStyle,\n ]}\n >\n <SafeAreaView\n style={[styles.modalOptionsContainer, modalOptionsContainerStyle]}\n >\n {children}\n </SafeAreaView>\n </TouchableOpacity>\n </Modal>\n );\n};\n\nconst styles = StyleSheet.create({\n modalContainer: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n modalBackgroundStyle: { backgroundColor: 'rgba(0, 0, 0, 0.5)' },\n modalOptionsContainer: {\n maxHeight: '50%',\n backgroundColor: colors.white,\n borderTopLeftRadius: 16,\n borderTopRightRadius: 16,\n },\n});\n\nexport default CustomModal;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAA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gBAEF1B,MAAA,CAAAO,OAAA,CAAAuB,aAAA,CAAC3B,YAAA,CAAAqC,YAAY;IACXH,KAAK,EAAE,CAACC,MAAM,CAACG,qBAAqB,EAAEd,0BAA0B;EAAE,GAEjEE,QACW,CACE,CACb,CAAC;AAEZ,CAAC;AAED,MAAMS,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/BJ,cAAc,EAAE;IACdK,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE;EAClB,CAAC;EACDnB,oBAAoB,EAAE;IAAEoB,eAAe,EAAE;EAAqB,CAAC;EAC/DL,qBAAqB,EAAE;IACrBM,SAAS,EAAE,KAAK;IAChBD,eAAe,EAAEE,cAAM,CAACC,KAAK;IAC7BC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY9B,WAAW;AAAA+B,OAAA,CAAA9C,OAAA,GAAA6C,QAAA"}
@@ -45,8 +45,10 @@ const DropdownFlatList = _ref => {
45
45
  });
46
46
  };
47
47
  (0, _react.useEffect)(() => {
48
- scrollToItem(listIndex.itemIndex);
49
- }, [listIndex]);
48
+ if (options !== null && options !== void 0 && options.length) {
49
+ scrollToItem(listIndex.itemIndex);
50
+ }
51
+ }, [listIndex, options]);
50
52
  return /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, _extends({
51
53
  data: options,
52
54
  extraData: isMultiple ? selectedItems : selectedItem,
@@ -1 +1 @@
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,OAAA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OAAgB;IACfwE,IAAI,EAAEA,IAAK;IACXxC,WAAW,EAAEmD,KAAK,CAACnD,WAAY;IAC/BC,WAAW,EAAEkD,KAAK,CAAClD,WAAY;IAC/BC,UAAU,EAAEiD,KAAK,CAACjD,UAAW;IAC7BwC,cAAc,EAAES,KAAK,CAACT,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"}
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 if (options?.length) {\n scrollToItem(listIndex.itemIndex);\n }\n }, [listIndex, options]);\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,GAA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C,WAAW,EAAEmD,KAAK,CAACnD,WAAY;IAC/BC,WAAW,EAAEkD,KAAK,CAAClD,WAAY;IAC/BC,UAAU,EAAEiD,KAAK,CAACjD,UAAW;IAC7BwC,cAAc,EAAES,KAAK,CAACT,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"}
@@ -74,8 +74,10 @@ const DropdownSectionList = _ref => {
74
74
  });
75
75
  };
76
76
  (0, _react.useEffect)(() => {
77
- scrollToLocation(listIndex);
78
- }, [listIndex]);
77
+ if (options !== null && options !== void 0 && options.length) {
78
+ scrollToLocation(listIndex);
79
+ }
80
+ }, [listIndex, options]);
79
81
  return /*#__PURE__*/_react.default.createElement(_reactNative.SectionList, _extends({
80
82
  sections: options,
81
83
  extraData: isMultiple ? selectedItems : selectedItem,
@@ -113,7 +115,7 @@ const DropdownSectionList = _ref => {
113
115
  data
114
116
  }
115
117
  } = _ref2;
116
- return data.length > 0 && /*#__PURE__*/_react.default.createElement(_Others.SectionHeaderTitle, {
118
+ return (data === null || data === void 0 ? void 0 : data.length) && title && /*#__PURE__*/_react.default.createElement(_Others.SectionHeaderTitle, {
117
119
  title: title,
118
120
  sectionHeaderStyle: listComponentStyles === null || listComponentStyles === void 0 ? void 0 : listComponentStyles.sectionHeaderStyle,
119
121
  onPress: () => handleToggleListExpansion(title),
@@ -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","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,OA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KAAA;EACpD,MAAMR,UAAU,GAAGS,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEtD,gBAAgB,CAAC1C,GAAG,CAACkD,KAAK,CAAC;;EAErD;EACA,IAAI,CAACqC,UAAU,EAAE,OAAO,IAAI;EAE5B,oBACExG,MAAA,CAAAU,OAAA,CAAAsE,aAAA,CAAC5E,iBAAA,CAAAM,OAAgB;IACfmF,IAAI,EAAEA,IAAK;IACXnD,WAAW,EAAEuE,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"}
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 if (options?.length) {\n scrollToLocation(listIndex);\n }\n }, [listIndex, options]);\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 &&\n title && (\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,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA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AAI,EAAEA,IAAK;IACXnD,WAAW,EAAEuE,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"}
@@ -17,11 +17,12 @@ const Input = _ref => {
17
17
  onChangeText,
18
18
  style,
19
19
  primaryColor,
20
+ textInputContainerStyle,
20
21
  ...rest
21
22
  } = _ref;
22
23
  const [isFocused, setFocus] = (0, _react.useState)(false);
23
24
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
24
- style: styles.container
25
+ style: [styles.container, textInputContainerStyle]
25
26
  }, /*#__PURE__*/_react.default.createElement(_reactNative.TextInput, _extends({
26
27
  placeholder: placeholder,
27
28
  style: [_input.inputStyles.input, _reactNative.Platform.select({
@@ -31,7 +32,9 @@ const Input = _ref => {
31
32
  }), isFocused && {
32
33
  borderColor: primaryColor
33
34
  }, style],
34
- onFocus: () => setFocus(true),
35
+ onFocus: () => {
36
+ setFocus(true);
37
+ },
35
38
  onBlur: () => setFocus(false),
36
39
  value: value,
37
40
  onChangeText: onChangeText
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_input","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","Input","_ref","placeholder","value","onChangeText","style","primaryColor","rest","isFocused","setFocus","useState","createElement","View","styles","container","TextInput","inputStyles","input","Platform","select","web","outlineColor","borderColor","onFocus","onBlur","exports","StyleSheet","create","margin","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TextInput, StyleSheet, View, Platform } from 'react-native';\nimport { inputStyles } from '../../styles/input';\n\nexport const Input = ({\n placeholder,\n value,\n onChangeText,\n style,\n primaryColor,\n ...rest\n}: any) => {\n const [isFocused, setFocus] = useState(false);\n\n return (\n <View style={styles.container}>\n <TextInput\n placeholder={placeholder}\n style={[\n inputStyles.input,\n Platform.select({\n web: {\n outlineColor: primaryColor,\n },\n }),\n isFocused && { borderColor: primaryColor },\n style,\n ]}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n value={value}\n onChangeText={onChangeText}\n {...rest}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { margin: 23 },\n});\n\nexport default Input;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAiD,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,SAAAL,wBAAAS,GAAA,EAAAJ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actNative","_input","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","Input","_ref","placeholder","value","onChangeText","style","primaryColor","textInputContainerStyle","rest","isFocused","setFocus","useState","createElement","View","styles","container","TextInput","inputStyles","input","Platform","select","web","outlineColor","borderColor","onFocus","onBlur","exports","StyleSheet","create","margin","_default"],"sources":["index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { TextInput, StyleSheet, View, Platform } from 'react-native';\nimport { inputStyles } from '../../styles/input';\n\nexport const Input = ({\n placeholder,\n value,\n onChangeText,\n style,\n primaryColor,\n textInputContainerStyle,\n ...rest\n}: any) => {\n const [isFocused, setFocus] = useState(false);\n\n return (\n <View style={[styles.container, textInputContainerStyle]}>\n <TextInput\n placeholder={placeholder}\n style={[\n inputStyles.input,\n Platform.select({\n web: {\n outlineColor: primaryColor,\n },\n }),\n isFocused && { borderColor: primaryColor },\n style,\n ]}\n onFocus={() => {\n setFocus(true);\n }}\n onBlur={() => setFocus(false)}\n value={value}\n onChangeText={onChangeText}\n {...rest}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { margin: 23 },\n});\n\nexport default Input;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAiD,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,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,I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_getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
20
20
  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; }
21
21
  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); }
22
22
  const DropdownSelect = _ref => {
23
+ var _extractPropertyFromA, _searchControls$textI;
23
24
  let {
24
25
  placeholder,
25
26
  label,
@@ -73,13 +74,12 @@ const DropdownSelect = _ref => {
73
74
  const [selectedItems, setSelectedItems] = (0, _react.useState)([]); // for multiple selection
74
75
  const [searchValue, setSearchValue] = (0, _react.useState)('');
75
76
  const [listIndex, setListIndex] = (0, _react.useState)({
76
- itemIndex: 0
77
+ itemIndex: 0,
78
+ sectionIndex: 0
77
79
  }); // for scrollToIndex in Sectionlist and Flatlist
78
80
 
79
81
  (0, _react.useEffect)(() => {
80
- if (options) {
81
- setNewOptions(options);
82
- }
82
+ setNewOptions(options);
83
83
  return () => {};
84
84
  }, [options]);
85
85
  (0, _react.useEffect)(() => {
@@ -92,18 +92,18 @@ const DropdownSelect = _ref => {
92
92
  *==========================================*/
93
93
 
94
94
  // check the structure of the new options array to determine if it is a section list or a
95
- const isSectionList = newOptions.some(item => item.title && item.data && Array.isArray(item.data));
95
+ const isSectionList = newOptions === null || newOptions === void 0 ? void 0 : newOptions.some(item => item.title && item.data && Array.isArray(item.data));
96
96
  const ListTypeComponent = isSectionList ? _DropdownSectionList.default : _DropdownFlatList.default;
97
- const modifiedSectionData = (0, _utils.extractPropertyFromArray)(newOptions, 'data').flat();
97
+ const modifiedSectionData = (_extractPropertyFromA = (0, _utils.extractPropertyFromArray)(newOptions, 'data')) === null || _extractPropertyFromA === void 0 ? void 0 : _extractPropertyFromA.flat();
98
98
 
99
99
  /**
100
- *`modifiedOptions` should only be used for computations newOptions remains the default array.
101
- * At this point modifiedOptions now has the same structure for both `FlatList` and `SectionList`
100
+ * `options` is the original array, it never changes. (Do not use except you really need the original array) .
101
+ * `newOptions` is a copy of options but can be mutated by `setNewOptions`, as a result, the value many change.
102
+ * `modifiedOptions` should only be used for computations. It has the same structure for both `FlatList` and `SectionList`
102
103
  */
103
104
  const modifiedOptions = isSectionList ? modifiedSectionData : newOptions;
104
105
  const optLabel = optionLabel || _constants.DEFAULT_OPTION_LABEL;
105
106
  const optValue = optionValue || _constants.DEFAULT_OPTION_VALUE;
106
- const optionsCopy = JSON.parse(JSON.stringify(options)); // copy of the original options array
107
107
 
108
108
  /*===========================================
109
109
  * Selection handlers
@@ -133,14 +133,14 @@ const DropdownSelect = _ref => {
133
133
  });
134
134
  };
135
135
  const removeDisabledItems = items => {
136
- return items.filter(item => !item.disabled);
136
+ return items === null || items === void 0 ? void 0 : items.filter(item => !item.disabled);
137
137
  };
138
138
  const handleSelectAll = () => {
139
139
  setSelectAll(prevVal => {
140
140
  const selectedValues = [];
141
141
 
142
142
  // don't select disabled items
143
- const filteredOptions = removeDisabledItems(isSectionList ? (0, _utils.extractPropertyFromArray)(optionsCopy, 'data').flat() : optionsCopy);
143
+ const filteredOptions = removeDisabledItems(isSectionList ? (0, _utils.extractPropertyFromArray)(options, 'data').flat() : options);
144
144
  if (!prevVal) {
145
145
  for (let i = 0; i < filteredOptions.length; i++) {
146
146
  selectedValues.push(filteredOptions[i][optValue]);
@@ -162,8 +162,9 @@ const DropdownSelect = _ref => {
162
162
  * Handle side effects
163
163
  *==========================================*/
164
164
  const checkSelectAll = (0, _react.useCallback)(selectedValues => {
165
+ var _removeDisabledItems;
165
166
  //if the list contains disabled values, those values will not be selected
166
- if (removeDisabledItems(modifiedOptions).length === selectedValues.length) {
167
+ if (((_removeDisabledItems = removeDisabledItems(modifiedOptions)) === null || _removeDisabledItems === void 0 ? void 0 : _removeDisabledItems.length) === (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length)) {
167
168
  setSelectAll(true);
168
169
  } else {
169
170
  setSelectAll(false);
@@ -203,8 +204,8 @@ const DropdownSelect = _ref => {
203
204
  let searchText = value.toString().toLocaleLowerCase().trim();
204
205
  const regexFilter = new RegExp(searchText, 'i');
205
206
 
206
- // Because the options array will be mutated after Search, we have to search with a copy of the original array
207
- const searchResults = isSectionList ? searchSectionList(optionsCopy, regexFilter) : searchFlatList(optionsCopy, regexFilter);
207
+ // Because the options array will be mutated while searching, we have to search with the original array
208
+ const searchResults = isSectionList ? searchSectionList(options, regexFilter) : searchFlatList(options, regexFilter);
208
209
  setNewOptions(searchResults);
209
210
  };
210
211
  const searchFlatList = (flatList, regexFilter) => {
@@ -253,9 +254,9 @@ const DropdownSelect = _ref => {
253
254
  * setIndexOfSelectedItem - For ScrollToIndex
254
255
  *==========================================*/
255
256
  const setIndexOfSelectedItem = selectedLabel => {
256
- isSectionList ? optionsCopy.map((item, sectionIndex) => {
257
+ isSectionList ? options === null || options === void 0 ? void 0 : options.map((item, sectionIndex) => {
257
258
  var _item$data;
258
- (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.find((dataItem, itemIndex) => {
259
+ item === null || item === void 0 || (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.find((dataItem, itemIndex) => {
259
260
  if (dataItem[optLabel] === selectedLabel) {
260
261
  setListIndex({
261
262
  sectionIndex,
@@ -263,7 +264,7 @@ const DropdownSelect = _ref => {
263
264
  });
264
265
  }
265
266
  });
266
- }) : optionsCopy === null || optionsCopy === void 0 ? void 0 : optionsCopy.find((item, itemIndex) => {
267
+ }) : options === null || options === void 0 ? void 0 : options.find((item, itemIndex) => {
267
268
  if (item[optLabel] === selectedLabel) {
268
269
  setListIndex({
269
270
  itemIndex
@@ -297,19 +298,19 @@ const DropdownSelect = _ref => {
297
298
  setIndexOfSelectedItem: setIndexOfSelectedItem
298
299
  }, rest)), /*#__PURE__*/_react.default.createElement(_CustomModal.default, {
299
300
  open: open,
300
- handleToggleModal: handleToggleModal,
301
301
  modalBackgroundStyle: modalBackgroundStyle,
302
302
  modalOptionsContainerStyle: modalOptionsContainerStyle,
303
- onRequestClose: () => {},
303
+ onRequestClose: () => handleToggleModal(),
304
304
  modalProps: modalProps
305
305
  }, /*#__PURE__*/_react.default.createElement(ListTypeComponent, {
306
- keyboardShouldPersistTaps: "always",
307
306
  ListHeaderComponent: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && /*#__PURE__*/_react.default.createElement(_Input.default, _extends({
308
307
  value: searchValue,
309
308
  onChangeText: text => onSearch(text),
310
- style: (searchControls === null || searchControls === void 0 ? void 0 : searchControls.searchInputStyle) || searchInputStyle,
311
- primaryColor: primary
312
- }, searchControls === null || searchControls === void 0 ? void 0 : searchControls.textInputProps)), listHeaderComponent, isMultiple && modifiedOptions.length > 1 && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
309
+ style: (searchControls === null || searchControls === void 0 ? void 0 : searchControls.textInputStyle) || searchInputStyle,
310
+ primaryColor: primary,
311
+ textInputContainerStyle: searchControls === null || searchControls === void 0 ? void 0 : searchControls.textInputContainerStyle,
312
+ placeholder: (searchControls === null || searchControls === void 0 || (_searchControls$textI = searchControls.textInputProps) === null || _searchControls$textI === void 0 ? void 0 : _searchControls$textI.placeholder) || 'Search'
313
+ }, searchControls === null || searchControls === void 0 ? void 0 : searchControls.textInputProps)), listHeaderComponent, isMultiple && (modifiedOptions === null || modifiedOptions === void 0 ? void 0 : modifiedOptions.length) > 1 && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
313
314
  style: styles.optionsContainerStyle
314
315
  }, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
315
316
  onPress: () => {}