-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVnews.js
174 lines (163 loc) · 4.91 KB
/
Vnews.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
import React, { useLayoutEffect } from 'react';
import { View, Text, StyleSheet, Image, FlatList,TextInput, ScrollView, TouchableOpacity } from 'react-native';
import { Video } from 'expo-av';
import { useNavigation } from '@react-navigation/native';
import { theme } from '../../../../constants/theme';
import Ionicons from 'react-native-vector-icons/Ionicons';
const Vnews = () => {
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerShown: false,
});
}, [navigation]);
const cour = [
{ id: '1', description: 'Panic Attack', image: require('../../../../assets/images/COURS1.jpeg') },
{ id: '2', description: 'Fire', image: require('../../../../assets/images/COURS3.jpeg') },
{ id: '3', description: 'Accident', image: require('../../../../assets/images/COURS4.jpeg') },
{ id: '4', description: 'Burglary', image: require('../../../../assets/images/COURS5.jpeg') },
];
// Dummy course data
const courses = [
{ id: 1, title: 'Course 1', date: 'June 1, 2024', image: require('../../../../assets/images/COURS1.jpeg') },
{ id: 2, title: 'Course 2', date: 'June 5, 2024', image: require('../../../../assets/images/COURS3.jpeg') },
{ id: 3, title: 'Course 3', date: 'June 10, 2024', image: require('../../../../assets/images/COURS6.jpg') },
];
return (
<View style={styles.container}>
<Video
source={require('../../../../assets/images/nature.mp4')}
style={StyleSheet.absoluteFill}
resizeMode="cover"
shouldPlay
isLooping
onError={(error) => console.log('Video Error:', error)}
/>
<View style={styles.overlay} />
<View style={styles.header}>
<Text style={styles.heading}>Welcome...</Text>
<View style={styles.iconsContainer}>
<Ionicons name="notifications-outline" size={24} color={theme.colors.white} style={styles.icon} />
<Image
source={require('../../../../assets/images/youssef.jpg')} // Update with the actual path of your user image
style={styles.userIcon}
/>
</View>
</View>
<TextInput
style={styles.searchBar}
placeholder="Search..."
placeholderTextColor={theme.colors.lightGray}
/>
<ScrollView style={styles.courseContainer}>
{courses.map((course) => (
<TouchableOpacity
key={course.id}
style={styles.courseItem}
onPress={() => navigation.navigate('CourseDetails', { courseId: course.id })}
>
<Image source={course.image} style={styles.courseImage} />
<Text style={styles.courseTitle}>{course.title}</Text>
<Text style={styles.courseDate}>{course.date}</Text>
</TouchableOpacity>
))}
<FlatList
data={cour}
horizontal
renderItem={({ item }) => (
<TouchableOpacity onPress={() => handleSelectCase(item)} style={styles.imageContainer}>
<Image source={item.image} style={styles.image} />
</TouchableOpacity>
)}
keyExtractor={(item) => item.id}
contentContainerStyle={styles.imageList}
/>
</ScrollView>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
overlay: {
...StyleSheet.absoluteFillObject,
backgroundColor: 'rgba(0,0,0,0.5)',
},
header: {
position: 'absolute',
top: 40,
left: 20,
right: 20,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
heading: {
fontSize: 24,
fontWeight: 'bold',
color: theme.colors.white,
},
iconsContainer: {
flexDirection: 'row',
alignItems: 'center',
},
imageContainer: {
marginHorizontal: 10,
marginBottom:150,
paddingBottom:10
},
imageList: {
paddingVertical: 20,
alignItems: 'center',
marginBottom:100
},
icon: {
marginLeft: 10,
},
userIcon: {
width: 35,
height: 35,
borderRadius: 18,
borderWidth: 2,
borderColor: theme.colors.white,
marginLeft: 10,
},
searchBar: {
position: 'absolute',
top: 90,
left: 20,
right: 20,
height: 40,
backgroundColor: 'rgba(255, 255, 255, 0.9)',
borderRadius: 20,
paddingHorizontal: 20,
fontSize: 16,
color: theme.colors.black,
},
courseContainer: {
marginTop: 150, // Adjust as needed
paddingHorizontal: 20,
},
courseItem: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: 20,
},
courseImage: {
width: 60,
height: 60,
borderRadius: 10,
marginRight: 10,
},
courseTitle: {
fontSize: 18,
fontWeight: 'bold',
color: theme.colors.white,
},
courseDate: {
fontSize: 14,
color: theme.colors.lightGray,
},
});
export default Vnews;