react-i18next: allow React.ReactNode as I18nextProvider's children and I18n's render function return value (#27895)

This commit is contained in:
Wu Haotian
2018-08-06 12:08:15 -07:00
committed by Sheetal Nandi
parent a0eb795fa9
commit afa361b2b7
4 changed files with 11 additions and 2 deletions
+1
View File
@@ -3,6 +3,7 @@
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Simon Baumann <https://github.com/chnoch>
// Benedict Etzel <https://github.com/beheh>
// Wu Haotian <https://github.com/whtsky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
+1 -1
View File
@@ -15,7 +15,7 @@ export interface i18nProps {
i18n?: i18n;
initialI18nStore?: any;
initialLanguage?: string;
children: (t: TranslationFunction, options: Options) => JSX.Element;
children: (t: TranslationFunction, options: Options) => React.ReactNode;
}
export default class I18n extends React.Component<i18nProps> { }
+1 -1
View File
@@ -6,7 +6,7 @@ export interface I18nextProviderProps {
i18n: i18n;
initialI18nStore?: any;
initialLanguage?: string;
children: JSX.Element;
children: React.ReactNode;
}
export default class I18nextProvider extends React.Component<I18nextProviderProps> { }
@@ -107,6 +107,10 @@ class App extends React.Component {
<App/>
</I18nextProvider>;
<I18nextProvider i18n={i18n} initialLanguage={'en'} initialI18nStore={{}}>
123
</I18nextProvider>;
loadNamespaces({components: [App], i18n}).then(() => {
}).catch(error => {
});
@@ -182,6 +186,10 @@ interface CustomTranslateFunctionProps {
}
</I18n>;
<I18n>
{t => '123'}
</I18n>;
const defaults: ReactI18NextOptions = {
wait: true,
withRef: true,