reactjs - react select ClearIndicator with custom Onclick event is not working in latest version 10.0.0 - Stack Overflow

I am upgrading version of react-select to 5.10.0 and onClick event on custom clear icon is stopped work

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744708759a4589213.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信