fix(navbar-menu): dismiss buttons removed to fix the scroll (#1549)

This commit is contained in:
Junior Garcia 2023-09-02 12:41:38 -03:00 committed by GitHub
parent d8d2b87cb8
commit 59fda3772f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -0,0 +1,5 @@
---
"@nextui-org/navbar": patch
---
Navbar menu scroll fixed

View File

@ -5,7 +5,7 @@ import {AnimatePresence, HTMLMotionProps, motion} from "framer-motion";
import {mergeProps} from "@react-aria/utils";
import {ReactElement, useCallback} from "react";
import {RemoveScroll} from "react-remove-scroll";
import {Overlay, DismissButton} from "@react-aria/overlays";
import {Overlay} from "@react-aria/overlays";
import {menuVariants} from "./navbar-menu-transitions";
import {useNavbarContext} from "./navbar-context";
@ -27,8 +27,7 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => {
const {className, children, portalContainer, motionProps, style, ...otherProps} = props;
const domRef = useDOMRef(ref);
const {slots, isMenuOpen, setIsMenuOpen, height, disableAnimation, classNames} =
useNavbarContext();
const {slots, isMenuOpen, height, disableAnimation, classNames} = useNavbarContext();
const styles = clsx(classNames?.menu, className);
@ -36,11 +35,7 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => {
({children}: {children: ReactElement}) => {
return (
<RemoveScroll forwardProps enabled={isMenuOpen} removeScrollBar={false}>
<>
<DismissButton onDismiss={() => setIsMenuOpen(false)} />
{children}
<DismissButton onDismiss={() => setIsMenuOpen(false)} />
</>
{children}
</RemoveScroll>
);
},