hossein-zare / react-native-dropdown-picker

A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.
https://hossein-zare.github.io/react-native-dropdown-picker-website/
MIT License
970 stars 294 forks source link

Update icon after item is selected #663

Open danielnmai opened 1 year ago

danielnmai commented 1 year ago

I'm just wondering if it's possible to update the icon to a "checked" state after an item is checked (not the TickIcon). Something like this:

image

I tried to manipulate the entire item list from setItems() with onSelectItem() but it does not work.

  const onSelectItem = item => {
    const selectedJobTypes = JOB_TYPES.map(type => ({
      label: type.label,
      value: type.value,
      icon: value.includes(type.value) ? <CheckedBox /> : <UncheckedBox />,
    }));
    setItems(selectedJobTypes);
  };