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

calling openModal with same modal opens that modal again over previous modal #71

Closed
shubhamdeol opened this issue Mar 24, 2022 · 1 comment
Assignees
Labels
wontfix This will not be worked on

Comments

@shubhamdeol
Copy link

  • I have a button on press of which I open a modal.
  • when users clicking over button multiple times very quickly multiple instances of same modal gets created.
  • One way I can fix this by using event throttle when calling the open modal. I feel App becomes slow when modal content is more. So users pressed the modal open buttons multiple times as a results multiple instances of modal gets created.

When using Modal component shipped with React Native, It always stays in DOM and accepts the prop visible to be true or false. So it feels faster.
But I think when using this library. You Modal Component gets added to DOM only when openModal is called.

Can we make modal opening little bit more performant?

@CharlesMangwa CharlesMangwa self-assigned this Apr 24, 2022
@CharlesMangwa CharlesMangwa added the wontfix This will not be worked on label Apr 24, 2022
@CharlesMangwa
Copy link
Member

Hey @shubhamdeol!

Regarding your 1st comment: Modalfy purposefully does not manage how many times a modal is being opened. It is actually in our philosophy to let you:

  1. Display several modals at once, stack as many as you like.

That's why you indeed are the one responsible for debouncing the actions that lead to a modal opening.

Regarding your 2nd comment, this is a tradeoff we have to pay for using a JavaScript solution. As you may already know, React Native's Modal uses a native modal View under the hood. The clear advantage there is the one you mentioned: speed. The drawback - that was also a motivation for use to create Modalfy - is that: it doesn't allow you to have multiple modals at once. Those 2 things combined make it much easier to use a single Modal and just have to update its content.

But because Modalfy doesn't know which and how many modals you'll be opening and closing, the same approach wouldn't really be a viable option for us.

However, if you already have ideas about how to make opening modals more performant: I'll be more than happy to review any PR you'd submit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants