Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Using Material UI Sidebar #163

Open
haruki-nimbus opened this issue Jun 3, 2021 · 0 comments
Open

Using Material UI Sidebar #163

haruki-nimbus opened this issue Jun 3, 2021 · 0 comments

Comments

@haruki-nimbus
Copy link

haruki-nimbus commented Jun 3, 2021

This is a minor UI issue, but I created a sidebar with material-ui as below (this is a simplified verison):

import { MenuItem, SwipeableDrawer } from '@material-ui/core';
import { setLinkProps } from 'hookrouter';

const A = React.forwardRef(
  (props, ref) => <a ref={ref} {...setLinkProps(props)} />
);

// render
<SwipeableDrawer>
  {routes.map(route => (
    <MenuItem
       href={route.path}
       component={A}
       selected={/* route.path matches URL */}
       // other props
    >
      {route.title}
    </MenuItem>
  ))}
</SwipeableDrawer>

This works great, except the ripple effect on the MenuItem gets interrupted because the navigate function rerenders the sidebar. Any ideas on how to fix this?

I had the same setup when I was using import { Link } from 'react-router-dom', but that didn't interrupt the ripple animation when navigating from the sidebar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant