-
Notifications
You must be signed in to change notification settings - Fork 0
transition doesn't work under <Styled></Styled> #3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Thanks for the report, I just wanted to check, are you wrapping with Styled like this inside your render function? I didn't see it in your first code sample but maybe you just omitted it: <Styled>
{({classes}) => (
<MyHeader className={classNames(showDrawler ? classes.appBar : classes.appBarShift)} />
)}
</Styled> |
yes, i had just did that. |
@solayao okay, thanks! Let me know if this works: import React, { Component } from 'react';
import Proptypes from 'prop-types';
import classNames from 'classnames';
import { withRouter } from 'react-router-dom';
import { observer, inject } from 'mobx-react';
import Routes from './Routes';
import './App.css';
import MyHeader from '../components/MaterialComponents/AppBarHeader';
import MyFooter from '../components/FooterComponent';
import DrawerModel from '../components/MaterialComponents/DrawerModel';
import CssBaseline from '@material-ui/core/CssBaseline';
import createStyled from 'material-ui-render-props-styles';
const styles = (theme) => ({
appBar: {
transition: theme.transitions.create(['margin', 'width'], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
},
appBarShift: {
transition: theme.transitions.create(['margin', 'width'], {
easing: theme.transitions.easing.easeOut,
duration: theme.transitions.duration.enteringScreen,
}),
},
drawerPaper: {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
},
});
const Styled = createStyled(styles);
@withRouter
@inject('store')
@observer
class App extends Component {
render() {
const { store, classes } = this.props;
const { showDrawler } = store;
return (
<Styled>
{
({classes}) => (
<div className="App">
<CssBaseline />
<MyHeader orClassName={classNames(showDrawler && 'dUi-ab-shift', showDrawler ? classes.appBar : classes.appBarShift)} />
<DrawerModel open={showDrawler} />
<div className="ignore"><Routes /></div>
<MyFooter />
</div>
)
}
</Styled>
);
}
}
App.propTypes = {
store: Proptypes.object,
}
export default App; |
@jedwards1211 thanks a lot, it worked! |
@jedwards1211 Anyway, i found your model isn't support es5.
and i found the reason from CRA Issues is that module not providing an ES5 distro. |
Hmmm, this module provides both ES5 and ES6. ES5 is at
The CRA docs almost make it sound like it should be able to handle this situation but I don't think it actually does. I think it defaults to using import createStyled from 'material-ui-render-props-styles/index' |
yes, this way actually bulid successful. thanks a lot. |
@solayao you're welcome. I'm looking into whether making a PR to create-react-app to tell webpack to prioritize the |
@solayao alright my PR to make this easier for |
hi,
when i use the model i found the css transition didn't work as normal.
and the demo such like this:
but it work like this
The text was updated successfully, but these errors were encountered: