Closed alex-cory closed 3 years ago
Thank you @alex-cory for the suggestion!
Can you provide a bit more background info about this idea? Are there some limitations in the current API design that make it too difficult or impossible to achieve some desired outcome? I'm not sure I'm able to see the benefits of your proposed API design 🤔
It allows you to have shareable sheets, and open them from anywhere in your application.
So, your solution assumes we will be setting the state of the sheet to open from within the same component. For instance, if I have a sheet that needs to be shared throughout the app, the only way to open it is via redux, useContext, or other global state management libraries.
If I have a sharable sheet, I need to be able to open it and give it props. This solves for that too.
It's quite easy to create a custom global sheet system with React context like you mentioned so I'm quite hesitant to completely rewrite the internal sheet API just to support this use case.
I guess we could have an example for this use case in the examples
folder 🤔
I'm closing this issue since it's out of the scope of this library. Feel free to fork this lib if the API is not flexible enough for your needs. Happy hacking! 👨🏼💻
What do you think about syntax like this?
This allows us to reuse the same action sheet throughout the app only having to import it once, and passing different props to it wherever we want to use it.