์ฌ์ฉํ ์ฝ๋๋ ๋ค์๊ณผ ๊ฐ๋ค.
<Menu
anchorEl={anchorEl}
getContentAnchorEl={null} // ์ด ์ฝ๋๋ฅผ ์ถ๊ฐํด์ฃผ์ด์ผํ๋ค.
keepMounted
anchorOrigin={{
vertical: 'bottom', // ์ด๋ ๊ฒ ์กฐ์ ํ๋ ค๋ฉด getContentAnchorEl์ settingํด์ฃผ์ด์ผํจ
horizontal: 'left',
}}
open={anchorEl !== null}
onClose={handleClose}
className="color-picker"
>
{
colorArr.map(...)
}
</Menu>
ํด๋น ์ฝ๋๋ ์ ์๋์ํ์ง๋ง, ํ์๋ getContentAnchorEl์ ์์ฑ์ผ๋ก ์ค์ ํ์ง ์์ผ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฌ๋ค.
Material-UI: You can not change the default `anchorOrigin.vertical` value
when also providing the `getContentAnchorEl` prop to the popover component.
Only use one of the two props.
Set `getContentAnchorEl` to `null | undefined` or leave `anchorOrigin.vertical` unchanged.
material-ui์ popover ์ปดํฌ๋ํธ API๋ฅผ ์ดํด๋ณด์๋ค.
material-ui.com/api/popover/#popover-api
Popover API - Material-UI
The API documentation of the Popover React component. Learn more about the props and the CSS customization points.
material-ui.com
API์์ getContentAnchorEl์ content anchor element๋ฅผ ๊ฒ์ํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ฉฐ, content anchor element๋ anchor element ๋ฐ๋ก ์์ ์์นํ๋ค๊ณ ํ๋ค.
๋ฐ๋ผ์ null๋ก ๋ฑ๋กํด์ฃผ๋ฉด ๊ธฐ์กด์ anchorEl ์์ฑ์ผ๋ก ๋ฑ๋กํ anchor element๊ฐ ์์น์ ๊ธฐ์ค์ด ๋๋ฉด์ popover์ ์์น๊ฐ ์ ๋๋ก ์กํ๋ค.
Comment