@@ -11,6 +11,12 @@ const fontSize = 16;
11
11
12
12
const audioPlayer = new AudioPlayer ( ) ;
13
13
14
+ const FooterButton = ( param ) => {
15
+ return < TouchableOpacity onPress = { param . onPress } >
16
+ < Text style = { { fontSize } } > { param . children } </ Text >
17
+ </ TouchableOpacity >
18
+ }
19
+
14
20
/**
15
21
* @param {Object } param
16
22
* @property {[string,string][] } param.pathPairs
@@ -19,32 +25,20 @@ const audioPlayer = new AudioPlayer();
19
25
*/
20
26
const AudioFooter = ( param ) => {
21
27
22
- // audioPlayer.load(param.audioPathPairs)
23
-
24
28
useEffect ( ( ) => {
25
29
console . log ( 'Reloading audioplayer' )
26
- // console.log('attempting loading', param.pathPairs)
27
30
audioPlayer . load ( param . pathPairs )
28
- // audioPlayer.load([["210822144607_I am eating apple", "210822144607_我在吃苹果"]])
29
31
} , [ param . pathPairs ] )
30
32
31
33
return (
32
34
< View style = { [
33
35
styles . footerCard ,
34
36
{ display : 'flex' , flexDirection : 'row' , justifyContent : 'space-between' }
35
37
] } >
36
- < TouchableOpacity onPress = { ( ) => {
37
- // playTestSound();
38
- // console.log('Play')
39
-
40
- audioPlayer . playRandom ( )
41
- } } >
42
- < Text style = { { fontSize } } > Play</ Text >
43
- </ TouchableOpacity >
44
- < Text style = { { fontSize } } > Stop</ Text >
45
- < TouchableOpacity onPress = { param . backToMenu } >
46
- < Text style = { { fontSize } } > Back</ Text >
47
- </ TouchableOpacity >
38
+ < FooterButton onPress = { ( ) => { audioPlayer . play ( ) } } > Play</ FooterButton >
39
+ < FooterButton onPress = { ( ) => { audioPlayer . playRandom ( ) } } > Random</ FooterButton >
40
+ < FooterButton onPress = { audioPlayer . stop } > Stop</ FooterButton >
41
+ < FooterButton onPress = { param . backToMenu } > Back</ FooterButton >
48
42
</ View >
49
43
)
50
44
}
@@ -55,12 +49,8 @@ const CategoryFooter = (param) => {
55
49
styles . footerCard ,
56
50
{ display : 'flex' , flexDirection : 'row' , justifyContent : 'space-between' }
57
51
] } >
58
- < TouchableOpacity onPress = { param . openAddEntryMenu } >
59
- < Text style = { { fontSize } } > Add new entry</ Text >
60
- </ TouchableOpacity >
61
- < TouchableOpacity onPress = { param . refreshCategories } >
62
- < Text style = { { fontSize } } > Refresh</ Text >
63
- </ TouchableOpacity >
52
+ < FooterButton onPress = { param . openAddEntryMenu } > Add new entry</ FooterButton >
53
+ < FooterButton onPress = { param . refreshCategories } > Refresh</ FooterButton >
64
54
</ View >
65
55
)
66
56
}
@@ -71,12 +61,8 @@ const OpenAddEntryFooter = (param) => {
71
61
styles . footerCard ,
72
62
{ display : 'flex' , flexDirection : 'row' , justifyContent : 'space-between' }
73
63
] } >
74
- < TouchableOpacity onPress = { param . closeAddEntryMenu } >
75
- < Text style = { { fontSize } } > Close</ Text >
76
- </ TouchableOpacity >
77
- < TouchableOpacity onPress = { param . addNew } >
78
- < Text style = { { fontSize } } > Submit entry to AWS</ Text >
79
- </ TouchableOpacity >
64
+ < FooterButton onPress = { param . closeAddEntryMenu } > Close</ FooterButton >
65
+ < FooterButton onPress = { param . addNew } > Submit entry to AWS</ FooterButton >
80
66
</ View >
81
67
)
82
68
}
@@ -93,9 +79,6 @@ const OpenAddEntryFooter = (param) => {
93
79
* @returns {React.ReactElement }
94
80
*/
95
81
const Footer = ( param ) => {
96
- // console.log('isSelectedView', param.isSelectedView, 'addEntryMenuOpen', param.entryMenuOpen)
97
-
98
- // console.log('current param', param)
99
82
100
83
return (
101
84
< View >
0 commit comments