-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMealsList.js
More file actions
52 lines (49 loc) · 1.13 KB
/
MealsList.js
File metadata and controls
52 lines (49 loc) · 1.13 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from "react";
import { Text, StyleSheet, View } from "react-native";
export const MealsList = ({ itemsList }) => {
const mealsOutput = itemsList.map((i) => (
<View key={Math.random()}>
<View style={styles.container}>
<Text style={styles.kid}> {i.name}</Text>
<Text style={styles.kid}>Calories: {i.cals}</Text>
</View>
</View>
));
return (
<View data-test="meals-list">
{itemsList.length > 0 ? (
<View>
<View style={styles.container}>
<Text>Meals List Here:</Text>
</View>
<View style={styles.container}>
<Text style={styles.kidLabel}>Meal Item</Text>
<Text style={styles.kidLabel}>Calories </Text>
</View>
</View>
) : null}
{mealsOutput}
</View>
);
};
const styles = StyleSheet.create({
container: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
},
kid: {
margin: 2,
width: 150,
borderWidth: 1,
padding: 5,
},
kidLabel: {
margin: 2,
width: 150,
padding: 5,
},
center: {
alignItems: "center",
},
});