File tree Expand file tree Collapse file tree 2 files changed +31
-17
lines changed Expand file tree Collapse file tree 2 files changed +31
-17
lines changed Original file line number Diff line number Diff line change 1
1
import { StyleSheet , Text , View } from "react-native" ;
2
- import { AntDesign } from "@expo/vector-icons " ;
2
+ import FoodListItem from "../components/FoodListItem " ;
3
3
4
4
export default function App ( ) {
5
5
return (
6
6
< View style = { styles . container } >
7
7
{ /* Food Items View */ }
8
- < View
9
- style = { {
10
- backgroundColor : "gainsboro" ,
11
- padding : 10 ,
12
- borderRadius : 5 ,
13
- flexDirection : "row" ,
14
- justifyContent : "space-between" ,
15
- alignItems : "center" ,
16
- } }
17
- >
18
- < View style = { { flex : 1 , gap : 5 } } >
19
- < Text style = { { fontWeight : "bold" , fontSize : 16 } } > Pizza</ Text >
20
- < Text style = { { color : "dimgray" } } > 350 cal, Dominos</ Text >
21
- </ View >
22
- < AntDesign name = "pluscircleo" size = { 24 } color = "royalblue" />
23
- </ View >
8
+ < FoodListItem item = { { label : "Pizza" , cal : 75 , brand : "Dominos" } } />
9
+ < FoodListItem item = { { label : "Apple" , cal : 50 , brand : "Generic" } } />
24
10
</ View >
25
11
) ;
26
12
}
@@ -31,5 +17,6 @@ const styles = StyleSheet.create({
31
17
backgroundColor : "#fff" ,
32
18
justifyContent : "center" ,
33
19
padding : 10 ,
20
+ gap : 5 ,
34
21
} ,
35
22
} ) ;
Original file line number Diff line number Diff line change
1
+ import { StyleSheet , Text , View } from "react-native" ;
2
+ import { AntDesign } from "@expo/vector-icons" ;
3
+
4
+ const FoodListItem = ( { item } ) => {
5
+ return (
6
+ < View
7
+ style = { {
8
+ backgroundColor : "gainsboro" ,
9
+ padding : 10 ,
10
+ borderRadius : 5 ,
11
+ flexDirection : "row" ,
12
+ justifyContent : "space-between" ,
13
+ alignItems : "center" ,
14
+ } }
15
+ >
16
+ < View style = { { flex : 1 , gap : 5 } } >
17
+ < Text style = { { fontWeight : "bold" , fontSize : 16 } } > { item . label } </ Text >
18
+ < Text style = { { color : "dimgray" } } >
19
+ { item . cal } cal, { item . brand }
20
+ </ Text >
21
+ </ View >
22
+ < AntDesign name = "pluscircleo" size = { 24 } color = "royalblue" />
23
+ </ View >
24
+ ) ;
25
+ } ;
26
+
27
+ export default FoodListItem ;
You can’t perform that action at this time.
0 commit comments