From 70857c760a3dd3157dbcdb0fd6ed02e60b1e4c0c Mon Sep 17 00:00:00 2001 From: Mikkel Date: Mon, 4 Feb 2019 10:18:00 +0100 Subject: [PATCH] Use Provider instead of contextType to fix hoist issues --- src/hoc.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/hoc.tsx b/src/hoc.tsx index c1fa213..64ed428 100644 --- a/src/hoc.tsx +++ b/src/hoc.tsx @@ -1,5 +1,6 @@ import React from 'react' -import { I18nContext, I18nContextProps } from './context' +import { I18nContextProps } from './context' +import { I18nProvider } from './provider' import { Omit } from './types' export interface WithTranslateProps extends I18nContextProps {} @@ -10,10 +11,12 @@ function withTranslate

( return class WithTranslate extends React.Component

{ static displayName = `withTranslate(${BaseComponent.displayName})` - static contextType = I18nContext - render() { - return + return ( + + {i18nProps => } + + ) } } }