Blue - v0.0.11
Improve Portal mount cycle
This update improves the lifecycle callbacks for Portal and PortalWrapper. Portal has been adjusted to allow for re-rendering of child components based on prop changes, which is handy (and necessary) for things like child unmounting animations or style
prop changes (will come in handy for Popover
/Tooltip
).
A new prop from Portal has been exposed in PortalWrapper called isMounted
. It is similar to isOpen
, but it's state is changed slightly before isOpen
, allowing for child components to execute callbacks that need to happen before the Portal child is removed from the DOM (like Animations).
Example
import Animate from '../Animate'
import Overlay from '../Overlay'
import PortalWrapper from '../PortalWrapper'
const portalOptions = {
id: 'MyModal',
timeout: 400
}
const MyModal = props => {
const {
children,
closePortal,
portalIsOpen
} = props
return (
<Animate sequence='fadeIn down' in={portalIsOpen} wait={300}>
<div className='MyModal'>
<div className='MyModalContent'>
{children}
</div>
<Overlay onClick={closePortal} />
</div>
</Animate>
)
}
export default PortalWrapper(portalOptions)(MyModal)
Previous component APIs are not affected, therefore nothing is required for the user/consumer of Blue components.
Tests + README documentation has been updated.