-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
93 lines (88 loc) · 2.04 KB
/
App.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
import React from 'react';
import {
View,
Text,
StyleSheet,
ScrollView,
Image,
TouchableOpacity,
StatusBar,
} from 'react-native';
import Sound from 'react-native-sound';
const soundList = [
require('./assets/one.wav'),
require('./assets/two.wav'),
require('./assets/three.wav'),
require('./assets/four.wav'),
require('./assets/five.wav'),
require('./assets/six.wav'),
require('./assets/seven.wav'),
require('./assets/eight.wav'),
require('./assets/nine.wav'),
require('./assets/ten.wav'),
];
const App = () => {
const playSound = (sound) => {
const soundVar = new Sound(sound, Sound.MAIN_BUNDLE, (err) => {
if (err) {
console.log('NOt able to play sound');
}
});
setTimeout(() => {
soundVar.play();
}, 100);
soundVar.release();
};
return (
<ScrollView style={styles.container}>
<StatusBar backgroundColor="#1b262c" />
<Image style={styles.logo} source={require('./assets/logo.png')} />
<Text style={{color: '#fff', marginHorizontal: 50, fontSize: 25}}>
Learn Spanish
</Text>
<View style={styles.gridContainer}>
{soundList.map((sound) => (
<TouchableOpacity
key={sound}
style={styles.box}
onPress={() => {
playSound(sound);
}}>
<Text style={styles.text}>{sound}</Text>
</TouchableOpacity>
))}
</View>
</ScrollView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#1b262c',
},
logo: {
marginTop: 15,
alignSelf: 'center',
},
gridContainer: {
flex: 1,
margin: 5,
flexDirection: 'row',
flexWrap: 'wrap',
alignItems: 'flex-start',
justifyContent: 'space-around',
},
box: {
height: 100,
alignItems: 'center',
justifyContent: 'center',
width: '46%',
backgroundColor: '#0f4c75',
marginVertical: 6,
borderRadius: 5,
shadowColor: '#393e46',
elevation: 5,
},
text: {fontSize: 50, color: '#ff4301'},
});
export default App;