Closed shubhamdeol closed 2 years ago
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:
- 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!
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?