react-native-material-dropdown icon indicating copy to clipboard operation
react-native-material-dropdown copied to clipboard

Disable individual drop down item

Open connercms opened this issue 7 years ago • 6 comments
trafficstars

I see in the documentation that there is the disabledItemColor prop, but how do you disable an individual drop down item?

connercms avatar Jun 20 '18 15:06 connercms

I am also facing the same issue, referred to the example which is using props: { disabled: true } property but after using the same also, disabledItemColor not working at all.

I have used a trick to do that which is: <Text style={{ color: disabled? 'grey' : 'black' }}></Text> but it will show [object object] after selecting that item because you will select an element here not the text.

Hence there no way to stop selecting a disable item here.

rahulbansal89 avatar Sep 12 '18 12:09 rahulbansal89

I am also facing same issue. How we can disable an item in dropdown.

hiteshgoyal18 avatar Jan 30 '19 11:01 hiteshgoyal18

Anyone able to successfully disable individual drop down item? I can't get it to work. i tried using propsExtractor but the props value only return undefined. Please help

myhendry avatar Apr 07 '19 01:04 myhendry

I am also facing the same issue. Plz help

navanit-jha avatar Feb 25 '20 13:02 navanit-jha

You can disable individual items using propsExtractor. For instance I used this method to disable items with a falsy value.

propsExtractor={item => { if (!item.value) { return { disabled: true }; } else { return {}; } }}

shreyansh-g24 avatar May 13 '20 09:05 shreyansh-g24

The above works to disable items. However if you are looking to scroll, the disabled items don't respond to dragging.

steveZak avatar Jun 21 '20 23:06 steveZak