nkbt/react-collapse

Fade in/fade out with opacity style on open/close

Closed this issue · 1 comments

Hi there,

I was wondering if it would be possible to add a fade in/fade out effect on open/close. I've already tried the following, as well as using onWork, but with no luck:

<Collapse isOpened={open} initialStyle={{ opacity: open ? 1 : 0 }}>
	...
</Collapse>

EDIT: Looking at it closer, initialStyle only supports the overflow and height properties...

Nevermind. Solution:

<Collapse isOpened={open} ref={el => {
	if (el && el.container)
		el.container.style.opacity = (el.container.style.opacity === '0' ? '1' : '0');
}}>
	...
</Collapse>

Unfortunately doesn't work with UnmountClosed.