From 8f3e4420779d01656fadb6b7c4b74ace77087515 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Wed, 15 May 2024 02:52:01 +0200 Subject: [PATCH] Added: beer image and other info about beer into reviews --- frontend/app/(app)/(tabs)/review/index.js | 51 +++++++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/frontend/app/(app)/(tabs)/review/index.js b/frontend/app/(app)/(tabs)/review/index.js index f644d68..f6dfd2a 100644 --- a/frontend/app/(app)/(tabs)/review/index.js +++ b/frontend/app/(app)/(tabs)/review/index.js @@ -1,4 +1,4 @@ -import { View, StyleSheet, FlatList } from "react-native"; +import { View, StyleSheet, FlatList, Image } from "react-native"; import Text from "@components/Text"; import Button from "@components/Button"; import { colors } from "@components/style"; @@ -14,6 +14,8 @@ export default function Tab() { fetchData(); }, []); + const API_HOST = process.env.EXPO_PUBLIC_API_URL.replace("/api/v1", ""); + async function fetchData() { try { const res = await fetch(`${process.env.EXPO_PUBLIC_API_URL}/review/get`, { @@ -70,13 +72,35 @@ export default function Tab() { style={styles.reviewList} keyExtractor={(item) => String(item._id)} renderItem={({ item }) => ( - - Foam → {opt3[item.foam - 1]} - Bitter / Sweetness → {opt3[item.bitter_sweetness - 1]} - Taste → {opt5[item.taste - 1]} - Packaging → {opt5[item.packaging - 1]} - Sourness → {sourness[item.sourness - 1]} - Would again? → {opt2[item.would_again - 1]} + + + {item.beer.name} + {item.beer.brand} + {item.beer.degree}° + {item.beer.packaging} + + + + Foam → {opt3[item.foam - 1]} + + Bitter / Sweetness → {opt3[item.bitter_sweetness - 1]} + + Taste → {opt5[item.taste - 1]} + Packaging → {opt5[item.packaging - 1]} + Sourness → {sourness[item.sourness - 1]} + Would again? → {opt2[item.would_again - 1]} + )} /> @@ -96,11 +120,20 @@ export const styles = StyleSheet.create({ paddingHorizontal: "15%", marginTop: "5%", }, - item: { + itemContainer: { borderColor: "gray", borderWidth: 1, borderRadius: 10, padding: 13, marginBottom: "5%", + flex: 1, + flexDirection: "row", + justifyContent: "space-between", + }, + itemImg: { + width: 150, + aspectRatio: 1, + resizeMode: "contain", + marginTop: "5%", }, });