Releases: mbrookson/react-simple-hook-modal
v1.1.0
v1.0.1
A recent change in v1.0.0 (#11) introduced the use of a React portal to render modals. This depends on window.document which is not available server-side.
This version fixes SSR in frameworks like Next.js by ensuring window.document
exists before trying to use it. This means cannot be rendered on the server, but generally this isn't going to required.
v1.0.0!
Considering this now production ready since I'm using the version from npm in my own side project. I'll continue to improve as and where becomes necessary, or when issues are raised.
v1 has a breaking change.
- Use standard React
children
instead of thecontent
prop onModal
which has now been removed.
This version nw uses React portal and fixes an issue where you couldn't access a wrapper context inside Modal
content because the actual ModalContainer was outside of the context due to how I hacked the hierarchy around how the modals were rendered. Using portal resolves this issue as the components are rendered in the correct hierarchy which is separate to the DOM structure.
Enjoy!
v0.2.0 - Transitions!
Adds the ability to apply transitions to the modal. #1 #5
There are for options which are as follows:
- NONE
- Disables transitions
- SCALE
- Scales the modal from the centre
- TOP_DOWN
- Slides down from the top of the screen to the centre
- BOTTOM_UP
- Slides up from the bottom of the screen to the centre
These can be set by importing the ModalTransition
enum from the library, and setting the transition
prop on <Modal />
.