mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 21:18:01 +08:00
32 lines
675 B
JavaScript
32 lines
675 B
JavaScript
import React from 'react';
|
|
import { changeConfirmLocale } from '../modal/confirm';
|
|
|
|
export default class LocaleProvider extends React.Component {
|
|
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);
|
|
}
|
|
}
|
|
|
|
LocaleProvider.childContextTypes = {
|
|
antLocale: React.PropTypes.object,
|
|
};
|
|
|
|
LocaleProvider.propTypes = {
|
|
locale: React.PropTypes.object,
|
|
};
|