-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
98 lines (87 loc) · 2.17 KB
/
App.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
import React, { useState } from "react";
import { AppLoading, ScreenOrientation } from "expo";
import { Video } from "expo-av";
import { Asset } from "expo-asset";
import { useKeepAwake } from "expo-keep-awake";
import { StatusBar, StyleSheet, View } from "react-native";
import { useScreens } from "react-native-screens";
import {
Appbar,
DefaultTheme,
Provider as PaperProvider
} from "react-native-paper";
import { SafeAreaView } from "react-navigation";
import AppContainer from "./src/index";
import globalStyles from "./src/util/globalStyles";
useScreens();
const backgroundVideo = Asset.fromModule(require("./assets/background.mp4"));
const theme = {
...DefaultTheme,
dark: true,
// mode: 'exact',
colors: {
...DefaultTheme.colors,
primary: "#ea0c33",
accent: "#ea0c33",
text: "white"
}
};
async function changeScreenOrientation() {
const landscapeMode = await ScreenOrientation.lockAsync(
ScreenOrientation.OrientationLock.PORTRAIT_UP
);
console.log(landscapeMode);
}
export default function App() {
const [isReady, setReady] = useState(false);
useKeepAwake();
// changeScreenOrientation();
async function _cacheResourcesAsync() {
const media = [
require("./assets/background.mp4")
];
const cacheMedia = media.map(item => {
return Asset.fromModule(item).downloadAsync();
});
return Promise.all(cacheMedia);
}
if (!isReady)
return (
<AppLoading
startAsync={_cacheResourcesAsync}
onFinish={() => setReady(true)}
onError={console.warn}
autoHideSplash
/>
);
return (
<PaperProvider theme={theme}>
<StatusBar hidden barStyle="light-content" />
<Video
style={globalStyles.video}
source={backgroundVideo}
volume={0}
isLooping
shouldPlay
isMuted
resizeMode="cover"
/>
<View style={styles.container}>
<AppContainer />
</View>
</PaperProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1
// alignItems: "center",
// justifyContent: "center"
},
fab: {
position: "absolute",
margin: 16,
right: 0,
bottom: 0
}
});