React-Select onClick on multi tag prevent open dropdown

老子叫甜甜 提交于 2019-12-13 03:02:23

问题


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.


回答1:


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

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

(instead of onClick) on that component.



来源:https://stackoverflow.com/questions/49159086/react-select-onclick-on-multi-tag-prevent-open-dropdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!