-
Notifications
You must be signed in to change notification settings - Fork 0
/
Series.tsx
59 lines (54 loc) · 1.32 KB
/
Series.tsx
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
import { StyleSheet, FlatList, Image } from "react-native";
import React from "react";
import { Serie, SerieProps } from "./Serie";
import { Text, View } from "./Themed";
type SeriesProps = {
series: Array<SerieProps>;
};
const Series = ({ series }: SeriesProps) => {
const renderItem = ({ item }: { item: SerieProps }) => {
return <Serie {...item} />;
};
return (
<View style={styles.container}>
<FlatList
contentContainerStyle={{
paddingBottom: 20,
}}
data={series}
renderItem={renderItem}
keyExtractor={(prop, index) => `${prop.id}-${index}`}
ListEmptyComponent={() => (
<View style={styles.emptyContainer}>
<Image
style={styles.emptyImage}
source={require("../assets/images/no-images-found.jpg")}
/>
<Text style={styles.text}>No series found</Text>
<Text style={styles.text}>
Try to search a serie by another name.
</Text>
</View>
)}
/>
</View>
);
};
export default Series;
const styles = StyleSheet.create({
container: {
flex: 1,
},
emptyImage: {
width: 300,
height: 300,
},
emptyContainer: {
marginTop: 80,
alignItems: "center",
},
text: {
fontSize: 15,
marginTop: 8,
},
});