Skip to content

Commit 5d5d8a3

Browse files
committed
No flow errors
1 parent 0ffd57d commit 5d5d8a3

File tree

8 files changed

+4696
-34
lines changed

8 files changed

+4696
-34
lines changed

example/.flowconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
; Ignore unexpected extra "@providesModule"
99
.*/node_modules/.*/node_modules/fbjs/.*
1010

11+
.*/node_modules/*
12+
1113
; Ignore duplicate module providers
1214
; For RN Apps installed via npm, "Libraries" folder is inside
1315
; "node_modules/react-native" but in the source repo it is in the root
@@ -20,6 +22,7 @@
2022
node_modules/react-native/Libraries/react-native/react-native-interface.js
2123
node_modules/react-native/flow
2224
flow/
25+
flow-typed
2326

2427
[options]
2528
emoji=true
@@ -42,4 +45,3 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4245
unsafe.enable_getters_and_setters=true
4346

4447
[version]
45-
^0.49.1

example/ExampleApp.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
/* @flow */
22

33
import React from 'react'
4-
import {Alert, StyleSheet, Text, View} from 'react-native'
4+
import {
5+
Alert,
6+
StyleSheet,
7+
Text,
8+
View,
9+
type Props,
10+
type State,
11+
} from 'react-native'
512
import NestedListView from './nestedListView'
613

714
const generateXNumItems = (numItems, prefix) => {
@@ -42,33 +49,31 @@ const data = [
4249
]
4350

4451
const colorLevels = {
45-
0: 'white',
46-
1: 'blue',
47-
2: 'green',
48-
3: 'red',
52+
[0]: 'white',
53+
[1]: 'blue',
54+
[2]: 'green',
55+
[3]: 'red',
4956
}
5057

5158
const styles = StyleSheet.create({
5259
container: {flex: 1, backgroundColor: 'rgb(255, 255, 255)', padding: 10},
5360
node: {
5461
flex: 1,
5562
padding: 10,
56-
paddingLeft,
5763
borderWidth: 1,
5864
borderColor: 'rgb(0, 0, 0)',
59-
backgroundColor,
6065
},
6166
nestedListView: {padding: 10},
6267
})
63-
export default class ExampleApp extends React.Component {
68+
export default class ExampleApp extends React.Component<Props, State> {
6469
nestedListView: any
6570

66-
renderNode = (node: Object, level: string) => {
71+
renderNode = (node: Object, level: number) => {
6772
const paddingLeft = (level + 1) * 30
6873
const backgroundColor = colorLevels[level] || 'white'
6974

7075
return (
71-
<View style={styles.node}>
76+
<View style={[styles.node, {backgroundColor, paddingLeft}]}>
7277
<Text>{node.name}</Text>
7378
</View>
7479
)

0 commit comments

Comments
 (0)