Skip to content

Commit 8fbecbe

Browse files
author
Joao Moura
committed
Improved flow
1 parent c4b84d3 commit 8fbecbe

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

.flowconfig

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,15 @@
11
[ignore]
22

3-
; We fork some components by platform
4-
.*/*[.]android.js
5-
6-
; Ignore "BUCK" generated dirs
7-
<PROJECT_ROOT>/\.buckd/
8-
9-
; Ignore unexpected extra "@providesModule"
10-
.*/node_modules/.*/node_modules/fbjs/.*
11-
12-
; Ignore duplicate module providers
13-
; For RN Apps installed via npm, "Libraries" folder is inside
14-
; "node_modules/react-native" but in the source repo it is in the root
15-
.*/Libraries/react-native/React.js
16-
.*/Libraries/react-native/ReactNative.js
17-
18-
; Additional create-react-native-app ignores
19-
20-
; Ignore duplicate module providers
21-
.*/node_modules/fbemitter/lib/*
22-
23-
; Ignore misbehaving dev-dependencies
24-
.*/node_modules/xdl/build/*
25-
.*/node_modules/reqwest/tests/*
26-
273
; Ignore react-native-fbads dependency of the expo sdk
28-
.*/node_modules/react-native-fbads/*
4+
.*/lib/*
5+
.*/example/*
296

307
; Ignore libraries with broken flow
318

329
<PROJECT_ROOT>/node_modules/.*
3310
[include]
3411

3512
[libs]
36-
node_modules/react-native/Libraries/react-native/react-native-interface.js
37-
node_modules/react-native/flow
38-
flow/
3913

4014
[options]
4115
module.system=haste
@@ -48,8 +22,6 @@ experimental.strict_type_args=true
4822

4923
munge_underscores=true
5024

51-
module.name_mapper='^react-navigation$' -> 'emptyObject'
52-
5325
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
5426

5527
suppress_type=$FlowIssue

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import uuid from 'react-native-uuid'
77
import hoistStatics from 'hoist-non-react-statics'
88

99
let language: string = 'pt'
10+
1011
let subscribes: {
1112
cb: () => mixed,
1213
id: string
1314
}[] = []
14-
1515
export type Translations = {
1616
[string]: {
1717
[string]: string
@@ -31,7 +31,7 @@ export function subscribe (cb:() => mixed, id?: string): string {
3131
return newId
3232
}
3333

34-
export function unsubscribe (id: string) {
34+
export function unsubscribe (id: string): void {
3535
subscribes = subscribes.filter(
3636
item => item.id !== id
3737
)
@@ -77,7 +77,7 @@ export function t (key: string, args?: {[string]: string}): string {
7777
return translation
7878
}
7979

80-
export function translate (Component: React$ComponentType<*>):React$ComponentType<*> {
80+
export function translate (Component: React$ComponentType<*>): React$ComponentType<*> {
8181
class TranslatedComponet extends React.Component<{}, *> {
8282
id: string
8383

@@ -93,7 +93,7 @@ export function translate (Component: React$ComponentType<*>):React$ComponentTyp
9393

9494
render () {
9595
return (
96-
<Component {...this.props} t={(key: string, args?:{[string]: string}) => t(key, args)}/>
96+
<Component {...this.props} t={(key: string, args?:{[string]: string}): string => t(key, args)}/>
9797
)
9898
}
9999
}

0 commit comments

Comments
 (0)