Skip to content

Commit

Permalink
Add hoistNonReactStatics
Browse files Browse the repository at this point in the history
  • Loading branch information
isaachinman committed Dec 1, 2018
1 parent bbfd832 commit a13cc4e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
10 changes: 9 additions & 1 deletion example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3458,6 +3458,13 @@ hoist-non-react-statics@3.0.1:
dependencies:
react-is "^16.3.2"

hoist-non-react-statics@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.2.0.tgz#d21b9fc72b50fdc38c5d88f6e2c52f2c2dbe5ee2"
integrity sha512-3IascCRfaEkbmHjJnUxWSspIUE1okLPjGTMVXW8zraUo1t3yg1BadKAxAGILHwgoBzmMnzrgeeaDGBvpuPz6dA==
dependencies:
react-is "^16.3.2"

home-or-tmp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
Expand Down Expand Up @@ -4473,9 +4480,10 @@ neo-async@^2.5.0:
integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==

next-i18next@../:
version "0.3.1"
version "0.5.0"
dependencies:
detect-node "^2.0.4"
hoist-non-react-statics "^3.2.0"
i18next "^12.0.0"
i18next-browser-languagedetector "^2.2.4"
i18next-express-middleware "^1.5.0"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
},
"dependencies": {
"detect-node": "^2.0.4",
"hoist-non-react-statics": "^3.2.0",
"i18next": "^12.0.0",
"i18next-browser-languagedetector": "^2.2.4",
"i18next-express-middleware": "^1.5.0",
Expand Down
7 changes: 6 additions & 1 deletion src/hocs/app-with-translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { I18nextProvider } from 'react-i18next'
import { lngPathCorrector } from 'utils'
import { NextStaticProvider } from 'components'

import hoistNonReactStatics from 'hoist-non-react-statics'

export default function (WrappedComponent) {

const { config, i18n } = this

return class extends React.Component {
class AppWithTranslation extends React.Component {

constructor() {
super()
Expand Down Expand Up @@ -87,4 +89,7 @@ export default function (WrappedComponent) {
)
}
}

return hoistNonReactStatics(AppWithTranslation, WrappedComponent, { getInitialProps: true })

}
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,13 @@ hoist-non-react-statics@3.0.1:
dependencies:
react-is "^16.3.2"

hoist-non-react-statics@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.2.0.tgz#d21b9fc72b50fdc38c5d88f6e2c52f2c2dbe5ee2"
integrity sha512-3IascCRfaEkbmHjJnUxWSspIUE1okLPjGTMVXW8zraUo1t3yg1BadKAxAGILHwgoBzmMnzrgeeaDGBvpuPz6dA==
dependencies:
react-is "^16.3.2"

home-or-tmp@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb"
Expand Down

0 comments on commit a13cc4e

Please sign in to comment.