-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
43 lines (38 loc) · 1.11 KB
/
App.js
File metadata and controls
43 lines (38 loc) · 1.11 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
import React, { useState } from "react";
import { View, StyleSheet, Button, Switch, Text } from "react-native";
import SoundPlayer from 'react-native-sound-player'
import NotificationSounds, { playSampleSound } from 'react-native-notification-sounds';
const App = () => {
const onHue = () => {
fetch('http://192.168.1.113/api/caObZ3a4yQHlUfuvcg11FPXwKEfRyeIK0t8zl5So/groups/1/action', {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({on: true})
});
}
const playSound = () => {
NotificationSounds.getNotifications('notification').then(soundList => {
// soundList.map((sound, index) => {
// console.log(index, sound.title)
// playSampleSound()
// })
playSampleSound(soundList[84])
})
}
return (
<View style={styles.container}>
<Button title={"play sound"} onPress={playSound()}></Button>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "space-around",
alignItems: "center"
}
});
export default App;