react-native-input-select 1.1.1 → 1.1.2

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 (36) hide show
  1. package/lib/commonjs/components/CheckBox/index.js +17 -7
  2. package/lib/commonjs/components/CheckBox/index.js.map +1 -1
  3. package/lib/commonjs/components/Dropdown/Dropdown.js +4 -2
  4. package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
  5. package/lib/commonjs/components/Dropdown/DropdownFlatList.js +29 -4
  6. package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
  7. package/lib/commonjs/components/Dropdown/DropdownSectionList.js +25 -1
  8. package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
  9. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js +41 -9
  10. package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  11. package/lib/commonjs/index.js +60 -15
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/module/components/CheckBox/index.js +17 -6
  14. package/lib/module/components/CheckBox/index.js.map +1 -1
  15. package/lib/module/components/Dropdown/Dropdown.js +4 -2
  16. package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
  17. package/lib/module/components/Dropdown/DropdownFlatList.js +27 -4
  18. package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
  19. package/lib/module/components/Dropdown/DropdownSectionList.js +26 -2
  20. package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
  21. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js +42 -10
  22. package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +1 -1
  23. package/lib/module/index.js +61 -16
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/typescript/components/CheckBox/index.d.ts +16 -4
  26. package/lib/typescript/components/Dropdown/Dropdown.d.ts +1 -1
  27. package/lib/typescript/components/Dropdown/DropdownFlatList.d.ts +1 -1
  28. package/lib/typescript/components/Dropdown/DropdownSectionList.d.ts +1 -1
  29. package/lib/typescript/components/Dropdown/DropdownSelectedItemsView.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/src/components/CheckBox/index.tsx +17 -6
  32. package/src/components/Dropdown/Dropdown.tsx +3 -0
  33. package/src/components/Dropdown/DropdownFlatList.tsx +24 -1
  34. package/src/components/Dropdown/DropdownSectionList.tsx +27 -1
  35. package/src/components/Dropdown/DropdownSelectedItemsView.tsx +32 -13
  36. package/src/index.tsx +61 -18
@@ -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
- *`checkboxSize`, `checkboxStyle`,`checkboxLabelStyle` Will be deleted in version 1.0.
17
- * and replaced with `checkboxComponentStyles`
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;
@@ -31,7 +41,7 @@ const CheckBox = _ref => {
31
41
  onChange
32
42
  } = _ref;
33
43
  // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =
34
- // checkboxComponentStyles;
44
+ // checkboxComponentStyles || undefined;
35
45
  const fillColor = {
36
46
  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
47
  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
@@ -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":["/* eslint-disable react-native/no-inline-styles */\nimport 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 *\n *`checkboxSize`, `checkboxStyle`,`checkboxLabelStyle` Will be deleted in version 1.0.\n * and replaced with `checkboxComponentStyles`\n */\n\nconst CheckBox = ({\n label,\n value,\n disabled,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n onChange,\n}: CheckboxProps) => {\n // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =\n // checkboxComponentStyles;\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 style={[styles.checkbox, checkboxStyle, fillColor]}>\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 </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":";;;;;;AACA,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;AAJhD;;AAOA;AACA;AACA;AACA;AACA;;AAEA,MAAMG,QAAQ,GAAGC,IAAA,IAUI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAVH;IAChBC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IAC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vBA,uBAAuB,CAAEH,YAAY,KACrCA,YAAY,IACZoB,wBAAa;MACfC,KAAK,EACH,CAAAlB,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEH,YAAY,KACrCA,YAAY,IACZoB;IACJ,CAAC;EACD,CACH,CACG,CAAC,EACNxB,KAAK,iBACJb,MAAA,CAAAQ,OAAA,CAAAoB,aAAA,CAACzB,YAAA,CAAAoC,IAAI;IACHR,KAAK,EAAE,CACL,CAAAX,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAED,kBAAkB,KAAIA,kBAAkB,EACjEO,MAAM,CAACc,UAAU;EACjB,GAED3B,KACG,CAEC,CAAC;AAEhB,CAAC;AAED,MAAMa,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,GAEY1C,QAAQ;AAAA2C,OAAA,CAAA5C,OAAA,GAAA2C,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","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 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 style={[styles.checkbox, checkboxStyle, fillColor]}>\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 </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,IAUI;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAVH;IAChBC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC;EACa,CAAC,GAAAX,IAAA;EACd;EACA;EACA,MAAMY,SAAS,GAAG;IAChBC,eAAe,EAAER,QAAQ,GACrB,SAAS,GACTD,KAAK,GACL,CAAAM,uBAAuB,aAAvBA,uBAAuB,gBAAAT,qBAAA,GAAvBS,uBAAuB,CAAEF,aAAa,cAAAP,qBAAA,uBAAtCA,qBAAA,CAAwCY,eAAe,MACvDL,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEK,eAAe,KAC9BP,YAAY,IACZ,OAAO,GACP,OAAO;IACXQ,WAAW,EAAET,QAAQ,GACjBU,cAAM,CAACV,QAAQ,GACf,CAAAK,uBAAuB,aAAvBA,uBAAuB,gBAAAR,sBAAA,GAAvBQ,uBAAuB,CAAEF,aAAa,cAAAN,sB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,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,GAEY1C,QAAQ;AAAA2C,OAAA,CAAA5C,OAAA,GAAA2C,QAAA"}
@@ -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,IAuBN;EAAA,IAvBO;IAChBC,KAAK;IACLC,WAAW;IACXC,UAAU;IACVC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,UAAU;IACVC,aAAa;IACbC,iBAAiB;IACjBC,sBAAsB;IACtBC,iBAAiB;IACjBC,gBAAgB;IAChBC,yBAAyB;IACzBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,YAAY;IACZC;EACG,CAAC,GAAAtB,IAAA;EACJ,oBACEX,MAAA,CAAAS,OAAA,CAAAyB,aAAA,CAAC/B,YAAA,CAAAgC,IAAI;IAACC,KAAK,EAAE,CAACC,MAAM,CAACC,sBAAsB,EAAEb,sBAAsB;EAAE,GAClEb,KAAK,IAAIA,KAAK,KAAK,EAAE,iBACpBZ,MAAA,CAAAS,OAAA,CAAAyB,aAAA,CAAC/B,YAAA,CAAAoC,IAAI;IAACH,KAAK,EAAE,CAACC,MAAM,CAACzB,KAAK,EAAEU,UAAU;EAAE,GAAEV,KAAY,CACvD,eACDZ,MAAA,CAAAS,OAAA,CAAAyB,aAAA,CAAC9B,0BAAA,CAAAK,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U,SAAS,EAAE,CAAC;IAAEN,KAAK,EAAEC,cAAM,CAACM,OAAO;IAAE,GAAGJ,sBAAU,CAACC;EAAQ,CAAC;EACtEV,sBAAsB,EAAE;IAAEK,YAAY,EAAE,EAAE;IAAES,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAET,KAAK,EAAEC,cAAM,CAACS;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY7C,QAAQ;AAAA8C,OAAA,CAAA/C,OAAA,GAAA8C,QAAA"}
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,GAAA;AAErD,MAAMG,QAAQ,GAAGC,IAAA,IAwBN;EAAA,IAxBO;IAChBC,KAAK;IACLC,WAAW;IACXC,UAAU;IACVC,KAAK;IACLC,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BACpBf,MAAA,CAAAS,OAAA,CAAA0B,aAAA,CAAChC,YAAA,CAAAqC,IAAI;IAACH,KAAK,EAAE,CAACC,MAAM,CAACvB,KAAK,EAAEe,sBAAsB;EAAE,GAAEf,KAAY,CACnE,EAEAD,UAAU,IAAIA,UAAU,KAAK,EAAE,IAAI,CAACC,KAAK,iBACxCf,MAAA,CAAAS,OAAA,CAAA0B,aAAA,CAAChC,YAAA,CAAAqC,IAAI;IAACH,KAAK,EAAE,CAACC,MAAM,CAACG,MAAM,EAAEV,uBAAuB;EAAE,GACnDjB,UACG,CAEJ,CAAC;AAEX,CAAC;AAED,MAAMwB,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/B/B,KAAK,EAAE;IAAEgC,YAAY,EAAE,EAAE;IAAEC,KAAK,EAAEC,cAAM,CAACC,IAAI;IAAE,GAAGC,sBAAU,CAACC;EAAQ,CAAC;EACtElC,KAAK,EAAE;IAAE8B,KAAK,EAAEC,cAAM,CAACI,GAAG;IAAEC,SAAS,EAAE,CAAC;IAAE,GAAGH,sBAAU,CAACC;EAAQ,CAAC;EACjER,MAAM,EAAE;IAAEU,SAAS,EAAE,CAAC;IAAEN,KAAK,EAAEC,cAAM,CAACM,OAAO;IAAE,GAAGJ,sBAAU,CAACC;EAAQ,CAAC;EACtEV,sBAAsB,EAAE;IAAEK,YAAY,EAAE,EAAE;IAAES,KAAK,EAAE;EAAO,CAAC;EAC3DC,SAAS,EAAE;IAAET,KAAK,EAAEC,cAAM,CAACS;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEY9C,QAAQ;AAAA+C,OAAA,CAAAhD,OAAA,GAAA+C,QAAA"}
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("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 {
@@ -30,8 +32,20 @@ const DropdownFlatList = _ref => {
30
32
  // kept for backwards compatibility to be removed in future release
31
33
  checkboxComponentStyles,
32
34
  listComponentStyles,
35
+ listIndex,
33
36
  ...rest
34
37
  } = _ref;
38
+ const flatlistRef = (0, _react.useRef)(null);
39
+ const scrollToItem = index => {
40
+ var _flatlistRef$current;
41
+ (_flatlistRef$current = flatlistRef.current) === null || _flatlistRef$current === void 0 ? void 0 : _flatlistRef$current.scrollToIndex({
42
+ index,
43
+ animated: true
44
+ });
45
+ };
46
+ (0, _react.useEffect)(() => {
47
+ scrollToItem(listIndex.itemIndex);
48
+ }, [listIndex]);
35
49
  return /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, _extends({
36
50
  data: options,
37
51
  extraData: isMultiple ? selectedItems : selectedItem,
@@ -51,6 +65,7 @@ const DropdownFlatList = _ref => {
51
65
  isMultiple,
52
66
  selectedOption: isMultiple ? selectedItems : selectedItem,
53
67
  onChange: isMultiple ? handleMultipleSelections : handleSingleSelection,
68
+ scrollToItem,
54
69
  primaryColor,
55
70
  checkboxSize,
56
71
  // kept for backwards compatibility
@@ -60,13 +75,22 @@ const DropdownFlatList = _ref => {
60
75
  // kept for backwards compatibility
61
76
  checkboxComponentStyles
62
77
  }),
63
- keyExtractor: (_item, index) => `Options${index}`
78
+ keyExtractor: (_item, index) => `Options${index}`,
79
+ ref: flatlistRef,
80
+ onScrollToIndexFailed: _ref2 => {
81
+ let {
82
+ index
83
+ } = _ref2;
84
+ setTimeout(() => {
85
+ scrollToItem(index);
86
+ }, 500);
87
+ }
64
88
  }, rest));
65
89
  };
66
- const _renderItem = (_ref2, props) => {
90
+ const _renderItem = (_ref3, props) => {
67
91
  let {
68
92
  item
69
- } = _ref2;
93
+ } = _ref3;
70
94
  return /*#__PURE__*/_react.default.createElement(_DropdownListItem.default, {
71
95
  item: item,
72
96
  optionLabel: props.optionLabel,
@@ -78,6 +102,7 @@ const _renderItem = (_ref2, props) => {
78
102
  checkboxSize: props.checkboxSize,
79
103
  checkboxStyle: props.checkboxStyle,
80
104
  checkboxLabelStyle: props.checkboxLabelStyle,
105
+ scrollToItem: props.scrollToItem,
81
106
  checkboxComponentStyles: props.checkboxComponentStyles
82
107
  });
83
108
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_DropdownListItem","_Others","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","rest","createElement","FlatList","data","extraData","initialNumToRender","ListEmptyComponent","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","ItemSeparatorComponent","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","index","_ref2","props","StyleSheet","create","_default","exports"],"sources":["DropdownFlatList.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport React from 'react';\nimport { FlatList, StyleSheet } from 'react-native';\nimport DropdownListItem from './DropdownListItem';\nimport { ItemSeparatorComponent, ListEmptyComponent } from '../Others';\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 listComponentStyles,\n ...rest\n}: any) => {\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 primaryColor,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n })\n }\n keyExtractor={(_item, index) => `Options${index}`}\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 checkboxComponentStyles={props.checkboxComponentStyles}\n />\n );\n};\n\nconst styles = StyleSheet.create({\n contentContainerStyle: { paddingTop: 20 },\n});\n\nexport default DropdownFlatList;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAAuE,SAAAD,uBAAAK,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,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAJ,MAAA,EAAAC,GAAA,KAAAL,MAAA,CAAAK,GAAA,IAAAD,MAAA,CAAAC,GAAA,gBAAAL,MAAA,YAAAJ,QAAA,CAAAa,KAAA,OAAAP,SAAA,KAJvE;AAMA,MAAMQ,gBAAgB,GAAGC,IAAA,IAiBd;EAAA,IAjBe;IACxBC,OAAO;IACPC,WAAW;I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EA,CAACC,KAAK,EAAEC,KAAK,KAAM,UAASA,KAAM;EAAE,GAC9CpB,IAAI,CACT,CAAC;AAEN,CAAC;AAED,MAAMe,WAAW,GAAGA,CAAAM,KAAA,EAAgBC,KAAU,KAAK;EAAA,IAA9B;IAAER;EAAU,CAAC,GAAAO,KAAA;EAChC,oBACE7D,MAAA,CAAAQ,OAAA,CAAAiC,aAAA,CAACrC,iBAAA,CAAAI,OAAgB;IACf8C,IAAI,EAAEA,IAAK;IACX5B,WAAW,EAAEoC,KAAK,CAACpC,WAAY;IAC/BC,WAAW,EAAEmC,KAAK,CAACnC,WAAY;IAC/BC,UAAU,EAAEkC,KAAK,CAAClC,UAAW;IAC7B4B,cAAc,EAAEM,KAAK,CAACN,cAAe;IACrCC,QAAQ,EAAEK,KAAK,CAACL,QAAS;IACzBvB,YAAY,EAAE4B,KAAK,CAAC5B,YAAa;IACjCC,YAAY,EAAE2B,KAAK,CAAC3B,YAAa;IACjCC,aAAa,EAAE0B,KAAK,CAAC1B,aAAc;IACnCC,kBAAkB,EAAEyB,KAAK,CAACzB,kBAAmB;IAC7CC,uBAAuB,EAAEwB,KAAK,CAACxB;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAMY,MAAM,GAAGa,uBAAU,CAACC,MAAM,CAAC;EAC/BhB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAAC,IAAAgB,QAAA,GAEY1C,gBAAgB;AAAA2C,OAAA,CAAA1D,OAAA,GAAAyD,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","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 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 })\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 />\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,Y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D,KAAK,CAAClD,WAAY;IAC/BC,WAAW,EAAEiD,KAAK,CAACjD,WAAY;IAC/BC,UAAU,EAAEgD,KAAK,CAAChD,UAAW;IAC7BuC,cAAc,EAAES,KAAK,CAACT,cAAe;IACrCC,QAAQ,EAAEQ,KAAK,CAACR,QAAS;IACzBlC,YAAY,EAAE0C,KAAK,CAAC1C,YAAa;IACjCC,YAAY,EAAEyC,KAAK,CAACzC,YAAa;IACjCC,aAAa,EAAEwC,KAAK,CAACxC,aAAc;IACnCC,kBAAkB,EAAEuC,KAAK,CAACvC,kBAAmB;IAC7CO,YAAY,EAAEgC,KAAK,CAAChC,YAAa;IACjCN,uBAAuB,EAAEsC,KAAK,CAACtC;EAAwB,CACxD,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,GAEYxD,gBAAgB;AAAAyD,OAAA,CAAAtF,OAAA,GAAAqF,QAAA"}
@@ -30,6 +30,7 @@ const DropdownSectionList = _ref => {
30
30
  checkboxLabelStyle,
31
31
  checkboxComponentStyles,
32
32
  listComponentStyles,
33
+ listIndex,
33
34
  ...rest
34
35
  } = _ref;
35
36
  const [expandedSections, setExpandedSections] = (0, _react.useState)(new Set());
@@ -57,6 +58,23 @@ const DropdownSectionList = _ref => {
57
58
  return next;
58
59
  });
59
60
  };
61
+
62
+ /**
63
+ * @description Scroll to item location
64
+ */
65
+
66
+ const sectionlistRef = (0, _react.useRef)(null);
67
+ const scrollToLocation = listIndex => {
68
+ var _sectionlistRef$curre;
69
+ (_sectionlistRef$curre = sectionlistRef.current) === null || _sectionlistRef$curre === void 0 ? void 0 : _sectionlistRef$curre.scrollToLocation({
70
+ sectionIndex: listIndex.sectionIndex,
71
+ animated: true,
72
+ itemIndex: listIndex.itemIndex
73
+ });
74
+ };
75
+ (0, _react.useEffect)(() => {
76
+ scrollToLocation(listIndex);
77
+ }, [listIndex]);
60
78
  return /*#__PURE__*/_react.default.createElement(_reactNative.SectionList, _extends({
61
79
  sections: options,
62
80
  extraData: isMultiple ? selectedItems : selectedItem,
@@ -101,7 +119,13 @@ const DropdownSectionList = _ref => {
101
119
  });
102
120
  },
103
121
  keyExtractor: (_item, index) => `Options${index}`,
104
- stickySectionHeadersEnabled: false
122
+ stickySectionHeadersEnabled: false,
123
+ ref: sectionlistRef,
124
+ onScrollToIndexFailed: () => {
125
+ setTimeout(() => {
126
+ scrollToLocation(listIndex);
127
+ }, 500);
128
+ }
105
129
  }, rest));
106
130
  };
107
131
  const _renderItem = (_ref3, props) => {
@@ -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,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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","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 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 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 />\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,IAA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AAC3E,iBAAA,CAAAM,OAAgB;IACfkF,IAAI,EAAEA,IAAK;IACXlD,WAAW,EAAEsE,KAAK,CAACtE,WAAY;IAC/BC,WAAW,EAAEqE,KAAK,CAACrE,WAAY;IAC/BC,UAAU,EAAEoE,KAAK,CAACpE,UAAW;IAC7BkD,cAAc,EAAEkB,KAAK,CAAClB,cAAe;IACrCC,QAAQ,EAAEiB,KAAK,CAACjB,QAAS;IACzB7C,YAAY,EAAE8D,KAAK,CAAC9D,YAAa;IACjCC,YAAY,EAAE6D,KAAK,CAAC7D,YAAa;IACjCC,aAAa,EAAE4D,KAAK,CAAC5D,aAAc;IACnCC,kBAAkB,EAAE2D,KAAK,CAAC3D,kBAAmB;IAC7CC,uBAAuB,EAAE0D,KAAK,CAAC1D;EAAwB,CACxD,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,GAEY5E,mBAAmB;AAAA6E,OAAA,CAAA1G,OAAA,GAAAyG,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
- }, _input.inputStyles.input, dropdownStyle, error &&
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((item, i) => /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
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
- }, item)) : /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
62
- style: [styles.blackText, selectedItemStyle]
63
- }, getSelectedItemsLabel()), !selectedItem && (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) === 0 && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
64
- style: [styles.blackText, placeholderStyle]
65
- }, placeholder ?? 'Select an option'))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
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',
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_input","obj","__esModule","default","DropdownSelectedItemsView","_ref","_getSelectedItemsLabe","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","dropdownStyle","dropdownIconStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","createElement","Pressable","onPress","style","_ref2","pressed","inputStyles","inputFocusState","borderColor","input","inputFocusErrorState","ScrollView","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","View","styles","selectedItemsContainer","onStartShouldSetResponder","map","item","i","Text","key","Math","random","backgroundColor","blackText","length","iconStyle","Image","source","StyleSheet","create","position","right","top","flexDirection","flexWrap","alignItems","color","colors","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black","_default","exports"],"sources":["DropdownSelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { inputStyles } from '../../styles/input';\n\nconst DropdownSelectedItemsView = ({\n placeholder,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n dropdownStyle,\n dropdownIconStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n primaryColor,\n disabled,\n}: any) => {\n return (\n <Pressable\n onPress={() => handleToggleModal()}\n style={({ pressed }) => [\n pressed && {\n ...inputStyles.inputFocusState,\n borderColor: primaryColor,\n },\n inputStyles.input,\n dropdownStyle,\n error && //this must be last\n error !== '' &&\n !pressed && {\n ...inputStyles.inputFocusErrorState,\n ...dropdownErrorStyle,\n },\n ]}\n disabled={disabled}\n >\n <ScrollView\n horizontal\n alwaysBounceHorizontal\n showsHorizontalScrollIndicator={false}\n >\n <View\n style={styles.selectedItemsContainer}\n onStartShouldSetResponder={() => true}\n >\n {isMultiple ? (\n getSelectedItemsLabel()?.map((item: any, i: Number) => (\n <Text\n key={`react-native-input-select-${Math.random()}-${i}`}\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n >\n {item}\n </Text>\n ))\n ) : (\n <Text style={[styles.blackText, selectedItemStyle]}>\n {getSelectedItemsLabel()}\n </Text>\n )}\n {!selectedItem && selectedItems?.length === 0 && (\n <Text style={[styles.blackText, placeholderStyle]}>\n {placeholder ?? 'Select an option'}\n </Text>\n )}\n </View>\n </ScrollView>\n <View style={[styles.iconStyle, dropdownIconStyle]}>\n {dropdownIcon || (\n <Image source={require('../../asset/arrow-down.png')} />\n )}\n </View>\n </Pressable>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n selectedItems: {\n color: colors.white,\n paddingHorizontal: 10,\n paddingVertical: 5,\n borderRadius: 10,\n backgroundColor: colors.primary,\n marginRight: 10,\n overflow: 'hidden',\n },\n blackText: { color: colors.black },\n});\n\nexport default DropdownSelectedItemsView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjD,MAAMG,yBAAyB,GAAGC,IAAA,IAiBvB;EAAA,IAAAC,qBAAA;EAAA,IAjBwB;IACjCC,WAAW;IACXC,KAAK;IACLC,qBAAqB;IACrBC,iBAAiB;IACjBC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,aAAa;IACbC,iBAAiB;IACjBC,iBAAiB;IACjBC,gBAAgB;IAChBC,yBAAyB;IACzBC,kBAAkB;IAClBC,YAAY;IACZC;EACG,CAAC,GAAAjB,IAAA;EACJ,oBACEV,MAAA,CAAAQ,OAAA,CAAAoB,aAAA,CAACzB,YAAA,CAAA0B,SAAS;IACRC,OAAO,EAAEA,CAAA,KAAMf,iBAAiB,CAAC,CAAE;IACnCgB,KAAK,EAAEC,KAAA;MAAA,IAAC;QAAEC;MAAQ,CAAC,GAAAD,KAAA;MAAA,OAAK,CACtBC,OAAO,IAAI;QACT,GAAGC,kBAAW,CA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AAAQ,OAAA,CAAAoB,aAAA,CAACzB,YAAA,CAAA+C,IAAI;IAACnB,KAAK,EAAE,CAACa,MAAM,CAACW,SAAS,EAAEhC,gBAAgB;EAAE,GAC/CX,WAAW,IAAI,kBACZ,CAEJ,CACI,CAAC,eACbZ,MAAA,CAAAQ,OAAA,CAAAoB,aAAA,CAACzB,YAAA,CAAAwC,IAAI;IAACZ,KAAK,EAAE,CAACa,MAAM,CAACa,SAAS,EAAEpC,iBAAiB;EAAE,GAChDF,YAAY,iBACXnB,MAAA,CAAAQ,OAAA,CAAAoB,aAAA,CAACzB,YAAA,CAAAuD,KAAK;IAACC,MAAM,EAAEzD,OAAO,CAAC,4BAA4B;EAAE,CAAE,CAErD,CACG,CAAC;AAEhB,CAAC;AAED,MAAM0C,MAAM,GAAGgB,uBAAU,CAACC,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IAAEK,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE,EAAE;IAAEC,GAAG,EAAE;EAAG,CAAC;EACvDnB,sBAAsB,EAAE;IACtBoB,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDjD,aAAa,EAAE;IACbkD,KAAK,EAAEC,cAAM,CAACC,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBnB,eAAe,EAAEe,cAAM,CAACK,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDrB,SAAS,EAAE;IAAEa,KAAK,EAAEC,cAAM,CAACQ;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAEYrE,yBAAyB;AAAAsE,OAAA,CAAAvE,OAAA,GAAAsE,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_input","obj","__esModule","default","_extends","Object","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","DropdownSelectedItemsView","_ref","_getSelectedItemsLabe","placeholder","error","getSelectedItemsLabel","handleToggleModal","isMultiple","selectedItem","selectedItems","dropdownIcon","dropdownStyle","dropdownIconStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","setIndexOfSelectedItem","createElement","Pressable","onPress","style","_ref2","pressed","inputStyles","inputFocusState","borderColor","input","inputFocusErrorState","ScrollView","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","View","styles","selectedItemsContainer","onStartShouldSetResponder","map","label","DropdownContent","Math","random","backgroundColor","blackText","iconStyle","Image","_ref3","rest","TouchableOpacity","Text","StyleSheet","create","position","right","top","flexDirection","flexWrap","alignItems","color","colors","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black","_default","exports"],"sources":["DropdownSelectedItemsView.tsx"],"sourcesContent":["import React from 'react';\nimport {\n View,\n Text,\n Pressable,\n ScrollView,\n StyleSheet,\n Image,\n TouchableOpacity,\n} from 'react-native';\nimport { colors } from '../../styles/colors';\nimport { inputStyles } from '../../styles/input';\n\nconst DropdownSelectedItemsView = ({\n placeholder,\n error,\n getSelectedItemsLabel,\n handleToggleModal,\n isMultiple,\n selectedItem,\n selectedItems,\n dropdownIcon,\n dropdownStyle,\n dropdownIconStyle,\n selectedItemStyle,\n placeholderStyle,\n multipleSelectedItemStyle,\n dropdownErrorStyle,\n primaryColor,\n disabled,\n setIndexOfSelectedItem,\n}: any) => {\n return (\n <Pressable\n onPress={() => handleToggleModal()}\n style={({ pressed }) => [\n pressed && {\n ...inputStyles.inputFocusState,\n borderColor: primaryColor,\n },\n { ...inputStyles.input, ...dropdownStyle },\n error && //this must be last\n error !== '' &&\n !pressed && {\n ...inputStyles.inputFocusErrorState,\n ...dropdownErrorStyle,\n },\n ]}\n disabled={disabled}\n >\n <ScrollView\n horizontal\n alwaysBounceHorizontal\n showsHorizontalScrollIndicator={false}\n >\n <View\n style={styles.selectedItemsContainer}\n onStartShouldSetResponder={() => true}\n >\n {isMultiple ? (\n getSelectedItemsLabel()?.map((label: string, i: Number) => (\n <DropdownContent\n onPress={() => {\n handleToggleModal();\n setIndexOfSelectedItem(label); // immediately scrolls to list item with the specified label when modal\n }}\n key={`react-native-input-select-${Math.random()}-${i}`}\n style={[\n styles.selectedItems,\n { backgroundColor: primaryColor },\n multipleSelectedItemStyle,\n ]}\n label={label}\n />\n ))\n ) : (\n <DropdownContent\n onPress={() => {\n handleToggleModal();\n setIndexOfSelectedItem(getSelectedItemsLabel()); // immediately scrolls to list item with the specified label when modal\n }}\n style={[styles.blackText, selectedItemStyle]}\n label={getSelectedItemsLabel()}\n />\n )}\n {!selectedItem && selectedItems?.length === 0 && (\n <DropdownContent\n onPress={() => handleToggleModal()}\n style={[styles.blackText, placeholderStyle]}\n label={placeholder ?? 'Select an option'}\n />\n )}\n </View>\n </ScrollView>\n <View style={[styles.iconStyle, dropdownIconStyle]}>\n {dropdownIcon || (\n <Image source={require('../../asset/arrow-down.png')} />\n )}\n </View>\n </Pressable>\n );\n};\n\nconst DropdownContent = ({ onPress, style, label, ...rest }: any) => {\n return (\n <TouchableOpacity onPress={() => onPress()} {...rest}>\n <Text style={style}>{label}</Text>\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n iconStyle: { position: 'absolute', right: 25, top: 25 },\n selectedItemsContainer: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n },\n selectedItems: {\n color: colors.white,\n paddingHorizontal: 10,\n paddingVertical: 5,\n borderRadius: 10,\n backgroundColor: colors.primary,\n marginRight: 10,\n overflow: 'hidden',\n },\n blackText: { color: colors.black },\n});\n\nexport default DropdownSelectedItemsView;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD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