You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’d like to transition a group of elements with mode="out-in", but there will often be no element to display.
What is the correct way to accommodate for the possibility of no element? I’ve tried doing it like so below, which was working well but of course from the "empty" element you actually need to switch the transition mode to "in-out", or there will be a 500ms delay while the empty element is transitioned out. This looks weird!
So I thought I could change the transition mode below, by setting previousActiveProject in state, but changing the transition mode occasionally seems to yield no transition being run at all – the element will just disappear immediately with no fade.
This was how I handled my case which is slightly different than yours, I know which thing is being hovered and if it's being hovered or not.
<SwitchTransitionmode="out-in">{/* This is required to not leave an always showing card... stupid... */}{isProductHovered ? (<CSSTransitionkey={product.id}timeout={300}classNames="fade"><divclassName={`product-info`}><divclassName="product-info__content"><divclassName="product-info__image"><imgsrc={product.featuredImage}alt={product.title}/></div><divclassName="product-info__name">{product.title}</div><divclassName="product-info__description">{product.description}</div></div></div></CSSTransition>) : (<CSSTransitionkey="empty"timeout={300}classNames="fade"><div></div></CSSTransition>)}</SwitchTransition>
I’d like to transition a group of elements with
mode="out-in"
, but there will often be no element to display.What is the correct way to accommodate for the possibility of no element? I’ve tried doing it like so below, which was working well but of course from the "empty" element you actually need to switch the transition mode to "in-out", or there will be a 500ms delay while the empty element is transitioned out. This looks weird!
So I thought I could change the transition mode below, by setting
previousActiveProject
in state, but changing the transition mode occasionally seems to yield no transition being run at all – the element will just disappear immediately with no fade.Thanks so much for any help on this!
The text was updated successfully, but these errors were encountered: