File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-multi-lang" ,
3
- "version" : " 0.0.1 " ,
3
+ "version" : " 0.0.2 " ,
4
4
"description" : " React Multilanguage Higher-Order Component" ,
5
5
"main" : " lib/index.js" ,
6
6
"files" : [
42
42
"flow-copy-source" : " ^1.2.1"
43
43
},
44
44
"dependencies" : {
45
+ "hoist-non-react-statics" : " ^2.3.1" ,
45
46
"react-native-uuid" : " ^1.4.9"
46
47
}
47
48
}
Original file line number Diff line number Diff line change 3
3
import * as React from 'react'
4
4
import uuid from 'react-native-uuid'
5
5
6
+ // statics handler
7
+ import hoistStatics from 'hoist-non-react-statics'
8
+
6
9
let language : string = 'pt'
7
10
let subscribes : {
8
11
cb : ( ) => mixed ,
@@ -52,7 +55,7 @@ export function setLanguage (lang: string) {
52
55
}
53
56
54
57
export function translate ( Component : React$ComponentType < * > ) :React$ComponentType < * > {
55
- return class extends React . Component < { } , * > {
58
+ class TranslatedComponet extends React . Component < { } , * > {
56
59
id : string
57
60
58
61
componentDidMount ( ) {
@@ -71,6 +74,8 @@ export function translate (Component: React$ComponentType<*>):React$ComponentTyp
71
74
)
72
75
}
73
76
}
77
+
78
+ return hoistStatics ( TranslatedComponet , Component )
74
79
}
75
80
76
81
export default {
Original file line number Diff line number Diff line change 1283
1283
version "2.16.3"
1284
1284
resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed"
1285
1285
1286
+ hoist-non-react-statics@^2.3.1 :
1287
+ version "2.3.1"
1288
+ resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"
1289
+
1286
1290
home-or-tmp@^2.0.0 :
1287
1291
version "2.0.0"
1288
1292
resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8"
You can’t perform that action at this time.
0 commit comments