React-Select onClick on multi tag prevent open dro

2019-08-19 10:18发布

I'm using a fork of React-Select for a project adding customized functionality. I'm trying to disable the dropdown from opening when a user clicks on one of the tags (When multi is set to true). So if a user clicks on one of the tags the dropdown menu won't open. I went over Value.js file to see if I could find the isOpen state triggered by clicking on the tags but couldn't find it.

Here's a screenshot illustrating what I mean. enter image description here

1条回答
混吃等死
2楼-- · 2019-08-19 10:35

In case if used custom tag component (valueComponent) try to use:

onMouseDown = (e) => e.stopPropagation();

(instead of onClick) on that component.

查看更多
登录 后发表回答