-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
innerProps for menuList not applied. #4265
Comments
@supersheen Unfortunately the example does not show what you are trying to accomplish / proof. Could you perhaps update the example? |
Thanks your reponse @Rall3n yes the example doesn't work, I am trying to figure it out. Here |
@supersheen You can override the style using the styling framework. Removing the styles for <Select
styles={{
menuList: ({ paddingTop, paddingBottom, ...baseStyles }, props) => baseStyles
}}
/> |
thanks @Rall3n, I thought about that. Does it mean |
@supersheen I wanted to revisit your question as I wasn't sure it was completely resolved. @Rall3n seems to have already answered your concern on styling the component. It seems that MenuList is unique in that it does not spread innerProps into the element as you can see here What you would have to do is either add a parent container: const MenuList = ({ children, ...props }) => <components.MenuList {{...props}}><div data-role="menuList">{children}</div></components.MenuList> Or create your own MenuList if you didn't want to risk introducing new DOM elements: const MenuList = props => {
const { children, className, cx, getStyles, isMulti, innerRef } = props;
return (
<div
css={getStyles('menuList', props)}
className={cx(
{
'menu-list': true,
'menu-list--is-multi': isMulti,
},
className
)}
ref={innerRef}
data-role="menuList"
>
{children}
</div>
); I am not quite sure why innerProps is treated differently here vs other components and will look into getting a response so we can have better clarity if it's a bug or by design. |
Hi mates. Where I can find types for this list of props?
|
react-select/packages/react-select/src/components/Menu.tsx Lines 379 to 394 in 3d33e7d
Which extends react-select/packages/react-select/src/types.ts Lines 80 to 114 in 3d33e7d
|
@Methuselah96 Sorry mate, how can I use it in my case? I can't get it... When I use it like this
I'm getting errors in Select component. |
Can you create a CodeSandbox with an example of what you're trying to do? |
I am trying to remove the top and bottom white margin between menu and menuList, but seems the innerProp is not applied, here is example. Can you have a look and let me know why? thanks.
https://codesandbox.io/s/react-select-v3-sandbox-forked-xe8ms?file=/example.js
The text was updated successfully, but these errors were encountered: