-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLyricRow.js
148 lines (134 loc) · 3.2 KB
/
LyricRow.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
import React, { Component } from 'react';
import { View, Text, StyleSheet, TouchableHighlight, Modal, ListView, Image,Linking } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 12,
flexDirection: 'row',
alignItems: 'center',
},
text: {
marginLeft: 12,
fontSize: 16,
},
verse: {
marginLeft: 12,
fontSize: 16,
color: 'blue',
},
link: {
marginLeft: 12,
fontSize: 16,
color: 'blue',
},
chorus: {
marginLeft: 12,
fontSize: 16,
color: 'orange',
},
photo: {
height: 40,
width: 40,
borderRadius: 20,
},
classIcon: {
width: 30,
height: 30,
backgroundColor: 'transparent',
},
modalHeader: {
flexDirection: 'row',
backgroundColor: 'orange',
color: 'white',
},
modalHeaderText: {
fontSize: 18,
color: 'white',
}
});
export default class LyricRow extends Component {
constructor(props) {
super(props);
const ds = new ListView.DataSource(
{
rowHasChanged: (r1, r2) => r1 !== r2
}
);
this.state = {
lyricDS: ds.cloneWithRows(props.verses),
modalVisible: false,
};
}
setModalVisible(visible) {
this.setState({modalVisible: visible});
}
renderLyricRow(data) {
if (data.chorus) {
return (
<View style={{flexDirection: 'row'}}>
<Image source={require('./Applause-48.png')}
style={styles.classIcon}
accessibilityLabel="click to go back"
/>
<Text style={styles.chorus}>{`${data.text}`}</Text>
</View>
);
} else {
return (
<View style={{flexDirection: 'row'}}>
<Image source={require('./berimbau.png')}
style={styles.classIcon}
accessibilityLabel="click to go back"
/>
<Text style={styles.verse}>{`${data.text}`}</Text>
</View>
);
}
}
_closeModal() {
this.setState({
modalVisible: false
});
}
render() {
return (
<View style={styles.container}>
<Modal animationType={"slide"} transparent={false} visible={this.state.modalVisible} onRequestClose={() => { this.setState({modalVisible: false}); } } >
<View>
<View style={styles.modalHeader}>
<TouchableHighlight onPress={() => {
this.setModalVisible(!this.state.modalVisible); }
}>
<Image source={require('./back_orange.png')}
style={styles.classIcon}
accessibilityLabel="click to go back"
/>
</TouchableHighlight>
<Text style={styles.modalHeaderText}>
{`${this.props.Name}`}
</Text>
</View>
<ListView
dataSource={this.state.lyricDS}
renderRow={(data) => {
return this.renderLyricRow(data);
}
}
/>
</View>
</Modal>
<TouchableHighlight onPress={() => {
this.setModalVisible(true); }
}>
<View style={styles.container}>
<Image source={require('./Lyrics.png')}
style={styles.classIcon}
accessibilityLabel="Open song screen"/>
<Text style={styles.text}>
{`${this.props.Name}`}
</Text>
</View>
</TouchableHighlight>
</View>);
}
}