-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDownTime.js
More file actions
53 lines (50 loc) · 1.69 KB
/
Copy pathDownTime.js
File metadata and controls
53 lines (50 loc) · 1.69 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
import React from "react";
import { View, Text, StyleSheet, ActivityIndicator } from "react-native";
import { useDispatch, useSelector } from "react-redux";
import { checkServerDown } from "../Func/HomeFunc";
import Button from "./Button";
import { AnimeHostName, ComicHostName } from "../../Utils/APIs";
const DownTime = () => {
const dispatch = useDispatch();
const loading = useSelector(state => state.data.loading);
const animeActive = useSelector(state => state?.data?.Anime);
const baseUrl = useSelector(state => state.data.baseUrl);
return (
<View style={styles.container} >
{loading ?
<Text style={styles.title}>Checking server...</Text>
: <Text style={styles.title}>Server is down for maintenance</Text>}
{loading ?
<ActivityIndicator size="large" color="#fff" />
:
<Button
title="Retry"
onPress={() => {
if (animeActive) {
checkServerDown(AnimeHostName[baseUrl], dispatch, baseUrl)
} else {
checkServerDown(ComicHostName[baseUrl], dispatch, baseUrl)
}
}}
textSize={20}
/>}
</View>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#222',
justifyContent: "center",
alignItems: "center",
gap: 15,
paddingHorizontal: 20
},
title: {
fontSize: 26,
fontWeight: 'bold',
color: '#fff',
textAlign: 'center',
}
})
export default DownTime;