Skip to content

Commit 86f7c43

Browse files
tatchicknitt
authored andcommitted
Use itemSeparatorComponent in flatList (#580)
* use itemSeparator flatList * added ListFooterComponent
1 parent 60a8804 commit 86f7c43

File tree

1 file changed

+18
-14
lines changed
  • reason-react-navigation-example/src/components

1 file changed

+18
-14
lines changed

reason-react-navigation-example/src/components/Timeline.re

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,33 @@ open Helpers;
44
module TimelineItem = {
55
[@react.component]
66
let make = (~text, ~onPress) =>
7-
<>
8-
<TouchableOpacity
9-
onPress
10-
style=Style.(
11-
style(~paddingHorizontal=16.->dp, ~paddingVertical=26.->dp, ())
12-
)>
13-
<Text> {text |> React.string} </Text>
14-
</TouchableOpacity>
15-
<View
16-
style=Style.(
17-
style(~borderBottomColor="#ddd", ~borderBottomWidth=1., ())
18-
)
19-
/>
20-
</>;
7+
<TouchableOpacity
8+
onPress
9+
style=Style.(
10+
style(~paddingHorizontal=16.->dp, ~paddingVertical=26.->dp, ())
11+
)>
12+
<Text> {text |> React.string} </Text>
13+
</TouchableOpacity>;
2114
};
2215

16+
module ItemSeparator = {
17+
[@react.component]
18+
let make = () =>
19+
<View
20+
style=Style.(
21+
style(~borderBottomColor="#ddd", ~borderBottomWidth=1., ())
22+
)
23+
/>;
24+
};
2325
module TimelineList = {
2426
[@react.component]
2527
let make = (~navigation: Navigation.t) =>
2628
<>
2729
<FlatList
2830
data=Tweet.dummyTweets
2931
keyExtractor={({id}, _) => id}
32+
_ItemSeparatorComponent={_ => <ItemSeparator />}
33+
_ListFooterComponent={_ => <ItemSeparator />}
3034
renderItem={props =>
3135
<TimelineItem
3236
onPress={_ =>

0 commit comments

Comments
 (0)