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

Is there any way to lazily create the DropdownMenu items? #114

Open
gaearon opened this issue Nov 18, 2024 · 0 comments
Open

Is there any way to lazily create the DropdownMenu items? #114

gaearon opened this issue Nov 18, 2024 · 0 comments

Comments

@gaearon
Copy link

gaearon commented Nov 18, 2024

I realize this may be a request to react-native-menu, but I'll file here.

Currently we specify dropdown menu content by putting stuff into <DropdownMenu.Content>. The problem is that we have to put it there eagerly. In other words, we have to prepare <DropdownMenu.Item>s in the parent component in case the menu gets opened. The downside is that their event handlers might need certain Hooks (e.g. RQ useMutation) so we end up bloating the parent component render time even if the menu never gets opened.

Ideally I'd like to be able to split the content so that it's lazily initialized, but there doesn't seem to be a way to do that. I was hoping to do something like rendering it conditionally based on state driven by <DropdownMenuRoot onOpenWillChange> but that doesn't seem possible either (the event simply doesn't exist on Android).

Is there any way to achieve what I want?

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

1 participant