diff --git a/components/input/Search.tsx b/components/input/Search.tsx index e6a7a8feae..4d2be41e34 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -74,11 +74,11 @@ export default class Search extends React.Component { const buttonOrIcon = this.getButtonOrIcon(); let searchSuffix = suffix ? [suffix, buttonOrIcon] : buttonOrIcon; if (Array.isArray(searchSuffix)) { - searchSuffix = searchSuffix.map((item, index) => { - if (!React.isValidElement(item)) { + searchSuffix = (searchSuffix as React.ReactElement[]).map((item, index) => { + if (!React.isValidElement(item) || item.key) { return item; } - return React.cloneElement((searchSuffix as React.ReactElement[])[index], {key: index}); + return React.cloneElement(item, {key: index}); }); } const inputClassName = classNames(prefixCls, className, {