mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
fix: detect antd button by children.type.[staticProperty] instead of same class for HOC case (#19042)
This commit is contained in:
parent
b536643f76
commit
049799ed0f
@ -92,7 +92,10 @@ export default class Search extends React.Component<SearchProps, any> {
|
|||||||
|
|
||||||
let button: React.ReactNode;
|
let button: React.ReactNode;
|
||||||
const enterButtonAsElement = enterButton as React.ReactElement<any>;
|
const enterButtonAsElement = enterButton as React.ReactElement<any>;
|
||||||
if (enterButtonAsElement.type === Button || enterButtonAsElement.type === 'button') {
|
const isAntdButton =
|
||||||
|
enterButtonAsElement.type &&
|
||||||
|
(enterButtonAsElement.type as typeof Button).__ANT_BUTTON === true;
|
||||||
|
if (isAntdButton || enterButtonAsElement.type === 'button') {
|
||||||
button = React.cloneElement(enterButtonAsElement, {
|
button = React.cloneElement(enterButtonAsElement, {
|
||||||
onClick: this.onSearch,
|
onClick: this.onSearch,
|
||||||
key: 'enterButton',
|
key: 'enterButton',
|
||||||
|
Loading…
Reference in New Issue
Block a user