-
Notifications
You must be signed in to change notification settings - Fork 4
/
App.tsx
36 lines (34 loc) · 898 Bytes
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import {
StyleSheet,
Text,
View,
FlatList,
ListRenderItemInfo,
} from "react-native";
import { CoffeeHeader } from "./components/CoffeeHeader/CoffeeHeader";
import { CoffeeItem } from "./components/CoffeeItem";
import { SeparatorItem } from "./components/SeparatorItem/SeparatorItem";
import { Coffee, coffeeList } from "./data/coffeeList";
export default function App() {
function renderItem({ item }: ListRenderItemInfo<Coffee>) {
return <CoffeeItem {...item} />;
}
return (
<View style={styles.container}>
<FlatList
ListHeaderComponent={CoffeeHeader}
ItemSeparatorComponent={SeparatorItem}
data={coffeeList}
keyExtractor={(item) => item.name}
renderItem={renderItem}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
});