react-native-sectioned-multi-select icon indicating copy to clipboard operation
react-native-sectioned-multi-select copied to clipboard

Separate parentSelectedItems and subSelectedItems

Open sjelena97 opened this issue 2 years ago • 2 comments

There is no option to get only parent selected items and only subSelectedItems...It's all in one array... Also if you have selected [1, 2, 3] it will select both parent and sub items with that ids(unique key)...

sjelena97 avatar Jul 02 '22 15:07 sjelena97

As a workaround for this issue you can set showDropDowns to false and structure your items array as follows (using the example array):

const items = [
  {
    name: '',
    id: 0,
    children: [
      {
        name: 'Apple',
        id: 10,
      },
      {
        name: 'Strawberry',
        id: 17,
      },
      {
        name: 'Pineapple',
        id: 13,
      },
      {
        name: 'Banana',
        id: 14,
      },
      {
        name: 'Watermelon',
        id: 15,
      },
      {
        name: 'Kiwi fruit',
        id: 16,
      },
    ],
  },
];

By doing this you will only have one useless parent item and all your items will be children to it.

jorge-cob avatar Jul 05 '22 15:07 jorge-cob

All ids must be unique. This has been discussed a bit here https://github.com/renrizzolo/react-native-sectioned-multi-select/issues/33, although there was no real consensus, and fixing this would be a breaking change.

renrizzolo avatar Jul 21 '22 03:07 renrizzolo

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 04 '22 03:09 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Sep 10 '22 03:09 github-actions[bot]