-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeScreen.js
91 lines (80 loc) · 3.42 KB
/
HomeScreen.js
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { Text, SafeAreaView, View, Image, StyleSheet, StatusBar, TextInput, ScrollView } from 'react-native'
import React, { useEffect, useLayoutEffect, useState } from 'react'
import { useNavigation } from '@react-navigation/native'
import { ChevronDownIcon, UserIcon, AdjustmentsVerticalIcon, MagnifyingGlassIcon } from "react-native-heroicons/outline";
import Categories from '../components/Categories';
import FeaturedRow from '../components/FeaturedRow';
import axios from "axios";
import useFeatures from '../hooks/UseFeatures';
const HomeScreen = () => {
const navigation = useNavigation();
const { data, isLoading, isSuccess } = useFeatures();
useLayoutEffect(() => {
navigation.setOptions({
headerShown: false,
});
}, []);
return (
<SafeAreaView className=" pt-9 bg-white">
{/** Header */}
<View className="bg-white">
<View className="flex-row pb-3 items-center space-x-2 px-2">
<Image
source={{
uri: 'https://links.papareact.com/wru',
}}
className="h-7 w-7 bg-gray-300 rounded-full"
/>
<View className="flex-1">
<Text className="font-bold text-gray-400 text-xs">Deliver Now!</Text>
<View className="flex-row items-center space-x-1">
<Text className="font-bold text-xl">Current Location</Text>
<ChevronDownIcon size={20} color="#00CCBB" />
</View>
</View>
<UserIcon size={35} color="#00CCBB" />
</View>
{/** Searchbar */}
<View className="flex-row items-center space-x-2 mb-2 px-2">
<View className="flex-row flex-1 bg-gray-200 space-x-2 px-3 py-2 items-center rounded-xl">
<MagnifyingGlassIcon size={20} color="gray" />
<TextInput
placeholder='Restaurants and cuisines'
keyboardType='default'
/>
</View>
<AdjustmentsVerticalIcon size={20} color="#00CCBB" />
</View>
</View>
{/** Body */}
{/** Categories */}
<ScrollView
className="bg-gray-100"
contentContainerStyle={{
paddingBottom: 150,
}}
>
<Categories />
{/** Featured Rows */}
{
isSuccess && (
<>
{
data?.map((category) => {
return <FeaturedRow
key={category.id}
id={category.id}
title={category.Name}
description={category.Kurzbeschreibung}
restaurants={category.Restaurants}
/>
})
}
</>
)
}
</ScrollView>
</SafeAreaView>
)
}
export default HomeScreen