Merge pull request #15156 from ant-design/date-picker-popup

fix configProvider getPopupContainer not work with DatePicker
This commit is contained in:
偏右 2019-03-04 19:04:27 +08:00 committed by GitHub
commit 19d916fd20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,13 +130,15 @@ export default function wrapPicker(Picker: React.ComponentClass<any>, pickerType
return ( return (
<ConfigConsumer> <ConfigConsumer>
{({ getPrefixCls }: ConfigConsumerProps) => { {({ getPrefixCls, getPopupContainer: getContextPopupContainer }: ConfigConsumerProps) => {
const { const {
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
inputPrefixCls: customizeInputPrefixCls, inputPrefixCls: customizeInputPrefixCls,
getCalendarContainer,
size, size,
disabled, disabled,
} = this.props; } = this.props;
const getPopupContainer = getCalendarContainer || getContextPopupContainer;
const prefixCls = getPrefixCls('calendar', customizePrefixCls); const prefixCls = getPrefixCls('calendar', customizePrefixCls);
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls); const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
const pickerClass = classNames(`${prefixCls}-picker`, { const pickerClass = classNames(`${prefixCls}-picker`, {
@ -170,6 +172,7 @@ export default function wrapPicker(Picker: React.ComponentClass<any>, pickerType
return ( return (
<Picker <Picker
{...this.props} {...this.props}
getCalendarContainer={getPopupContainer}
format={mergedFormat} format={mergedFormat}
ref={this.savePicker} ref={this.savePicker}
pickerClass={pickerClass} pickerClass={pickerClass}