Search code examples
javascriptreactjsantd

How to add preventDefault on element, that was rendered by UI lib (antd)?


I'm using Select with a RangePicker inside (React app). The problem is that RP rendering dropdown calendar in body tag and when I press on it Select is closing. As I understand it will be fixed if I put click event prevent defaut. Is there a way to do it?

<body>
    <root>
        <div classname=app>
           My select is a n-th (may be like 7-10) child of this tag 
        </div>
    </root>
    <div>
        <dropdown /> <---- that I need to add prevent default
    </div>
</body>

Solution

  • There is a dropdownRender property in the Select component. With it you can customize the render of the component (parent of render, styles, properties etc).