-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoveButton.tsx
More file actions
45 lines (40 loc) · 1.22 KB
/
removeButton.tsx
File metadata and controls
45 lines (40 loc) · 1.22 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
import AsyncStorage from '@react-native-async-storage/async-storage';
import React from 'react';
import {Alert, SafeAreaView, StyleSheet, TouchableOpacity} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
export function RemoveBtn(props) {
const ui = (
<SafeAreaView>
<TouchableOpacity onPress={clickRemoveResponse} style={styles.btn}>
<Icon name="delete" color="white" size={25} />
</TouchableOpacity>
</SafeAreaView>
);
return ui;
async function clickRemoveResponse() {
const userJsonObj = await AsyncStorage.getItem('user');
const userJsObj = JSON.parse(userJsonObj);
const fromId = userJsObj.id;
const toId = props.toUserId;
fetch('http://localhost/chatAppAPI/loadUsers.php?fromId='+fromId +'&toId='+toId, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/x-www-form-urlencoded',
},
})
.then(response => response.json())
.then(json => {})
.catch(error => console.log(error));
}
}
const styles = StyleSheet.create({
btn: {
position: 'absolute',
start: 130,
top: 20,
backgroundColor: '#2c4b76',
padding: 5,
borderRadius: 50,
},
});