UNPKG

jimu-mobile

Version:

积木组件库助力移动端开发

31 lines (25 loc) 575 B
import React from 'react'; import PropTypes from 'prop-types'; export interface LocaleProviderProps { locale: {}; children?: React.ReactElement<any>; } export default class LocaleProvider extends React.Component<LocaleProviderProps, any> { static propTypes = { locale: PropTypes.object, }; static childContextTypes = { jimuLocale: PropTypes.object, }; getChildContext() { return { jimuLocale: { ...this.props.locale, exist: true, }, }; } render() { return React.Children.only(this.props.children); } }