Skip to content

Commit

Permalink
fix(dropdown): fix Dropdown children Penetrate disabled (#2862)
Browse files Browse the repository at this point in the history
* fix(dropdown): fix Dropdown children Penetrate disabled

* fix(dropdown): fix test
  • Loading branch information
HaixingOoO authored Apr 25, 2024
1 parent ee4a2d1 commit 490b327
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { isValidElement, useState } from 'react';
import classNames from 'classnames';
import omit from 'lodash/omit';
import { DropdownOption, TdDropdownProps } from './type';
Expand Down Expand Up @@ -66,6 +66,9 @@ const Dropdown: React.FC<DropdownProps> & {
overlayInnerStyle: style,
};

const child = arrayChildren?.[0];
const dropDownTrigger = isValidElement(child) ? React.cloneElement(child as React.ReactElement, { disabled }) : child;

return (
<Popup
expandAnimation={true}
Expand All @@ -74,7 +77,7 @@ const Dropdown: React.FC<DropdownProps> & {
onVisibleChange={handleVisibleChange}
{...popupParams}
>
{arrayChildren?.[0]}
{dropDownTrigger}
</Popup>
);
};
Expand Down

0 comments on commit 490b327

Please sign in to comment.