Skip to content

CSSTransition child with dynamic className #318

Open
@jesperjohansson

Description

@jesperjohansson

Do you want to request a feature or report a bug?
Bug, I think.

What is the current behavior?
Whenever I update my component with a dynamic className, all the classNames from CSSTransition disappear from the child element.

<Popover.Container
  className={classNames('notificationCenter__popover', {
    '-grayArrow': tabIndex === 0, /* <-- dynamic className */
  })}
>
  /* random child */
</Popover.Container>
export const Container = ({ className, children }) => (
  <PopoverContext.Consumer>
    {context => (
      <CSSTransition
        in={context.isOpen}
        classNames={ANIM_CLASSNAMES}
        timeout={context.isOpen ? ANIM_DURATION.default : ANIM_DURATION.fast}
        mountOnEnter
        unmountOnExit
      >
        <div id={context.id} className={classNames('popover', className)}> /* <-- insert className */
          {children}
        </div>
      </CSSTransition>
    )}
  </PopoverContext.Consumer>
);

What is the expected behavior?
The resulting element should include both the "dynamic" className that comes from the className prop as well as the class names from CSSTransition.

Which versions, and which browser / OS are affected by this issue? Did this work in previous versions?
react-transition-group@^2.3.0
MacOS High Sierra 10.13.2, Google Chrome 65.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions