react-native-input-select 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +18 -0
  2. package/lib/commonjs/components/CheckBox/index.js +3 -2
  3. package/lib/commonjs/components/CheckBox/index.js.map +1 -1
  4. package/lib/commonjs/components/CheckBox/types.js.map +1 -1
  5. package/lib/commonjs/components/Dropdown/DropdownFlatList.js +5 -2
  6. package/lib/commonjs/components/Dropdown/DropdownFlatList.js.map +1 -1
  7. package/lib/commonjs/components/Dropdown/DropdownListItem.js +4 -2
  8. package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +1 -1
  9. package/lib/commonjs/components/Dropdown/DropdownSectionList.js +4 -1
  10. package/lib/commonjs/components/Dropdown/DropdownSectionList.js.map +1 -1
  11. package/lib/commonjs/index.js +4 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/types/index.types.js.map +1 -1
  14. package/lib/module/components/CheckBox/index.js +3 -2
  15. package/lib/module/components/CheckBox/index.js.map +1 -1
  16. package/lib/module/components/CheckBox/types.js.map +1 -1
  17. package/lib/module/components/Dropdown/DropdownFlatList.js +5 -2
  18. package/lib/module/components/Dropdown/DropdownFlatList.js.map +1 -1
  19. package/lib/module/components/Dropdown/DropdownListItem.js +4 -2
  20. package/lib/module/components/Dropdown/DropdownListItem.js.map +1 -1
  21. package/lib/module/components/Dropdown/DropdownSectionList.js +4 -1
  22. package/lib/module/components/Dropdown/DropdownSectionList.js.map +1 -1
  23. package/lib/module/index.js +4 -1
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/types/index.types.js.map +1 -1
  26. package/lib/typescript/components/CheckBox/index.d.ts +1 -1
  27. package/lib/typescript/components/CheckBox/types.d.ts +2 -0
  28. package/lib/typescript/components/Dropdown/DropdownFlatList.d.ts +1 -1
  29. package/lib/typescript/components/Dropdown/DropdownListItem.d.ts +1 -1
  30. package/lib/typescript/components/Dropdown/DropdownSectionList.d.ts +1 -1
  31. package/lib/typescript/types/index.types.d.ts +1 -0
  32. package/package.json +2 -2
  33. package/src/components/CheckBox/index.tsx +25 -16
  34. package/src/components/CheckBox/types.ts +2 -0
  35. package/src/components/Dropdown/DropdownFlatList.tsx +3 -0
  36. package/src/components/Dropdown/DropdownListItem.tsx +2 -0
  37. package/src/components/Dropdown/DropdownSectionList.tsx +3 -0
  38. package/src/index.tsx +3 -0
  39. package/src/types/index.types.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useRef","FlatList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","listIndex","rest","flatlistRef","scrollToItem","index","_flatlistRef$current","current","scrollToIndex","animated","itemIndex","createElement","_extends","data","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","ref","onScrollToIndexFailed","_ref2","setTimeout","_ref3","props","create"],"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":";AAAA;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c,EAAES,KAAK,CAACT,cAAe;IACrCC,QAAQ,EAAEQ,KAAK,CAACR,QAAS;IACzB9B,YAAY,EAAEsC,KAAK,CAACtC,YAAa;IACjCC,YAAY,EAAEqC,KAAK,CAACrC,YAAa;IACjCC,aAAa,EAAEoC,KAAK,CAACpC,aAAc;IACnCC,kBAAkB,EAAEmC,KAAK,CAACnC,kBAAmB;IAC7CM,YAAY,EAAE6B,KAAK,CAAC7B,YAAa;IACjCL,uBAAuB,EAAEkC,KAAK,CAAClC;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAMoB,MAAM,GAAGvC,UAAU,CAACsD,MAAM,CAAC;EAC/BjB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAelC,gBAAgB"}
1
+ {"version":3,"names":["React","useEffect","useRef","FlatList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","DropdownFlatList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","flatlistRef","scrollToItem","index","_flatlistRef$current","current","scrollToIndex","animated","itemIndex","createElement","_extends","data","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","keyExtractor","_item","ref","onScrollToIndexFailed","_ref2","setTimeout","_ref3","props","create"],"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":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ,WAAW;AAGtE,MAAMC,gBAAgB,GAAGC,IAAA,IAmBd;EAAA,IAnBe;IACxBC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IAAE;IACdC,aAAa;IAAE;IACfC,kBAAkB;IAAE;IACpBC,uBAAuB;IACvBC,iBAAiB;IACjBC,mBAAmB;IACnBC,SAAS;IACT,GAAGC;EACA,CAAC,GAAAlB,IAAA;EACJ,MAAMmB,WAAW,GAAG1B,MAAM,CAAsB,IAAI,CAAC;EAErD,MAAM2B,YAAY,GAAIC,KAAa,IAAK;IAAA,IAAAC,oBAAA;IACtC,CAAAA,oBAAA,GAAAH,WAAW,CAACI,OAAO,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,aAAa,CAAC;MACjCH,KAAK;MACLI,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ,CAAC;EAEDjC,SAAS,CAAC,MAAM;IACd4B,YAAY,CAACH,SAAS,CAACS,SAAS,CAAC;EACnC,CAAC,EAAE,CAACT,SAAS,CAAC,CAAC;EAEf,oBACE1B,KAAA,CAAAoC,aAAA,CAACjC,QAAQ,EAAAkC,QAAA;IACPC,IAAI,EAAE5B,O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AA,IAA9B;IAAEX;EAAU,CAAC,GAAAU,KAAA;EAChC,oBACEzD,KAAA,CAAAoC,aAAA,CAAC/B,gBAAgB;IACf0C,IAAI,EAAEA,IAAK;IACXpC,WAAW,EAAE+C,KAAK,CAAC/C,WAAY;IAC/BC,WAAW,EAAE8C,KAAK,CAAC9C,WAAY;IAC/BC,UAAU,EAAE6C,KAAK,CAAC7C,UAAW;IAC7BoC,cAAc,EAAES,KAAK,CAACT,cAAe;IACrCC,QAAQ,EAAEQ,KAAK,CAACR,QAAS;IACzB/B,YAAY,EAAEuC,KAAK,CAACvC,YAAa;IACjCC,YAAY,EAAEsC,KAAK,CAACtC,YAAa;IACjCC,aAAa,EAAEqC,KAAK,CAACrC,aAAc;IACnCC,kBAAkB,EAAEoC,KAAK,CAACpC,kBAAmB;IAC7CO,YAAY,EAAE6B,KAAK,CAAC7B,YAAa;IACjCN,uBAAuB,EAAEmC,KAAK,CAACnC,uBAAwB;IACvDC,iBAAiB,EAAEkC,KAAK,CAAClC;EAAkB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAMoB,MAAM,GAAGxC,UAAU,CAACuD,MAAM,CAAC;EAC/BjB,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAenC,gBAAgB"}
@@ -13,7 +13,8 @@ const DropdownListItem = _ref => {
13
13
  checkboxSize,
14
14
  checkboxStyle,
15
15
  checkboxLabelStyle,
16
- checkboxComponentStyles
16
+ checkboxComponentStyles,
17
+ checkboxComponent
17
18
  } = _ref;
18
19
  return /*#__PURE__*/React.createElement(TouchableOpacity, {
19
20
  style: styles.listItemContainerStyle,
@@ -26,7 +27,8 @@ const DropdownListItem = _ref => {
26
27
  checkboxSize: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxSize) || checkboxSize,
27
28
  checkboxStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxStyle) || checkboxStyle,
28
29
  checkboxLabelStyle: (checkboxComponentStyles === null || checkboxComponentStyles === void 0 ? void 0 : checkboxComponentStyles.checkboxLabelStyle) || checkboxLabelStyle,
29
- disabled: item.disabled
30
+ disabled: item.disabled,
31
+ checkboxComponent: checkboxComponent
30
32
  }));
31
33
  };
32
34
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","createElement","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\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A,kBAChD;IACDO,QAAQ,EAAEhB,IAAI,CAACgB;EAAS,CACzB,CACe,CAAC;AAEvB,CAAC;AAED,MAAMH,MAAM,GAAGjB,UAAU,CAACwB,MAAM,CAAC;EAC/BN,sBAAsB,EAAE;IACtBO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe9B,IAAI,CAACI,gBAAgB,CAAC"}
1
+ {"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","_ref","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","createElement","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sources":["DropdownListItem.tsx"],"sourcesContent":["import React, { memo } from 'react';\nimport { TouchableOpacity, StyleSheet } from 'react-native';\nimport CheckBox from '../CheckBox';\n\nconst DropdownListItem = ({\n item,\n optionLabel,\n optionValue,\n isMultiple,\n selectedOption,\n onChange,\n primaryColor,\n checkboxSize,\n checkboxStyle,\n checkboxLabelStyle,\n checkboxComponentStyles,\n checkboxComponent,\n}: any) => {\n return (\n <TouchableOpacity\n style={styles.listItemContainerStyle}\n onPress={\n item.disabled ? () => {} : () => onChange(item[optionValue]) // intentionally didn't use the disable property\n }\n >\n <CheckBox\n value={\n isMultiple\n ? selectedOption.includes(item[optionValue])\n : [selectedOption].includes(item[optionValue])\n }\n label={item[optionLabel]}\n onChange={() => onChange(item[optionValue])}\n primaryColor={primaryColor}\n checkboxSize={checkboxComponentStyles?.checkboxSize || checkboxSize}\n checkboxStyle={checkboxComponentStyles?.checkboxStyle || checkboxStyle}\n checkboxLabelStyle={\n checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle\n }\n disabled={item.disabled}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n );\n};\n\nconst styles = StyleSheet.create({\n listItemContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default memo(DropdownListItem);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,MAAM,aAAa;AAElC,MAAMC,gBAAgB,GAAGC,IAAA,IAad;EAAA,IAbe;IACxBC,IAAI;IACJC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,cAAc;IACdC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC;EACG,CAAC,GAAAZ,IAAA;EACJ,oBACEN,KAAA,CAAAmB,aAAA,CAACjB,gBAAgB;IACfkB,KAAK,EAAEC,MAAM,CAACC,sBAAuB;IACrCC,OAAO,EACLhB,IAAI,CAACiB,QAAQ,GAAG,MAAM,CAAC,CAAC,GAAG,MAAMZ,QAAQ,CAACL,IAAI,CAACE,WAAW,CAAC,CAAC,CAAC;EAC9D,gBAEDT,KAAA,CAAAmB,aAAA,CAACf,QAAQ;IACPqB,KAAK,EACHf,UAAU,GACNC,cAAc,CAACe,QAAQ,CAACnB,IAAI,CAACE,WAAW,CAAC,CAAC,GAC1C,CAACE,cAAc,CAAC,CAACe,QAAQ,CAACnB,IAAI,CAACE,WAAW,CAAC,CAChD;IACDkB,KAAK,EAAEpB,IAAI,CAACC,WAAW,CAAE;IACzBI,QAAQ,EAAEA,CAAA,KAAMA,QAAQ,CAACL,IAAI,CAACE,WAAW,CAAC,CAAE;IAC5CI,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAE,CAAAG,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEH,YAAY,KAAIA,YAAa;IACpEC,aAAa,EAAE,CAAAE,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAEF,aAAa,KAAIA,aAAc;IACvEC,kBAAkB,EAChB,CAAAC,uBAAuB,aAAvBA,uBAAuB,uBAAvBA,uBAAuB,CAAED,kBAAkB,KAAIA,kBAChD;IACDQ,QAAQ,EAAEjB,IAAI,CAACiB,QAAS;IACxBN,iBAAiB,EAAEA;EAAkB,CACtC,CACe,CAAC;AAEvB,CAAC;AAED,MAAMG,MAAM,GAAGlB,UAAU,CAACyB,MAAM,CAAC;EAC/BN,sBAAsB,EAAE;IACtBO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe/B,IAAI,CAACI,gBAAgB,CAAC"}
@@ -21,6 +21,7 @@ const DropdownSectionList = _ref => {
21
21
  checkboxStyle,
22
22
  checkboxLabelStyle,
23
23
  checkboxComponentStyles,
24
+ checkboxComponent,
24
25
  listComponentStyles,
25
26
  listIndex,
26
27
  ...rest
@@ -94,6 +95,7 @@ const DropdownSectionList = _ref => {
94
95
  checkboxLabelStyle,
95
96
  // kept for backwards compatibility
96
97
  checkboxComponentStyles,
98
+ checkboxComponent,
97
99
  expandedSections
98
100
  }),
99
101
  renderSectionHeader: _ref2 => {
@@ -142,7 +144,8 @@ const _renderItem = (_ref3, props) => {
142
144
  checkboxSize: props.checkboxSize,
143
145
  checkboxStyle: props.checkboxStyle,
144
146
  checkboxLabelStyle: props.checkboxLabelStyle,
145
- checkboxComponentStyles: props.checkboxComponentStyles
147
+ checkboxComponentStyles: props.checkboxComponentStyles,
148
+ checkboxComponent: props.checkboxComponent
146
149
  });
147
150
  };
148
151
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","useRef","SectionList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","SectionHeaderTitle","extractPropertyFromArray","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listComponentStyles","listIndex","rest","expandedSections","setExpandedSections","Set","initialState","handleToggleListExpansion","title","expandedSectionsState","next","has","delete","add","sectionlistRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","_extends","sections","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","length","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","create"],"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":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,kBAAkB,QACb,WAAW;AAClB,SAASC,wBAAwB,QAAQ,aAAa;AAGtD,MAAMC,mBAAmB,GAAGC,IAAA,IAkBjB;EAAA,IAlBkB;IAC3BC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC,mBAAmB;IACnBC,SAAS;IACT,GAAGC;EACA,CAAC,GAAAjB,IAAA;EACJ,MAAM,CAACkB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG7B,QAAQ,CAAC,IAAI8B,GAAG,CAAC,CAAC,CAAC;;EAEnE;AACF;AACA;EACE/B,SAAS,CAAC,MAAM;IACd,IAAIgC,YAAY,GAAG,IAAID,GAAG,CAACtB,wBAAwB,CAACG,OAAO,EAAE,OAAO,CAAC,CAAC;IACtEkB,mBAAmB,CAACE,YAAY,CAAC;EACnC,CAAC,EAAE,CAACpB,OAAO,CAAC,CAAC;;EAEb;AACF;AACA;EACE,MAAMqB,yBAAyB,GAAIC,KAAa,IAAK;IACnDJ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ED,MAAM+B,WAAW,GAAGA,CAAAkB,KAAA,EAAoCC,KAAU,KAAK;EAAA,IAAlD;IAAEd,OAAO,EAAE;MAAE9B;IAAM,CAAC;IAAEwB;EAAU,CAAC,GAAAmB,KAAA;EACpD,MAAMR,UAAU,GAAGS,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEjD,gBAAgB,CAACQ,GAAG,CAACH,KAAK,CAAC;;EAErD;EACA,IAAI,CAACmC,UAAU,EAAE,OAAO,IAAI;EAE5B,oBACEtE,KAAA,CAAAgD,aAAA,CAAC1C,gBAAgB;IACfqD,IAAI,EAAEA,IAAK;IACX7C,WAAW,EAAEiE,KAAK,CAACjE,WAAY;IAC/BC,WAAW,EAAEgE,KAAK,CAAChE,WAAY;IAC/BC,UAAU,EAAE+D,KAAK,CAAC/D,UAAW;IAC7B6C,cAAc,EAAEkB,KAAK,CAAClB,cAAe;IACrCC,QAAQ,EAAEiB,KAAK,CAACjB,QAAS;IACzBxC,YAAY,EAAEyD,KAAK,CAACzD,YAAa;IACjCC,YAAY,EAAEwD,KAAK,CAACxD,YAAa;IACjCC,aAAa,EAAEuD,KAAK,CAACvD,aAAc;IACnCC,kBAAkB,EAAEsD,KAAK,CAACtD,kBAAmB;IAC7CC,uBAAuB,EAAEqD,KAAK,CAACrD;EAAwB,CACxD,CAAC;AAEN,CAAC;AAED,MAAM8B,MAAM,GAAGnD,UAAU,CAAC2E,MAAM,CAAC;EAC/B1B,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAe5C,mBAAmB"}
1
+ {"version":3,"names":["React","useEffect","useState","useRef","SectionList","StyleSheet","DropdownListItem","ItemSeparatorComponent","ListEmptyComponent","SectionHeaderTitle","extractPropertyFromArray","DropdownSectionList","_ref","options","optionLabel","optionValue","isMultiple","isSearchable","selectedItems","selectedItem","handleMultipleSelections","handleSingleSelection","primaryColor","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listComponentStyles","listIndex","rest","expandedSections","setExpandedSections","Set","initialState","handleToggleListExpansion","title","expandedSectionsState","next","has","delete","add","sectionlistRef","scrollToLocation","_sectionlistRef$curre","current","sectionIndex","animated","itemIndex","createElement","_extends","sections","extraData","initialNumToRender","listEmptyComponentStyle","contentContainerStyle","paddingTop","styles","itemSeparatorStyle","renderItem","item","_renderItem","selectedOption","onChange","renderSectionHeader","_ref2","section","data","length","sectionHeaderStyle","onPress","isExpanded","keyExtractor","_item","index","stickySectionHeadersEnabled","ref","onScrollToIndexFailed","setTimeout","_ref3","props","create"],"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":";AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,kBAAkB,QACb,WAAW;AAClB,SAASC,wBAAwB,QAAQ,aAAa;AAGtD,MAAMC,mBAAmB,GAAGC,IAAA,IAmBjB;EAAA,IAnBkB;IAC3BC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,wBAAwB;IACxBC,qBAAqB;IACrBC,YAAY;IACZC,YAAY;IACZC,aAAa;IACbC,kBAAkB;IAClBC,uBAAuB;IACvBC,iBAAiB;IACjBC,mBAAmB;IACnBC,SAAS;IACT,GAAGC;EACA,CAAC,GAAAlB,IAAA;EACJ,MAAM,CAACmB,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG9B,QAAQ,CAAC,IAAI+B,GAAG,CAAC,CAAC,CAAC;;EAEnE;AACF;AACA;EACEhC,SAAS,CAAC,MAAM;IACd,IAAIiC,YAAY,GAAG,IAAID,GAAG,CAACvB,wBAAwB,CAACG,OAAO,EAAE,OAAO,CAAC,CAAC;IACtEmB,mBAAmB,CAACE,YAAY,CAAC;EACnC,CAAC,EAAE,CAACrB,OAAO,CAAC,CAAC;;EAEb;AACF;AACA;EACE,MAAMsB,yBAAyB,GAAIC,KAAa,IAAK;IACnDJ,mBAAmB,CAAEK,qBAAqB,IAAK;MAC7C;MACA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AAAkB,KAAA,EAAoCC,KAAU,KAAK;EAAA,IAAlD;IAAEd,OAAO,EAAE;MAAE9B;IAAM,CAAC;IAAEwB;EAAU,CAAC,GAAAmB,KAAA;EACpD,MAAMR,UAAU,GAAGS,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEjD,gBAAgB,CAACQ,GAAG,CAACH,KAAK,CAAC;;EAErD;EACA,IAAI,CAACmC,UAAU,EAAE,OAAO,IAAI;EAE5B,oBACEvE,KAAA,CAAAiD,aAAA,CAAC3C,gBAAgB;IACfsD,IAAI,EAAEA,IAAK;IACX9C,WAAW,EAAEkE,KAAK,CAAClE,WAAY;IAC/BC,WAAW,EAAEiE,KAAK,CAACjE,WAAY;IAC/BC,UAAU,EAAEgE,KAAK,CAAChE,UAAW;IAC7B8C,cAAc,EAAEkB,KAAK,CAAClB,cAAe;IACrCC,QAAQ,EAAEiB,KAAK,CAACjB,QAAS;IACzBzC,YAAY,EAAE0D,KAAK,CAAC1D,YAAa;IACjCC,YAAY,EAAEyD,KAAK,CAACzD,YAAa;IACjCC,aAAa,EAAEwD,KAAK,CAACxD,aAAc;IACnCC,kBAAkB,EAAEuD,KAAK,CAACvD,kBAAmB;IAC7CC,uBAAuB,EAAEsD,KAAK,CAACtD,uBAAwB;IACvDC,iBAAiB,EAAEqD,KAAK,CAACrD;EAAkB,CAC5C,CAAC;AAEN,CAAC;AAED,MAAM8B,MAAM,GAAGpD,UAAU,CAAC4E,MAAM,CAAC;EAC/B1B,qBAAqB,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC1C,CAAC,CAAC;AAEF,eAAe7C,mBAAmB"}
@@ -46,6 +46,7 @@ export const DropdownSelect = _ref => {
46
46
  checkboxLabelStyle,
47
47
  // kept for backwards compatibility
48
48
  checkboxComponentStyles,
49
+ checkboxComponent,
49
50
  listHeaderComponent,
50
51
  listFooterComponent,
51
52
  listComponentStyles,
@@ -294,7 +295,8 @@ export const DropdownSelect = _ref => {
294
295
  checkboxSize: checkboxSize,
295
296
  checkboxStyle: checkboxStyle,
296
297
  checkboxLabelStyle: checkboxLabelStyle,
297
- checkboxComponentStyles: checkboxComponentStyles
298
+ checkboxComponentStyles: checkboxComponentStyles,
299
+ checkboxComponent: checkboxComponent
298
300
  })))),
299
301
  ListFooterComponent: listFooterComponent,
300
302
  listComponentStyles: listComponentStyles,
@@ -312,6 +314,7 @@ export const DropdownSelect = _ref => {
312
314
  checkboxStyle: checkboxStyle,
313
315
  checkboxLabelStyle: checkboxLabelStyle,
314
316
  checkboxComponentStyles: checkboxComponentStyles,
317
+ checkboxComponent: checkboxComponent,
315
318
  listIndex: listIndex
316
319
  })));
317
320
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","useState","useEffect","useCallback","TouchableOpacity","StyleSheet","View","Input","CheckBox","Dropdown","DropdownFlatList","DropdownSectionList","CustomModal","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","extractPropertyFromArray","getMaxLengthOfSectionListProperty","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","dropdownIcon","labelStyle","placeholderStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainerStyle","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","listHeaderComponent","listFooterComponent","listComponentStyles","modalProps","hideModal","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","searchValue","setSearchValue","listIndex","setListIndex","itemIndex","Array","isArray","isSectionList","some","item","title","data","ListTypeComponent","modifiedSectionData","flat","modifiedOptions","optLabel","optValue","optionsCopy","JSON","parse","stringify","handleSingleSelection","value","handleMultipleSelections","prevVal","_selectedValues","selectedValues","includes","filter","push","handleSelectAll","filteredOptions","i","length","checkSelectAll","getSelectedItemsLabel","selectedLabels","forEach","element","_modifiedOptions$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","searchSectionList","searchFlatList","flatList","toLowerCase","search","sectionList","map","listItem","handleToggleModal","sectionIndex","primary","gray","sectionListMaxLength","listIsEmpty","setIndexOfSelectedItem","selectedLabel","_item$data","dataItem","createElement","Fragment","_extends","onRequestClose","ListHeaderComponent","onChangeText","text","style","styles","optionsContainerStyle","onPress","onChange","ListFooterComponent","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Input from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownFlatList from './components/Dropdown/DropdownFlatList';\nimport DropdownSectionList from './components/Dropdown/DropdownSectionList';\nimport CustomModal from './components/CustomModal';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type {\n DropdownProps,\n TFlatList,\n TFlatListItem,\n TSectionList,\n TSectionListItem,\n} from './types/index.types';\nimport {\n extractPropertyFromArray,\n getMaxLengthOfSectionListProperty,\n} from './utils';\n\nexport const DropdownSelect: React.FC<DropdownProps> = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n dropdownIcon,\n labelStyle,\n placeholderStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n listHeaderComponent,\n listFooterComponent,\n listComponentStyles,\n modalProps,\n hideModal = false,\n ...rest\n}) => {\n const [newOptions, setNewOptions] = useState<TFlatList | TSectionList>([]);\n const [open, setOpen] = useState<boolean>(false);\n const [selectAll, setSelectAll] = useState<boolean>(false);\n const [selectedItem, setSelectedItem] = useState<any>(''); // for single selection\n const [selectedItems, setSelectedItems] = useState<any[]>([]); // for multiple selection\n const [searchValue, setSearchValue] = useState<string>('');\n const [listIndex, setListIndex] = useState<{\n sectionIndex?: number;\n itemIndex: number;\n }>({ itemIndex: 0 }); // for scrollToIndex in Sectionlist and Flatlist\n\n useEffect(() => {\n if (options) {\n setNewOptions(options);\n }\n return () => {};\n }, [options]);\n\n useEffect(() => {\n isMultiple\n ? setSelectedItems(Array.isArray(selectedValue) ? selectedValue : [])\n : setSelectedItem(selectedValue);\n\n return () => {};\n }, [selectedValue, isMultiple, onValueChange]);\n\n /*===========================================\n * List type\n *==========================================*/\n\n const isSectionList = newOptions.some(\n (item) => item.title && item.data && Array.isArray(item.data)\n );\n\n const ListTypeComponent = isSectionList\n ? DropdownSectionList\n : DropdownFlatList;\n const modifiedSectionData = extractPropertyFromArray(\n newOptions,\n 'data'\n ).flat();\n const modifiedOptions = isSectionList ? modifiedSectionData : newOptions;\n\n const optLabel = optionLabel || DEFAULT_OPTION_LABEL;\n const optValue = optionValue || DEFAULT_OPTION_VALUE;\n const optionsCopy = JSON.parse(JSON.stringify(options)); //copy of the original options array\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: string | number) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n onValueChange(null); //send value to parent\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: string[] | number[]) => {\n setSelectedItems((prevVal) => {\n let selectedValues = [...prevVal];\n\n if (selectedValues?.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n onValueChange(selectedValues); //send value to parent\n return selectedValues;\n });\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n\n //don't select disabled items\n const filteredOptions = modifiedOptions.filter(\n (item: TFlatListItem) => !item.disabled\n );\n\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Handle side effects\n *==========================================*/\n const checkSelectAll = useCallback(\n (selectedValues: any[]) => {\n //if the list contains disabled values, those values will not be selected\n if (\n modifiedOptions.filter((item: TFlatListItem) => !item.disabled)\n .length === selectedValues.length\n ) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n },\n [modifiedOptions]\n );\n\n // anytime the selected items change, check if it is time to set `selectAll` to true\n useEffect(() => {\n if (isMultiple) {\n checkSelectAll(selectedItems);\n }\n return () => {};\n }, [checkSelectAll, isMultiple, selectedItems]);\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple && Array.isArray(selectedItems)) {\n let selectedLabels: Array<string> = [];\n\n selectedItems?.forEach((element: number | string) => {\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === element\n )?.[optLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === selectedItem\n );\n return selectedItemLabel?.[optLabel];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n //Because Search mutates the initial state, we have to search with a copy of the original array\n const searchResults = isSectionList\n ? searchSectionList(optionsCopy as TSectionList, regexFilter)\n : searchFlatList(optionsCopy as TFlatList, regexFilter);\n\n setNewOptions(searchResults);\n };\n\n const searchFlatList = (flatList: TFlatList, regexFilter: RegExp) => {\n const searchResults = flatList.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return item;\n }\n return;\n });\n return searchResults;\n };\n\n const searchSectionList = (\n sectionList: TSectionList,\n regexFilter: RegExp\n ) => {\n const searchResults = sectionList.map((listItem: TSectionListItem) => {\n listItem.data = listItem.data.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return listItem.data.push(item);\n }\n return;\n });\n\n return listItem;\n });\n\n return searchResults;\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n setListIndex({ itemIndex: 0, sectionIndex: 0 });\n };\n\n useEffect(() => {\n if (hideModal) {\n setOpen(false);\n }\n return () => {};\n }, [hideModal]);\n\n let primary = primaryColor || colors.gray;\n\n const sectionListMaxLength = getMaxLengthOfSectionListProperty(\n newOptions as TSectionList,\n 'data'\n );\n\n const listIsEmpty = isSectionList\n ? sectionListMaxLength > 1\n : newOptions.length > 1;\n\n /*===========================================\n * setIndexOfSelectedItem - For ScrollToIndex\n *==========================================*/\n const setIndexOfSelectedItem = (selectedLabel: string) => {\n isSectionList\n ? optionsCopy.map((item: TSectionListItem, sectionIndex: number) => {\n item.data?.find((dataItem: TFlatListItem, itemIndex: number) => {\n if (dataItem[optLabel] === selectedLabel) {\n setListIndex({ sectionIndex, itemIndex });\n }\n });\n })\n : optionsCopy?.find((item: TFlatListItem, itemIndex: number) => {\n if (item[optLabel] === selectedLabel) {\n setListIndex({ itemIndex });\n }\n });\n };\n\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n setIndexOfSelectedItem={setIndexOfSelectedItem}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainerStyle={modalOptionsContainerStyle}\n onRequestClose={() => {}}\n modalProps={modalProps}\n >\n <ListTypeComponent\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {listHeaderComponent}\n {isMultiple && listIsEmpty && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n ListFooterComponent={listFooterComponent}\n listComponentStyles={listComponentStyles}\n options={newOptions}\n optionLabel={optLabel}\n optionValue={optValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n listIndex={listIndex}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,mBAAmB,MAAM,2CAA2C;AAC3E,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,aAAa;AAQxE,SACEC,wBAAwB,EACxBC,iCAAiC,QAC5B,SAAS;AAEhB,OAAO,MAAMC,cAAuC,GAAGC,IAAA,IAsCjD;EAAA,IAtCkD;IACtDC,WAAW;IACXC,KAAK;IACLC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,aAAa;IACbC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZC,YAAY;IACZC,UAAU;IACVC,gBAAgB;IAChBC,aAAa;IACbC,iBAAiB;IACjBC,sBAAsB;IACtBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,iBAAiB;IACjBC,yBAAyB;IACzBC,oBAAoB;IACpBC,0BAA0B;IAC1BC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,YAAY;IAAE;IACdC,aAAa;IAAE;IACfC,kBAAkB;IAAE;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OAAQ;IACtBjF,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA,kBAAmB;IACvCC,uBAAuB,EAAEA,uBAAwB;IACjDmB,SAAS,EAAEA;EAAU,CACtB,CACU,CACb,CAAC;AAEP,CAAC;AAED,MAAM2E,MAAM,GAAG3I,UAAU,CAACgJ,MAAM,CAAC;EAC/BJ,qBAAqB,EAAE;IACrBK,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAetI,cAAc"}
1
+ {"version":3,"names":["React","useState","useEffect","useCallback","TouchableOpacity","StyleSheet","View","Input","CheckBox","Dropdown","DropdownFlatList","DropdownSectionList","CustomModal","colors","DEFAULT_OPTION_LABEL","DEFAULT_OPTION_VALUE","extractPropertyFromArray","getMaxLengthOfSectionListProperty","DropdownSelect","_ref","placeholder","label","error","helperText","options","optionLabel","optionValue","onValueChange","selectedValue","isMultiple","isSearchable","dropdownIcon","labelStyle","placeholderStyle","dropdownStyle","dropdownIconStyle","dropdownContainerStyle","dropdownErrorStyle","dropdownErrorTextStyle","dropdownHelperTextStyle","selectedItemStyle","multipleSelectedItemStyle","modalBackgroundStyle","modalOptionsContainerStyle","searchInputStyle","primaryColor","disabled","checkboxSize","checkboxStyle","checkboxLabelStyle","checkboxComponentStyles","checkboxComponent","listHeaderComponent","listFooterComponent","listComponentStyles","modalProps","hideModal","rest","newOptions","setNewOptions","open","setOpen","selectAll","setSelectAll","selectedItem","setSelectedItem","selectedItems","setSelectedItems","searchValue","setSearchValue","listIndex","setListIndex","itemIndex","Array","isArray","isSectionList","some","item","title","data","ListTypeComponent","modifiedSectionData","flat","modifiedOptions","optLabel","optValue","optionsCopy","JSON","parse","stringify","handleSingleSelection","value","handleMultipleSelections","prevVal","_selectedValues","selectedValues","includes","filter","push","handleSelectAll","filteredOptions","i","length","checkSelectAll","getSelectedItemsLabel","selectedLabels","forEach","element","_modifiedOptions$find","selectedItemLabel","find","onSearch","searchText","toString","toLocaleLowerCase","trim","regexFilter","RegExp","searchResults","searchSectionList","searchFlatList","flatList","toLowerCase","search","sectionList","map","listItem","handleToggleModal","sectionIndex","primary","gray","sectionListMaxLength","listIsEmpty","setIndexOfSelectedItem","selectedLabel","_item$data","dataItem","createElement","Fragment","_extends","onRequestClose","ListHeaderComponent","onChangeText","text","style","styles","optionsContainerStyle","onPress","onChange","ListFooterComponent","create","paddingHorizontal","paddingVertical","flexDirection"],"sources":["index.tsx"],"sourcesContent":["import React, { useState, useEffect, useCallback } from 'react';\nimport { TouchableOpacity, StyleSheet, View } from 'react-native';\nimport Input from './components/Input';\nimport CheckBox from './components/CheckBox';\nimport Dropdown from './components/Dropdown/Dropdown';\nimport DropdownFlatList from './components/Dropdown/DropdownFlatList';\nimport DropdownSectionList from './components/Dropdown/DropdownSectionList';\nimport CustomModal from './components/CustomModal';\nimport { colors } from './styles/colors';\nimport { DEFAULT_OPTION_LABEL, DEFAULT_OPTION_VALUE } from './constants';\nimport type {\n DropdownProps,\n TFlatList,\n TFlatListItem,\n TSectionList,\n TSectionListItem,\n} from './types/index.types';\nimport {\n extractPropertyFromArray,\n getMaxLengthOfSectionListProperty,\n} from './utils';\n\nexport const DropdownSelect: React.FC<DropdownProps> = ({\n placeholder,\n label,\n error,\n helperText,\n options,\n optionLabel,\n optionValue,\n onValueChange,\n selectedValue,\n isMultiple,\n isSearchable,\n dropdownIcon,\n labelStyle,\n placeholderStyle,\n dropdownStyle,\n dropdownIconStyle,\n dropdownContainerStyle,\n dropdownErrorStyle,\n dropdownErrorTextStyle,\n dropdownHelperTextStyle,\n selectedItemStyle,\n multipleSelectedItemStyle,\n modalBackgroundStyle,\n modalOptionsContainerStyle,\n searchInputStyle,\n primaryColor,\n disabled,\n checkboxSize, // kept for backwards compatibility\n checkboxStyle, // kept for backwards compatibility\n checkboxLabelStyle, // kept for backwards compatibility\n checkboxComponentStyles,\n checkboxComponent,\n listHeaderComponent,\n listFooterComponent,\n listComponentStyles,\n modalProps,\n hideModal = false,\n ...rest\n}) => {\n const [newOptions, setNewOptions] = useState<TFlatList | TSectionList>([]);\n const [open, setOpen] = useState<boolean>(false);\n const [selectAll, setSelectAll] = useState<boolean>(false);\n const [selectedItem, setSelectedItem] = useState<any>(''); // for single selection\n const [selectedItems, setSelectedItems] = useState<any[]>([]); // for multiple selection\n const [searchValue, setSearchValue] = useState<string>('');\n const [listIndex, setListIndex] = useState<{\n sectionIndex?: number;\n itemIndex: number;\n }>({ itemIndex: 0 }); // for scrollToIndex in Sectionlist and Flatlist\n\n useEffect(() => {\n if (options) {\n setNewOptions(options);\n }\n return () => {};\n }, [options]);\n\n useEffect(() => {\n isMultiple\n ? setSelectedItems(Array.isArray(selectedValue) ? selectedValue : [])\n : setSelectedItem(selectedValue);\n\n return () => {};\n }, [selectedValue, isMultiple, onValueChange]);\n\n /*===========================================\n * List type\n *==========================================*/\n\n const isSectionList = newOptions.some(\n (item) => item.title && item.data && Array.isArray(item.data)\n );\n\n const ListTypeComponent = isSectionList\n ? DropdownSectionList\n : DropdownFlatList;\n const modifiedSectionData = extractPropertyFromArray(\n newOptions,\n 'data'\n ).flat();\n const modifiedOptions = isSectionList ? modifiedSectionData : newOptions;\n\n const optLabel = optionLabel || DEFAULT_OPTION_LABEL;\n const optValue = optionValue || DEFAULT_OPTION_VALUE;\n const optionsCopy = JSON.parse(JSON.stringify(options)); //copy of the original options array\n\n /*===========================================\n * Selection handlers\n *==========================================*/\n const handleSingleSelection = (value: string | number) => {\n if (selectedItem === value) {\n setSelectedItem(null);\n onValueChange(null); //send value to parent\n } else {\n setSelectedItem(value);\n onValueChange(value); //send value to parent\n setOpen(false); //close modal upon selection\n }\n };\n\n const handleMultipleSelections = (value: string[] | number[]) => {\n setSelectedItems((prevVal) => {\n let selectedValues = [...prevVal];\n\n if (selectedValues?.includes(value)) {\n selectedValues = selectedValues.filter((item) => item !== value);\n } else {\n selectedValues.push(value);\n }\n onValueChange(selectedValues); //send value to parent\n return selectedValues;\n });\n };\n\n const handleSelectAll = () => {\n setSelectAll((prevVal) => {\n const selectedValues = [];\n\n //don't select disabled items\n const filteredOptions = modifiedOptions.filter(\n (item: TFlatListItem) => !item.disabled\n );\n\n if (!prevVal) {\n for (let i = 0; i < filteredOptions.length; i++) {\n selectedValues.push(filteredOptions[i][optValue]);\n }\n }\n\n setSelectedItems(selectedValues);\n onValueChange(selectedValues); //send value to parent\n return !prevVal;\n });\n };\n\n /*===========================================\n * Handle side effects\n *==========================================*/\n const checkSelectAll = useCallback(\n (selectedValues: any[]) => {\n //if the list contains disabled values, those values will not be selected\n if (\n modifiedOptions.filter((item: TFlatListItem) => !item.disabled)\n .length === selectedValues.length\n ) {\n setSelectAll(true);\n } else {\n setSelectAll(false);\n }\n },\n [modifiedOptions]\n );\n\n // anytime the selected items change, check if it is time to set `selectAll` to true\n useEffect(() => {\n if (isMultiple) {\n checkSelectAll(selectedItems);\n }\n return () => {};\n }, [checkSelectAll, isMultiple, selectedItems]);\n\n /*===========================================\n * Get label handler\n *==========================================*/\n const getSelectedItemsLabel = () => {\n if (isMultiple && Array.isArray(selectedItems)) {\n let selectedLabels: Array<string> = [];\n\n selectedItems?.forEach((element: number | string) => {\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === element\n )?.[optLabel];\n selectedLabels.push(selectedItemLabel);\n });\n return selectedLabels;\n }\n\n let selectedItemLabel = modifiedOptions?.find(\n (item: TFlatListItem) => item[optValue] === selectedItem\n );\n return selectedItemLabel?.[optLabel];\n };\n\n /*===========================================\n * Search\n *==========================================*/\n const onSearch = (value: string) => {\n setSearchValue(value);\n\n let searchText = value.toString().toLocaleLowerCase().trim();\n\n const regexFilter = new RegExp(searchText, 'i');\n\n //Because Search mutates the initial state, we have to search with a copy of the original array\n const searchResults = isSectionList\n ? searchSectionList(optionsCopy as TSectionList, regexFilter)\n : searchFlatList(optionsCopy as TFlatList, regexFilter);\n\n setNewOptions(searchResults);\n };\n\n const searchFlatList = (flatList: TFlatList, regexFilter: RegExp) => {\n const searchResults = flatList.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return item;\n }\n return;\n });\n return searchResults;\n };\n\n const searchSectionList = (\n sectionList: TSectionList,\n regexFilter: RegExp\n ) => {\n const searchResults = sectionList.map((listItem: TSectionListItem) => {\n listItem.data = listItem.data.filter((item: TFlatListItem) => {\n if (\n item[optLabel].toString().toLowerCase().search(regexFilter) !== -1 ||\n item[optValue].toString().toLowerCase().search(regexFilter) !== -1\n ) {\n return listItem.data.push(item);\n }\n return;\n });\n\n return listItem;\n });\n\n return searchResults;\n };\n\n /*===========================================\n * Modal\n *==========================================*/\n const handleToggleModal = () => {\n setOpen(!open);\n setSearchValue('');\n setNewOptions(options);\n setListIndex({ itemIndex: 0, sectionIndex: 0 });\n };\n\n useEffect(() => {\n if (hideModal) {\n setOpen(false);\n }\n return () => {};\n }, [hideModal]);\n\n let primary = primaryColor || colors.gray;\n\n const sectionListMaxLength = getMaxLengthOfSectionListProperty(\n newOptions as TSectionList,\n 'data'\n );\n\n const listIsEmpty = isSectionList\n ? sectionListMaxLength > 1\n : newOptions.length > 1;\n\n /*===========================================\n * setIndexOfSelectedItem - For ScrollToIndex\n *==========================================*/\n const setIndexOfSelectedItem = (selectedLabel: string) => {\n isSectionList\n ? optionsCopy.map((item: TSectionListItem, sectionIndex: number) => {\n item.data?.find((dataItem: TFlatListItem, itemIndex: number) => {\n if (dataItem[optLabel] === selectedLabel) {\n setListIndex({ sectionIndex, itemIndex });\n }\n });\n })\n : optionsCopy?.find((item: TFlatListItem, itemIndex: number) => {\n if (item[optLabel] === selectedLabel) {\n setListIndex({ itemIndex });\n }\n });\n };\n\n return (\n <>\n <Dropdown\n label={label}\n placeholder={placeholder}\n helperText={helperText}\n error={error}\n getSelectedItemsLabel={getSelectedItemsLabel}\n selectedItem={selectedItem}\n selectedItems={selectedItems}\n handleToggleModal={handleToggleModal}\n labelStyle={labelStyle}\n dropdownIcon={dropdownIcon}\n dropdownStyle={dropdownStyle}\n dropdownIconStyle={dropdownIconStyle}\n dropdownContainerStyle={dropdownContainerStyle}\n dropdownErrorStyle={dropdownErrorStyle}\n dropdownErrorTextStyle={dropdownErrorTextStyle}\n dropdownHelperTextStyle={dropdownHelperTextStyle}\n selectedItemStyle={selectedItemStyle}\n multipleSelectedItemStyle={multipleSelectedItemStyle}\n isMultiple={isMultiple}\n primaryColor={primary}\n disabled={disabled}\n placeholderStyle={placeholderStyle}\n setIndexOfSelectedItem={setIndexOfSelectedItem}\n {...rest}\n />\n <CustomModal\n open={open}\n handleToggleModal={handleToggleModal}\n modalBackgroundStyle={modalBackgroundStyle}\n modalOptionsContainerStyle={modalOptionsContainerStyle}\n onRequestClose={() => {}}\n modalProps={modalProps}\n >\n <ListTypeComponent\n ListHeaderComponent={\n <>\n {isSearchable && (\n <Input\n value={searchValue}\n onChangeText={(text: string) => onSearch(text)}\n style={searchInputStyle}\n primaryColor={primary}\n />\n )}\n {listHeaderComponent}\n {isMultiple && listIsEmpty && (\n <View style={styles.optionsContainerStyle}>\n <TouchableOpacity onPress={() => {}}>\n <CheckBox\n value={selectAll}\n label={selectAll ? 'Clear all' : 'Select all'}\n onChange={() => handleSelectAll()}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n />\n </TouchableOpacity>\n </View>\n )}\n </>\n }\n ListFooterComponent={listFooterComponent}\n listComponentStyles={listComponentStyles}\n options={newOptions}\n optionLabel={optLabel}\n optionValue={optValue}\n isMultiple={isMultiple}\n isSearchable={isSearchable}\n selectedItems={selectedItems}\n selectedItem={selectedItem}\n handleMultipleSelections={handleMultipleSelections}\n handleSingleSelection={handleSingleSelection}\n primaryColor={primary}\n checkboxSize={checkboxSize}\n checkboxStyle={checkboxStyle}\n checkboxLabelStyle={checkboxLabelStyle}\n checkboxComponentStyles={checkboxComponentStyles}\n checkboxComponent={checkboxComponent}\n listIndex={listIndex}\n />\n </CustomModal>\n </>\n );\n};\n\nconst styles = StyleSheet.create({\n optionsContainerStyle: {\n paddingHorizontal: 20,\n paddingVertical: 10,\n flexDirection: 'row',\n },\n});\n\nexport default DropdownSelect;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC/D,SAASC,gBAAgB,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,mBAAmB,MAAM,2CAA2C;AAC3E,OAAOC,WAAW,MAAM,0BAA0B;AAClD,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,aAAa;AAQxE,SACEC,wBAAwB,EACxBC,iCAAiC,QAC5B,SAAS;AAEhB,OAAO,MAAMC,cAAuC,GAAGC,IAAA,IAuCjD;EAAA,IAvCkD;IACtDC,WAAW;IACXC,KAAK;IACLC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,WAAW;IACXC,WAAW;IACXC,aAAa;IACbC,aAAa;IACbC,UAAU;IACVC,YAAY;IACZC,YAAY;IACZC,UAAU;IACVC,gBAAgB;IAChBC,aAAa;IACbC,iBAAiB;IACjBC,sBAAsB;IACtBC,kBAAkB;IAClBC,sBAAsB;IACtBC,uBAAuB;IACvBC,iBAAiB;IACjBC,yBAAyB;IACzBC,oBAAoB;IACpBC,0BAA0B;IAC1BC,gBAAgB;IAChBC,YAAY;IACZC,QAAQ;IACRC,YAAY;IAAE;IACdC,aAA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B,EAAEA,wBAAyB;IACnDF,qBAAqB,EAAEA,qBAAsB;IAC7C7C,YAAY,EAAEoF,OAAQ;IACtBlF,YAAY,EAAEA,YAAa;IAC3BC,aAAa,EAAEA,aAAc;IAC7BC,kBAAkB,EAAEA,kBAAmB;IACvCC,uBAAuB,EAAEA,uBAAwB;IACjDC,iBAAiB,EAAEA,iBAAkB;IACrCmB,SAAS,EAAEA;EAAU,CACtB,CACU,CACb,CAAC;AAEP,CAAC;AAED,MAAM2E,MAAM,GAAG5I,UAAU,CAACiJ,MAAM,CAAC;EAC/BJ,qBAAqB,EAAE;IACrBK,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEF,eAAevI,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type {\n ViewStyle,\n ColorValue,\n TextStyle,\n ModalProps,\n} from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: TFlatList | TSectionList;\n optionLabel?: string;\n optionValue?: string;\n onValueChange: Function;\n selectedValue?:\n | string\n | boolean\n | number\n | string[]\n | boolean[]\n | number[]\n | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n dropdownIcon?: React.ReactNode;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownIconStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: TextStyle;\n multipleSelectedItemStyle?: TextStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainerStyle?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n placeholderStyle?: TextStyle;\n listHeaderComponent?: React.ReactNode;\n listFooterComponent?: React.ReactNode;\n hideModal?: boolean;\n modalProps?: ModalProps;\n listComponentStyles?: {\n listEmptyComponentStyle?: TextStyle;\n itemSeparatorStyle?: ViewStyle;\n sectionHeaderStyle?: TextStyle;\n };\n};\n\nexport type TFlatList = TFlatListItem[];\nexport type TFlatListItem = {\n [key: string]: string | number | boolean;\n}\n\nexport type TSectionList = TSectionListItem[];\nexport type TSectionListItem = { title: string; data: TFlatList };\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["index.types.ts"],"sourcesContent":["import type {\n ViewStyle,\n ColorValue,\n TextStyle,\n ModalProps,\n} from 'react-native';\n\nexport type DropdownProps = {\n placeholder?: string;\n label?: string;\n error?: string;\n helperText?: string;\n options: TFlatList | TSectionList;\n optionLabel?: string;\n optionValue?: string;\n onValueChange: Function;\n selectedValue?:\n | string\n | boolean\n | number\n | string[]\n | boolean[]\n | number[]\n | null;\n isMultiple?: boolean;\n isSearchable?: boolean;\n dropdownIcon?: React.ReactNode;\n labelStyle?: TextStyle;\n dropdownStyle?: ViewStyle;\n dropdownIconStyle?: ViewStyle;\n dropdownContainerStyle?: ViewStyle;\n dropdownErrorStyle?: ViewStyle;\n dropdownErrorTextStyle?: TextStyle;\n dropdownHelperTextStyle?: TextStyle;\n selectedItemStyle?: TextStyle;\n multipleSelectedItemStyle?: TextStyle;\n modalBackgroundStyle?: ViewStyle;\n modalOptionsContainerStyle?: ViewStyle;\n searchInputStyle?: ViewStyle;\n primaryColor?: ColorValue;\n disabled?: boolean;\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n checkboxComponentStyles?: {\n checkboxSize?: number;\n checkboxStyle?: ViewStyle;\n checkboxLabelStyle?: TextStyle;\n };\n checkboxComponent?: React.ReactNode;\n placeholderStyle?: TextStyle;\n listHeaderComponent?: React.ReactNode;\n listFooterComponent?: React.ReactNode;\n hideModal?: boolean;\n modalProps?: ModalProps;\n listComponentStyles?: {\n listEmptyComponentStyle?: TextStyle;\n itemSeparatorStyle?: ViewStyle;\n sectionHeaderStyle?: TextStyle;\n };\n};\n\nexport type TFlatList = TFlatListItem[];\nexport type TFlatListItem = {\n [key: string]: string | number | boolean;\n}\n\nexport type TSectionList = TSectionListItem[];\nexport type TSectionListItem = { title: string; data: TFlatList };\n"],"mappings":""}
@@ -17,5 +17,5 @@ const checkboxComponentStyles = {
17
17
  };
18
18
  ```
19
19
  */
20
- declare const CheckBox: ({ label, value, disabled, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, onChange, }: CheckboxProps) => JSX.Element;
20
+ declare const CheckBox: ({ label, value, disabled, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, onChange, }: CheckboxProps) => JSX.Element;
21
21
  export default CheckBox;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { ColorValue, ViewStyle, TextStyle } from 'react-native';
2
3
  export type CheckboxProps = {
3
4
  label?: string;
@@ -12,5 +13,6 @@ export type CheckboxProps = {
12
13
  checkboxStyle?: ViewStyle;
13
14
  checkboxLabelStyle?: TextStyle;
14
15
  };
16
+ checkboxComponent?: React.ReactNode;
15
17
  onChange?: (value: boolean | string | number) => void;
16
18
  };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, listComponentStyles, listIndex, ...rest }: any) => JSX.Element;
2
+ declare const DropdownFlatList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, listComponentStyles, listIndex, ...rest }: any) => JSX.Element;
3
3
  export default DropdownFlatList;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, }: any) => JSX.Element>;
2
+ declare const _default: React.MemoExoticComponent<({ item, optionLabel, optionValue, isMultiple, selectedOption, onChange, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, }: any) => JSX.Element>;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, listComponentStyles, listIndex, ...rest }: any) => JSX.Element;
2
+ declare const DropdownSectionList: ({ options, optionLabel, optionValue, isMultiple, isSearchable, selectedItems, selectedItem, handleMultipleSelections, handleSingleSelection, primaryColor, checkboxSize, checkboxStyle, checkboxLabelStyle, checkboxComponentStyles, checkboxComponent, listComponentStyles, listIndex, ...rest }: any) => JSX.Element;
3
3
  export default DropdownSectionList;
@@ -35,6 +35,7 @@ export type DropdownProps = {
35
35
  checkboxStyle?: ViewStyle;
36
36
  checkboxLabelStyle?: TextStyle;
37
37
  };
38
+ checkboxComponent?: React.ReactNode;
38
39
  placeholderStyle?: TextStyle;
39
40
  listHeaderComponent?: React.ReactNode;
40
41
  listFooterComponent?: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-input-select",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,7 +26,7 @@
26
26
  "typescript": "tsc --noEmit",
27
27
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
28
  "prepare": "bob build",
29
- "release": "release-it -- patch --ci",
29
+ "release": "release-it --ci",
30
30
  "example": "yarn --cwd example",
31
31
  "pods": "cd example && pod-install --quiet",
32
32
  "bootstrap": "yarn example && yarn && yarn pods",
@@ -31,6 +31,7 @@ const CheckBox = ({
31
31
  checkboxStyle,
32
32
  checkboxLabelStyle,
33
33
  checkboxComponentStyles,
34
+ checkboxComponent,
34
35
  onChange,
35
36
  }: CheckboxProps) => {
36
37
  // const { checkboxSize, checkboxStyle, checkboxLabelStyle } =
@@ -57,22 +58,30 @@ const CheckBox = ({
57
58
  style={[styles.checkboxContainer]}
58
59
  disabled={disabled}
59
60
  >
60
- <View style={[styles.checkbox, checkboxStyle, fillColor]}>
61
- <Image
62
- source={require('../../asset/check.png')}
63
- style={[
64
- {
65
- height:
66
- checkboxComponentStyles?.checkboxSize ||
67
- checkboxSize ||
68
- CHECKBOX_SIZE,
69
- width:
70
- checkboxComponentStyles?.checkboxSize ||
71
- checkboxSize ||
72
- CHECKBOX_SIZE,
73
- },
74
- ]}
75
- />
61
+ <View
62
+ style={[
63
+ styles.checkbox,
64
+ checkboxComponentStyles?.checkboxStyle || checkboxStyle,
65
+ fillColor,
66
+ ]}
67
+ >
68
+ {checkboxComponent || (
69
+ <Image
70
+ source={require('../../asset/check.png')}
71
+ style={[
72
+ {
73
+ height:
74
+ checkboxComponentStyles?.checkboxSize ||
75
+ checkboxSize ||
76
+ CHECKBOX_SIZE,
77
+ width:
78
+ checkboxComponentStyles?.checkboxSize ||
79
+ checkboxSize ||
80
+ CHECKBOX_SIZE,
81
+ },
82
+ ]}
83
+ />
84
+ )}
76
85
  </View>
77
86
  {label && (
78
87
  <Text
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { ColorValue, ViewStyle, TextStyle } from 'react-native';
2
3
 
3
4
  export type CheckboxProps = {
@@ -13,5 +14,6 @@ export type CheckboxProps = {
13
14
  checkboxStyle?: ViewStyle;
14
15
  checkboxLabelStyle?: TextStyle;
15
16
  };
17
+ checkboxComponent?: React.ReactNode;
16
18
  onChange?: (value: boolean | string | number) => void;
17
19
  };
@@ -20,6 +20,7 @@ const DropdownFlatList = ({
20
20
  checkboxStyle, // kept for backwards compatibility to be removed in future release
21
21
  checkboxLabelStyle, // kept for backwards compatibility to be removed in future release
22
22
  checkboxComponentStyles,
23
+ checkboxComponent,
23
24
  listComponentStyles,
24
25
  listIndex,
25
26
  ...rest
@@ -70,6 +71,7 @@ const DropdownFlatList = ({
70
71
  checkboxStyle, // kept for backwards compatibility
71
72
  checkboxLabelStyle, // kept for backwards compatibility
72
73
  checkboxComponentStyles,
74
+ checkboxComponent
73
75
  })
74
76
  }
75
77
  keyExtractor={(_item, index) => `Options${index}`}
@@ -99,6 +101,7 @@ const _renderItem = ({ item }: any, props: any) => {
99
101
  checkboxLabelStyle={props.checkboxLabelStyle}
100
102
  scrollToItem={props.scrollToItem}
101
103
  checkboxComponentStyles={props.checkboxComponentStyles}
104
+ checkboxComponent={props.checkboxComponent}
102
105
  />
103
106
  );
104
107
  };
@@ -14,6 +14,7 @@ const DropdownListItem = ({
14
14
  checkboxStyle,
15
15
  checkboxLabelStyle,
16
16
  checkboxComponentStyles,
17
+ checkboxComponent,
17
18
  }: any) => {
18
19
  return (
19
20
  <TouchableOpacity
@@ -37,6 +38,7 @@ const DropdownListItem = ({
37
38
  checkboxComponentStyles?.checkboxLabelStyle || checkboxLabelStyle
38
39
  }
39
40
  disabled={item.disabled}
41
+ checkboxComponent={checkboxComponent}
40
42
  />
41
43
  </TouchableOpacity>
42
44
  );
@@ -25,6 +25,7 @@ const DropdownSectionList = ({
25
25
  checkboxStyle,
26
26
  checkboxLabelStyle,
27
27
  checkboxComponentStyles,
28
+ checkboxComponent,
28
29
  listComponentStyles,
29
30
  listIndex,
30
31
  ...rest
@@ -105,6 +106,7 @@ const DropdownSectionList = ({
105
106
  checkboxStyle, // kept for backwards compatibility
106
107
  checkboxLabelStyle, // kept for backwards compatibility
107
108
  checkboxComponentStyles,
109
+ checkboxComponent,
108
110
  expandedSections,
109
111
  })
110
112
  }
@@ -150,6 +152,7 @@ const _renderItem = ({ section: { title }, item }: any, props: any) => {
150
152
  checkboxStyle={props.checkboxStyle}
151
153
  checkboxLabelStyle={props.checkboxLabelStyle}
152
154
  checkboxComponentStyles={props.checkboxComponentStyles}
155
+ checkboxComponent={props.checkboxComponent}
153
156
  />
154
157
  );
155
158
  };
package/src/index.tsx CHANGED
@@ -52,6 +52,7 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
52
52
  checkboxStyle, // kept for backwards compatibility
53
53
  checkboxLabelStyle, // kept for backwards compatibility
54
54
  checkboxComponentStyles,
55
+ checkboxComponent,
55
56
  listHeaderComponent,
56
57
  listFooterComponent,
57
58
  listComponentStyles,
@@ -362,6 +363,7 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
362
363
  checkboxStyle={checkboxStyle}
363
364
  checkboxLabelStyle={checkboxLabelStyle}
364
365
  checkboxComponentStyles={checkboxComponentStyles}
366
+ checkboxComponent={checkboxComponent}
365
367
  />
366
368
  </TouchableOpacity>
367
369
  </View>
@@ -384,6 +386,7 @@ export const DropdownSelect: React.FC<DropdownProps> = ({
384
386
  checkboxStyle={checkboxStyle}
385
387
  checkboxLabelStyle={checkboxLabelStyle}
386
388
  checkboxComponentStyles={checkboxComponentStyles}
389
+ checkboxComponent={checkboxComponent}
387
390
  listIndex={listIndex}
388
391
  />
389
392
  </CustomModal>
@@ -47,6 +47,7 @@ export type DropdownProps = {
47
47
  checkboxStyle?: ViewStyle;
48
48
  checkboxLabelStyle?: TextStyle;
49
49
  };
50
+ checkboxComponent?: React.ReactNode;
50
51
  placeholderStyle?: TextStyle;
51
52
  listHeaderComponent?: React.ReactNode;
52
53
  listFooterComponent?: React.ReactNode;