mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
21ec9cb985
Similar to issue:
https://github.com/ant-design/ant-design/issues/4140
Fixed in similar manner to how this issue was resolved:
a28743f648 (diff-9ae0a9df19960a2d1b9608f30f6b19b3)
children?: React.ReactElement<any>
51 lines
1004 B
TypeScript
51 lines
1004 B
TypeScript
import React from 'react';
|
|
import { changeConfirmLocale } from '../modal/locale';
|
|
|
|
export interface LocaleProviderProps {
|
|
locale: {
|
|
Pagination?: Object,
|
|
DatePicker?: Object,
|
|
TimePicker?: Object,
|
|
Calendar?: Object,
|
|
Table?: Object,
|
|
Modal?: Object,
|
|
Popconfirm?: Object,
|
|
Transfer?: Object,
|
|
Select?: Object,
|
|
};
|
|
children?: React.ReactElement<any>;
|
|
}
|
|
|
|
export default class LocaleProvider extends React.Component<LocaleProviderProps, any> {
|
|
static propTypes = {
|
|
locale: React.PropTypes.object,
|
|
};
|
|
|
|
static childContextTypes = {
|
|
antLocale: React.PropTypes.object,
|
|
};
|
|
|
|
getChildContext() {
|
|
return {
|
|
antLocale: this.props.locale,
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.componentDidUpdate();
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
const { locale } = this.props;
|
|
changeConfirmLocale(locale && locale.Modal);
|
|
}
|
|
|
|
componentWillUnMount() {
|
|
changeConfirmLocale();
|
|
}
|
|
|
|
render() {
|
|
return React.Children.only(this.props.children);
|
|
}
|
|
}
|