-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
101 lines (90 loc) · 2.1 KB
/
App.js
File metadata and controls
101 lines (90 loc) · 2.1 KB
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
import React from 'react';
import {
StyleSheet,
View,
Text,
ScrollView,
Image,
TouchableOpacity
} 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 varSound = new Sound(sound, Sound.MAIN_BUNDLE, (err) =>{
if(err){
console.log('Not Able to play Sound')
}
});
setTimeout(() => {
varSound.play()
}, 99);
varSound.release();
}
return (
<ScrollView style={styles.container}>
<Image style={styles.logo} source={require('./assets/logo.png')} />
<View style={styles.gridContainer}>
{
soundList.map( (sound) => (
<TouchableOpacity
key={sound}
onPress={() => {playSound(sound)}}
style={styles.box}
>
<Text style={styles.text}>
{sound}
</Text>
</TouchableOpacity>
))
}
</View>
</ScrollView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#242B2E'
},
logo: {
alignSelf: 'center',
marginTop: 15
},
gridContainer: {
flex: 1,
flexDirection: 'row',
margin: 15,
flexWrap: 'wrap',
alignItems: 'flex-start',
justifyContent: 'space-around',
marginTop: 25
},
box: {
height: 110,
alignItems: 'center',
justifyContent: 'center',
width: '46%',
marginVertical: 6,
backgroundColor: '#0f4c75',
borderRadius: 10,
shadowColor: '#393e46',
elevation: 10
},
text: {
fontSize: 30,
color: '#CAD5E2',
}
});
export default App;