Fix props passing of AutoComplete, ref #7742

This commit is contained in:
afc163 2017-09-30 21:17:49 +08:00
parent 084d4e6d49
commit 76a30a7686
2 changed files with 5 additions and 2 deletions

View File

@ -50,7 +50,7 @@ class Complete extends React.Component {
onSearch={this.handleSearch}
placeholder="input here"
>
<TextArea onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
<TextArea className="xxx" onKeyPress={this.handleKeyPress} style={{ height: 50 }} />
</AutoComplete>
);
}

View File

@ -51,8 +51,11 @@ export default class AutoComplete extends React.Component<AutoCompleteProps, any
const { children } = this.props;
const element = children && React.isValidElement(children) && children.type !== Option ?
React.Children.only(this.props.children) : <Input />;
const elementProps = { ...element.props };
// https://github.com/ant-design/ant-design/pull/7742
delete elementProps.children;
return (
<InputElement>{element}</InputElement>
<InputElement {...elementProps}>{element}</InputElement>
);
}