-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCall.tsx
executable file
·177 lines (169 loc) · 9.02 KB
/
Call.tsx
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import React, {useState} from 'react';
import { SafeAreaView } from 'react-native-safe-area-context';
import {View, StyleSheet, Text, Image, TouchableOpacity} from 'react-native';
import { StatusBar } from 'expo-status-bar';
import { MaterialCommunityIcons, MaterialIcons } from 'expo-vector-icons';
const CallComponent = () => {
const [audioCallAccepted, setAudioCallAccepted] = useState(false);
const [videoCallAccepted, setVideoCallAccepted] = useState(false);
const [onGoingVideoCall, setOnGoingVideoCall] = useState(false);
const [onGoingAudioCall, setOnGoingAudioCall] = useState(false);
const [mute, setMute] = useState(false);
const [video, setVideo] = useState(false);
if (onGoingAudioCall) {
return (
<SafeAreaView style={styles.container}>
<StatusBar style="light" />
<View style={{backgroundColor: 'white', borderRadius: '100%'}}>
<Image source={require('./assets/caller.png')} resizeMode={'contain'} style={{margin: 9}}/>
</View>
<View>
<Text style={{fontSize: 18, fontWeight: 'bold', color: 'white', padding: 20}}>Richard DOVOEDO</Text>
<Text style={{fontSize: 14, color: 'white',textAlign: 'center', padding: 20}}>Appel en cours</Text>
<Text style={{fontSize: 14, color: 'white', textAlign: 'center', padding: 15 }}>00 : 00 :00</Text>
</View>
<View style={{flexDirection: 'row', justifyContent: 'center',position: 'absolute', bottom: '10%'}}>
<TouchableOpacity style={styles.phone_audio_call_accepted} onPress={() =>setMute(!mute)}>
<MaterialCommunityIcons name={ mute ? 'microphone' : 'microphone-off'} size={33} color="black" />
</TouchableOpacity>
<TouchableOpacity style={styles.phone_declined} onPress={() =>{
setOnGoingAudioCall(false);
}}>
<MaterialIcons name="call-end" size={33} color="white" />
</TouchableOpacity>
</View>
</SafeAreaView>
)
}
if (videoCallAccepted){
return(
<SafeAreaView style={styles.container}>
<StatusBar style="light" />
<View style={{backgroundColor: 'white', borderRadius: '100%'}}>
<Image source={require('./assets/caller.png')} resizeMode={'contain'} style={{margin: 9}}/>
</View>
<View>
<Text style={{fontSize: 18, fontWeight: 'bold', color: 'white', padding: 20}}>Richard DOVOEDO</Text>
<Text style={{fontSize: 14, color: 'white',textAlign: 'center', padding: 20}}>Appel en cours</Text>
<Text style={{fontSize: 14, color: 'white', textAlign: 'center', padding: 15 }}>00 : 00 :00</Text>
</View>
<View style={{flexDirection: 'row', justifyContent: 'center',position: 'absolute', bottom: '10%'}}>
<TouchableOpacity style={{...styles.phone_audio_call_accepted,marginHorizontal: '5%',}} onPress={() =>setVideo(!video)}>
<MaterialCommunityIcons name={video ? "video-outline": "video-off-outline"} size={33} color="black" />
</TouchableOpacity>
<TouchableOpacity style={{...styles.phone_call,marginHorizontal: '5%'}} onPress={() =>{
setVideoCallAccepted(false)
setOnGoingVideoCall(true)}}>
<MaterialIcons name="call" size={33} color="white" />
</TouchableOpacity>
<TouchableOpacity style={{...styles.phone_declined,marginHorizontal: '5%'}} onPress={() => setVideoCallAccepted(false)}>
<MaterialIcons name="call-end" size={33} color="white" />
</TouchableOpacity>
</View>
</SafeAreaView>
)
}
if (onGoingVideoCall){
return (
<SafeAreaView style={styles.container}>
<StatusBar style="light" />
<View>
<Text style={{fontSize: 18, fontWeight: 'bold', color: 'white', padding: 10}}>Richard DOVOEDO</Text>
<Text style={{fontSize: 14, color: 'white',textAlign: 'center', padding: 10}}>Appel en cours</Text>
<Text style={{fontSize: 14, color: 'white', textAlign: 'center', padding: 15 }}>00 : 00 :00</Text>
</View>
<View style={{backgroundColor: 'white', borderRadius: '10%'}}>
<Image source={require('./assets/VideoCall.png')} resizeMode={'contain'} style={{margin: 9}}/>
</View>
<View style={{flexDirection: 'row', justifyContent: 'center',position: 'absolute', bottom: '10%'}}>
<TouchableOpacity style={{...styles.phone_audio_call_accepted,marginHorizontal: '5%',}} onPress={() =>setVideo(!video)}>
<MaterialCommunityIcons name={video ? "video-outline": "video-off-outline"} size={33} color="black" />
</TouchableOpacity>
<TouchableOpacity style={{...styles.phone_call,marginHorizontal: '5%', backgroundColor: 'white'}} onPress={() =>setMute(!mute)}>
<MaterialCommunityIcons name={ mute ? 'microphone' : 'microphone-off'} size={33} color="black" />
</TouchableOpacity>
<TouchableOpacity style={{...styles.phone_declined,marginHorizontal: '5%'}} onPress={()=> {
setVideoCallAccepted(false);
setOnGoingVideoCall(false);
}}>
<MaterialIcons name="call-end" size={33} color="white" />
</TouchableOpacity>
</View>
</SafeAreaView>
)
}
if (audioCallAccepted){
return (
<SafeAreaView style={styles.container}>
<StatusBar style="light" />
<View style={{backgroundColor: 'white', borderRadius: '100%'}}>
<Image source={require('./assets/caller.png')} resizeMode={'contain'} style={{margin: 9}}/>
</View>
<View>
<Text style={{fontSize: 18, fontWeight: 'bold', color: 'white', padding: 20}}>Richard DOVOEDO</Text>
<Text style={{fontSize: 14, color: 'white',textAlign: 'center', padding: 20}}>Appel entrant ....</Text>
</View>
<View style={{flexDirection: 'row', justifyContent: 'center',position: 'absolute', bottom: '10%'}}>
<TouchableOpacity style={styles.phone_call} onPress={() =>{
setAudioCallAccepted(false);
setOnGoingAudioCall(true);
}}>
<MaterialIcons name="call" size={33} color="white" />
</TouchableOpacity>
<TouchableOpacity style={styles.phone_declined} onPress={() =>{
setAudioCallAccepted(false);
}}>
<MaterialIcons name="call-end" size={33} color="white" />
</TouchableOpacity>
</View>
</SafeAreaView>
)
}
return (
<SafeAreaView style={styles.container}>
<StatusBar style="light" />
<View style={{flexDirection: 'column', justifyContent: 'center',position: 'absolute', bottom: '45%'}}>
<TouchableOpacity
onPress={() => setAudioCallAccepted(true)}
style={{...styles.phone_call,flexDirection: 'row', justifyContent: 'center', alignItems: 'center',marginVertical: '5%', backgroundColor: 'white'}}>
<Text style={{color: '#1E1060', fontWeight: 'bold'}}>Faire un appel vocal</Text>
<MaterialIcons name="call" size={33} color="#1E1060" style={{marginLeft: '5%'}} />
</TouchableOpacity>
<TouchableOpacity
onPress={() =>setVideoCallAccepted(true)}
style={{...styles.phone_declined,flexDirection: 'row', justifyContent: 'center', alignItems: 'center', marginVertical: '5%', backgroundColor: 'white'}}>
<Text style={{color: '#1E1060', fontWeight: 'bold'}}>Faire un appel video</Text>
<MaterialIcons name="videocam" size={33} color="#1E1060" style={{marginLeft: '5%'}} />
</TouchableOpacity>
</View>
</SafeAreaView>
)
};
const styles = StyleSheet.create({
container : {
flex: 1,
flexDirection: 'column',
backgroundColor: '#1E1060',
justifyContent: 'center',
alignItems: 'center',
},
phone_call : {
backgroundColor: '#5BCA7A',
padding: 15,
borderRadius: 100,
marginHorizontal: '10%'
},
phone_declined : {
backgroundColor: '#D94141',
padding: 15,
borderRadius: 100,
marginHorizontal: '10%'
},
phone_audio_call_accepted : {
backgroundColor: 'white',
padding: 15,
borderRadius: 100,
marginHorizontal: '10%'
}
})
export default CallComponent;