Skip to content

Commit

Permalink
fix: Add ChakraMenu to provide context for MenuIcon dependency
Browse files Browse the repository at this point in the history
This is required because of the issue in the latest Chakra UI release where useMenuStyles will break the app.
  • Loading branch information
malinskibeniamin committed Jul 24, 2023
1 parent a1dad5b commit c25e501
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/chakra-components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Box } from "@chakra-ui/layout";
import { MenuIcon } from "@chakra-ui/menu";
import type { SystemStyleObject } from "@chakra-ui/system";
import { useColorModeValue, useMultiStyleConfig } from "@chakra-ui/system";
import { Menu as ChakraMenu } from '@chakra-ui/menu'
import type {
CoercedMenuPlacement,
GroupBase,
Expand Down Expand Up @@ -449,13 +450,16 @@ export const Option = <
aria-disabled={isDisabled ? true : undefined}
>
{showCheckIcon && (
<MenuIcon
fontSize="0.8em"
marginEnd="0.75rem"
opacity={isSelected ? 1 : 0}
>
<CheckIcon />
</MenuIcon>
{/* Need to provide Menu Context to MenuIcon */}
<ChakraMenu>
<MenuIcon
fontSize="0.8em"
marginEnd="0.75rem"
opacity={isSelected ? 1 : 0}
>
<CheckIcon />
</MenuIcon>
</ChakraMenu>
)}
{children}
</Box>
Expand Down

0 comments on commit c25e501

Please sign in to comment.