|
| 1 | +import React, { Component } from 'react'; |
| 2 | +import { |
| 3 | + StyleSheet, |
| 4 | + Text, |
| 5 | + View, |
| 6 | + Image, |
| 7 | + Dimensions, |
| 8 | + StatusBar |
| 9 | +} from 'react-native'; |
| 10 | + |
| 11 | +import HeaderImageScrollView from 'react-native-image-header-scroll-view'; |
| 12 | +import tvShowContent from './assets/tvShowContent'; |
| 13 | + |
| 14 | + |
| 15 | +const TvShow = () => ( |
| 16 | + <View style={{ flex:1 }}> |
| 17 | + <StatusBar barStyle="light-content" /> |
| 18 | + <HeaderImageScrollView |
| 19 | + maxHeight={200} |
| 20 | + minHeight={50} |
| 21 | + renderHeader={() => ( |
| 22 | + <Image source={tvShowContent.image} style={styles.image} /> |
| 23 | + )} |
| 24 | + > |
| 25 | + <View style={styles.section}> |
| 26 | + <Text style={styles.title}> |
| 27 | + <Text style={styles.name}>{tvShowContent.title}</Text>, ({tvShowContent.year}) |
| 28 | + </Text> |
| 29 | + </View> |
| 30 | + <View style={styles.section}> |
| 31 | + <Text style={styles.sectionTitle}>Overview</Text> |
| 32 | + <Text style={styles.sectionContent}>{tvShowContent.overview}</Text> |
| 33 | + </View> |
| 34 | + <View style={styles.section}> |
| 35 | + <Text style={styles.sectionTitle}>Keywords</Text> |
| 36 | + <View style={styles.keywords}> |
| 37 | + {tvShowContent.keywords.map((keyword) => ( |
| 38 | + <View style={styles.keywordContainer} key={keyword}> |
| 39 | + <Text style={styles.keyword}>{keyword}</Text> |
| 40 | + </View> |
| 41 | + ))} |
| 42 | + </View> |
| 43 | + </View> |
| 44 | + </HeaderImageScrollView> |
| 45 | + </View> |
| 46 | +); |
| 47 | + |
| 48 | +const styles = StyleSheet.create({ |
| 49 | + image: { |
| 50 | + height: 200, |
| 51 | + width: Dimensions.get('window').width, |
| 52 | + alignSelf: 'stretch', |
| 53 | + resizeMode: 'cover', |
| 54 | + }, |
| 55 | + title: { |
| 56 | + fontSize: 20, |
| 57 | + }, |
| 58 | + name: { |
| 59 | + fontWeight: 'bold', |
| 60 | + }, |
| 61 | + section: { |
| 62 | + padding: 20, |
| 63 | + borderBottomWidth: 1, |
| 64 | + borderBottomColor: '#cccccc', |
| 65 | + }, |
| 66 | + sectionTitle: { |
| 67 | + fontSize: 18, |
| 68 | + fontWeight: 'bold', |
| 69 | + }, |
| 70 | + sectionContent: { |
| 71 | + fontSize: 16, |
| 72 | + textAlign: 'justify', |
| 73 | + }, |
| 74 | + keywords: { |
| 75 | + flexDirection: 'row', |
| 76 | + justifyContent: 'flex-start', |
| 77 | + alignItems: 'flex-start', |
| 78 | + flexWrap: 'wrap', |
| 79 | + }, |
| 80 | + keywordContainer: { |
| 81 | + backgroundColor: '#999999', |
| 82 | + borderRadius: 10, |
| 83 | + margin: 10, |
| 84 | + padding: 10, |
| 85 | + }, |
| 86 | + keyword: { |
| 87 | + fontSize: 16, |
| 88 | + color: 'white', |
| 89 | + }, |
| 90 | +}); |
| 91 | + |
| 92 | +export default TvShow; |
0 commit comments