Skip to content

transition doesn't work under <Styled></Styled> #3

@solayao

Description

@solayao

hi,
when i use the model i found the css transition didn't work as normal.
and the demo such like this:

const Styled = createStyled(theme => ({
      appBar: {
       width: '100%',
        transition: theme.transitions.create(['margin', 'width'], {
          easing: theme.transitions.easing.sharp,
          duration: theme.transitions.duration.leavingScreen,
        }),
      },
      appBarShift: {
       width: '50%',
        transition: theme.transitions.create(['margin', 'width'], {
          easing: theme.transitions.easing.easeOut,
          duration: theme.transitions.duration.enteringScreen,
        }),
      },
    }), { withTheme: true });

 <MyHeader className={classNames(showDrawler ? classes.appBar : classes.appBarShift)} />

falsedemo

but it work like this

@withStyles((theme) => ({
  appBar: {
    width: '100%',
    transition: theme.transitions.create(['margin', 'width'], {
      easing: theme.transitions.easing.sharp,
      duration: theme.transitions.duration.leavingScreen,
    }),
  },
  appBarShift: {
    width: '50%',
    transition: theme.transitions.create(['margin', 'width'], {
      easing: theme.transitions.easing.easeOut,
      duration: theme.transitions.duration.enteringScreen,
    }),
  },
}), {withTheme: true})
class TestHeader extends Component {
   render() {
    const { classes } = this.props;
     return (
        <MyHeader className={classNames(showDrawler ? classes.appBar : classes.appBarShift)} />
     )
 }
}

true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions