UNPKG

1.27 kBTypeScriptView Raw
1import * as React from 'react';
2import { IntlConfig, IntlShape } from '../types';
3import { IntlCache, CreateIntlFn } from '@formatjs/intl';
4interface State {
5 /**
6 * Explicit intl cache to prevent memory leaks
7 */
8 cache: IntlCache;
9 /**
10 * Intl object we created
11 */
12 intl?: IntlShape;
13 /**
14 * list of memoized config we care about.
15 * This is important since creating intl is
16 * very expensive
17 */
18 prevConfig: IntlConfig;
19}
20/**
21 * Create intl object
22 * @param config intl config
23 * @param cache cache for formatter instances to prevent memory leak
24 */
25export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
26export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
27 static displayName: string;
28 static defaultProps: Pick<import("../types").ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
29 private cache;
30 state: State;
31 static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
32 render(): JSX.Element;
33}
34export {};
35//# sourceMappingURL=provider.d.ts.map
\No newline at end of file