Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable a menu item #291

Open
jobberma opened this issue Aug 17, 2024 · 1 comment
Open

Disable a menu item #291

jobberma opened this issue Aug 17, 2024 · 1 comment

Comments

@jobberma
Copy link

Hello,

The plugin is great. I need to make a parent category menu item disabled.

Is there a way to do that ?

Thanks

@DanBizu
Copy link

DanBizu commented Nov 6, 2024

I also needed this, seems like the library has some default behavior for the dropdown items and there is no way to overwrite it. Yet I was able to achieve something in a counterintuitive way, by wrapping the items in a Pressable, like so:

renderItem={(item) => (<Pressable
     disabled={item.isEnabled}
     style={[
        styles.dropdownItemStyle,
        !item.isEnabled && styles.dropdownItemDisabled,
     ]}
  >
     <Text>{item.text}</Text>
  </Pressable>)

Not sure I fully understand why it works, as you can notice, the disable/enable logic is reversed, my theory is that the Pressable captures all the press events, this way preventing the default behavior of the item press.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants