-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.tsx
62 lines (60 loc) · 1.65 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
import React from 'react';
import { StyleSheet, Text, View, Platform, ActivityIndicator } from 'react-native';
import { Context } from './context'
import ContextProvider from './context/ContextProvider'
import { Provider as PaperProvider } from 'react-native-paper';
import Navigator from './Navigator'
export default function App() {
console.log(Platform.OS)
return (
<>
{Platform.OS === 'web' && (
<style>{`
html,
body {
height: 100%;
background: #f5f5f5;
box-sizing: border-box;
}
body {
padding: 40px 0;
}
#root {
width: 100%;
max-width: 420px;
height: 100%;
min-height: 0;
max-height: 800px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
margin: auto;
border-radius: 8px;
background: #ffffff;
overflow: hidden;
box-sizing: border-box;
}
`}</style>
)}
<PaperProvider>
<ContextProvider>
<Context.Consumer>
{states =>
states.isLoading
? <View style={styles.loading}>
<ActivityIndicator size="large" color="#000"></ActivityIndicator>
<Text>{'\n\n'}{states.message}</Text>
</View>
: <Navigator></Navigator>
}
</Context.Consumer>
</ContextProvider>
</PaperProvider>
</>
);
}
const styles = StyleSheet.create({
loading: {
justifyContent: 'center',
alignItems: 'center',
height: '100%'
}
})