Reset app bar height to 0 on unmount

This commit is contained in:
schroda
2024-07-13 15:35:34 +02:00
parent 5632c4584b
commit 847a5c68b2
3 changed files with 4 additions and 5 deletions

View File

@@ -22,13 +22,12 @@ export const MobileBottomBar = ({ navBarItems }: { navBarItems: NavbarItem[] })
const location = useLocation();
const navigate = useNavigate();
useEffect(() => () => setBottomBarHeight(0), []);
const ref = useRef<HTMLDivElement | null>(null);
useResizeObserver(
ref,
useCallback(() => setBottomBarHeight(ref.current?.clientHeight ?? 0), [ref]),
);
useEffect(() => () => setBottomBarHeight(0), []);
const [selectedNavBarItem, setSelectedNavBarItem] = useState(
navBarItems.find((navBarItem) => navBarItem.path === location.pathname)?.path,