File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change 8
8
Animated ,
9
9
TouchableOpacity ,
10
10
BackHandler ,
11
+ Alert ,
11
12
} from 'react-native' ;
12
13
import SoundPlayer from 'react-native-sound-player' ;
13
14
import auth from '@react-native-firebase/auth' ;
@@ -113,6 +114,25 @@ export default class GameHome extends Component {
113
114
} ) ;
114
115
}
115
116
117
+ onLogout ( ) {
118
+ Alert . alert (
119
+ 'Logout' ,
120
+ 'Are you sure, you want to logout of the app?' ,
121
+ [
122
+ {
123
+ text : 'Yes' ,
124
+ onPress : async ( ) => {
125
+ await GoogleSignin . revokeAccess ( ) ;
126
+ await GoogleSignin . signOut ( ) ;
127
+ auth ( ) . signOut ( ) ;
128
+ } ,
129
+ } ,
130
+ { text : 'No' } ,
131
+ ] ,
132
+ { cancelable : true } ,
133
+ ) ;
134
+ }
135
+
116
136
render ( ) {
117
137
return (
118
138
< View style = { styles . viewContainer } >
@@ -154,11 +174,7 @@ export default class GameHome extends Component {
154
174
</ TouchableOpacity >
155
175
< TouchableOpacity
156
176
style = { styles . button }
157
- onPress = { async ( ) => {
158
- await GoogleSignin . revokeAccess ( ) ;
159
- await GoogleSignin . signOut ( ) ;
160
- auth ( ) . signOut ( ) ;
161
- } } >
177
+ onPress = { ( ) => this . onLogout ( ) } >
162
178
< Text style = { styles . buttonText } > LogOut</ Text >
163
179
</ TouchableOpacity >
164
180
</ Animated . View >
You can’t perform that action at this time.
0 commit comments