react-transition-group icon indicating copy to clipboard operation
react-transition-group copied to clipboard

Css transition classNames get removed by react updates, if child has 'className' props

Open icy0307 opened this issue 3 years ago • 0 comments

What is the current behavior?

CSSTransition add classname to child component by dom API directly, not by react. If react updates after CSSTransition adding class, CSSTransition's class names ,like 'enter-done', get removed by react props.

const [showClassNames, setshowClassNames] = useState(false);
<CSSTransition nodeRef={nodeRef} in={inProp} timeout={200} classNames="my-node">
        <div 
           ref={nodeRef}
           className={showClassNames? "anyClassName": ""}
           onClick={() => {setshowClassNames(true)}
         >
          {"I'll receive my-node-* classes"}
        </div>
</CSSTransition>

What is the expected behavior?

CSSTransition's class names remains , even if child component updates with class

Could you provide a CodeSandbox demo reproducing the bug?

https://codesandbox.io/s/morning-pond-xu2e9l

icy0307 avatar Sep 26 '22 08:09 icy0307