nice-modal-react
nice-modal-react copied to clipboard
Add ability to resolve/reject and hide
Hey team,
Loving the library and I found that I often would call resolve and hide or reject and hide, and noticed that there was a similar pattern mentioned in #88
This would mean that users are able to do something like:
const {resolveAndHide} = useModal()
return (
<Modal onClose={() => resolveAndHide(false)}>
<p>Content</p>
</Modal>
)
Happy to update with any feedback
Reason for creating new methods was to keep backwards compatibility
Codecov Report
Merging #99 (70fa54b) into main (f146959) will decrease coverage by
2.88%. The diff coverage is25.00%.
@@ Coverage Diff @@
## main #99 +/- ##
===========================================
- Coverage 100.00% 97.12% -2.88%
===========================================
Files 1 1
Lines 201 209 +8
Branches 30 30
===========================================
+ Hits 201 203 +2
- Misses 0 6 +6
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/index.tsx | 97.12% <25.00%> (-2.88%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Hi @adrhumphreys , thanks for the PR! It looks good to me. Could you please also add unit tests for the new APIs so that it would be merged?
Hey @supnate sorry for the long delay, just added in some tests now if you want to have a review over them, thanks