-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
80 lines (73 loc) · 2.13 KB
/
App.js
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
import { StatusBar } from "expo-status-bar";
import React, { useState } from "react";
import { SafeAreaView, StyleSheet, Text, View, ActivityIndicator } from "react-native";
import { WebView } from "react-native-webview";
// imports
import Header from "./Components/Header";
import { DefaultTheme, Provider as PaperProvider } from "react-native-paper";
import { Dimensions } from "react-native";
const screenWidth = Math.round(Dimensions.get("window").width);
const screenHeight = Math.round(Dimensions.get("window").height);
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: "#0072bc",
accent: "#0072bc",
},
};
const ActivityIndicatorElement = () => {
return <ActivityIndicator color='#009688' size='large' style={styles.activityIndicatorStyle} />;
};
export default function App() {
const [visible, setVisible] = useState(false);
return (
<SafeAreaView style={{ flex: 1 }}>
<PaperProvider theme={theme} style={{ flex: 1, alignItems: "flex-end", marginTop: 30 }}>
<Header />
<WebView
source={{
uri: "https://muspakistan.com/",
}}
startInLoadingState={true}
scalesPageToFit={true}
style={{
width: screenWidth,
height: screenHeight,
}}
//Enable Javascript support
javaScriptEnabled={true}
//For the Cache
domStorageEnabled={true}
onLoadStart={() => setVisible(true)}
onLoad={() => setVisible(false)}
renderLoading={ActivityIndicatorElement}
/>
{visible ? <ActivityIndicatorElement /> : null}
</PaperProvider>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
// alignItems: "center",
// justifyContent: "center",
// width: deviceWidth,
// height: deviceHeight,
},
activityIndicatorStyle: {
flex: 1,
position: "absolute",
marginLeft: "auto",
marginRight: "auto",
marginTop: "auto",
marginBottom: "auto",
left: 0,
right: 0,
top: 0,
bottom: 0,
justifyContent: "center",
},
});