Fix Unknown prop placement warning of Dropdown.Button, close #5594

This commit is contained in:
afc163 2017-04-01 18:06:40 +08:00
parent 58e521de71
commit ec87110482
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ const menu = (
ReactDOM.render(
<div>
<Dropdown.Button onClick={handleButtonClick} overlay={menu}>
<Dropdown.Button onClick={handleButtonClick} overlay={menu} placement="bottomLeft">
Dropdown
</Dropdown.Button>
<Dropdown.Button

View File

@ -18,6 +18,7 @@ export interface DropdownButtonProps {
onVisibleChange?: (visible: boolean) => void;
style?: React.CSSProperties;
children?: any;
placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
}
export default class DropdownButton extends React.Component<DropdownButtonProps, any> {
@ -38,7 +39,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
render() {
const {
type, overlay, trigger, align, children, className, onClick, prefixCls,
disabled, visible, onVisibleChange, ...restProps,
disabled, visible, onVisibleChange, placement, ...restProps,
} = this.props;
const cls = classNames(prefixCls, className);
@ -47,6 +48,7 @@ export default class DropdownButton extends React.Component<DropdownButtonProps,
overlay,
trigger: disabled ? [] : trigger,
onVisibleChange,
placement,
};
if ('visible' in this.props) {