admin管理员组文章数量:1390610
I am upgrading version of react-select to 5.10.0 and onClick event on custom clear icon is stopped working, previously *react select 5.2.2 it was working.
Here I added codesanbox
<Select
closeMenuOnSelect={false}
components={{ ClearIndicator }}
styles={{ clearIndicator: ClearIndicatorStyles }}
defaultValue={[colourOptions[4], colourOptions[5]]}
isMulti
options={colourOptions}
/>
const ClearIndicator = (props: ClearIndicatorProps<ColourOption, true>) => {
const {
children = <CustomClearText />,
getStyles,
innerProps: { ref, ...restInnerProps },
} = props;
return (
<div
{...restInnerProps}
ref={ref}
onClick={handleClick}
style={getStyles("clearIndicator", props) as CSSProperties}
>
<div style={{ padding: "0px 5px" }}>{children}</div>
</div>
)};
const handleClick = (e) => { // this is not executing
e.preventDefault();
console.log("handle some logic");
};
Thanks in advance.
本文标签:
版权声明:本文标题:reactjs - react select ClearIndicator with custom Onclick event is not working in latest version 10.0.0 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744708754a2620999.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论