react-native-sectioned-multi-select
react-native-sectioned-multi-select copied to clipboard
Separate parentSelectedItems and subSelectedItems
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)...
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.
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.
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.
This issue was closed because it has been stalled for 5 days with no activity.