Material UI - Drawer does not open

帅比萌擦擦* 提交于 2019-12-02 10:47:54

it s crazy but the issue was with the combination:

"@material-ui/core": "^1.2.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",

As soon as I ve updated my dependencies to those of Ramil in his codesandbox, it worked.

"@material-ui/core": "1.2.3",
"react": "^16.3.0",
"react-dom": "^16.3.0",

I hope this helps someone..

I don't know where you got this onLeftIconButtonTouchTap={this.handleMenu.bind(this)}

But what you can do is:

<AppBar position="static">
    <IconButton
        className={classes.menuButton}
        color="inherit"
        aria-label="Menu"
        onClick={this.handleMenu.bind(this)}
    >
        <MenuIcon />
    </IconButton>
    <Toolbar>
        <TemporaryDrawer
            isOpen={drawerOpen}
            toggleDrawer={this.handleMenu}
        />
    </Toolbar>
</AppBar>

Edit: I tried your code in sandbox. Apparently, nothing is wrong with your code. https://codesandbox.io/s/pk9921kkw0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!