-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia-cell.js
95 lines (79 loc) · 2.45 KB
/
media-cell.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
'use strict';
import React, { Component } from 'react';
import {
Image,
StyleSheet,
Text,
TouchableHighlight,
View } from 'react-native';
const styles = StyleSheet.create({
cellContainer: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#fff',
padding: 4
},
cellImage: {
height: 80,
width: 60,
marginRight: 8,
resizeMode: 'contain',
/* resizes the image inside of any container its in */
},
cellTextContainer: {
flex: 1
},
mediaName: {
fontSize: 16,
fontWeight: '600',
marginBottom: 4
},
mediaDescription: {
fontSize: 12,
color: '#777',
flex: 1
},
mediaYear: {
fontWeight: 'bold'
},
});
//class MediaCell extends React.Component {
var MediaCell = React.createClass({
render: function () {
return (
<View>
<TouchableHighlight
//onPress = { this.props.onSelect }
onShowUnderlay = { this.props.onHighlight }
onHideUnderlay = { this.props.onDeHighlight }
>
<View style = { styles.cellContainer } >
<Image
source = {{ uri: this.props.media.artworkUrl100 }}
style = { styles.cellImage }
/>
<View style = { styles.cellTextContainer } >
<Text style = { styles.mediaName } numberOfLines = { 1 } >
{ this.props.media.trackName || this.props.media.collectionName }
</Text>
<Text style = { styles.mediaDescription } numberOfLines = { 2 } >
<Text style = { styles.mediaYear } >
{ parseInt(this.props.media.releaseDate) }
</Text>
{" "}-{" "}
{ this.props.media.longDescription || this.props.media.artistName }
</Text>
</View>
</View>
</TouchableHighlight>
</View>
);
}
});
/******notes*******/
//onShowUnderlay and onHideUnderlay will call on functions that we pass from the ListView
//onPress = { this.props.onSelect }
//this.props.media.artworkUrl100 - could be a data object or a hash with a URI property like a java hashmap
//mediaName = movie title; restricted to one line
//output trackName or if that's not available the name of the collection
module.exports = MediaCell;