-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathApp.js
144 lines (128 loc) · 2.75 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import { useFonts } from 'expo-font';
import { BlurView } from '@react-native-community/blur';
import React, { useEffect } from 'react';
import {
Alert,
Linking,
Platform,
ScrollView,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';
import { Camera, CameraType } from 'expo-camera';
import Tabs from './components/Tabs';
import Post from './components/Post';
import Header from './components/Header';
import Story from './components/Story';
if (Platform.OS === 'android') {
StatusBar.setTranslucent(true);
StatusBar.setBackgroundColor('transparent');
}
const usersArray = [
{
name: 'Nika Gabunia',
role: 'Chief Executive Officer',
},
{
name: 'Jeko Tediashvili',
role: 'Web/Mobile Developer',
},
{
name: 'Niko Chopikashvili',
role: 'NodeJS Developer',
},
{
name: 'Alexander Pataridze',
role: 'Junior Developer',
},
{
name: 'Miranda Pagava',
role: 'Project Manager',
},
{
name: 'Nika Kereselidze',
role: 'NodeJS Developer',
},
];
const App = () => {
const [fontsLoaded] = useFonts({
MontserratRegular: require('./assets/fonts/Montserrat-Regular.ttf'),
MontserratBold: require('./assets/fonts/Montserrat-Bold.ttf'),
});
const [permission, requestPermission] = Camera.useCameraPermissions();
const goToSettings = () =>
Alert.alert(
'',
'You do not have a camera permission. Go to application settings and enable it manually.',
[
{
text: 'Not right now',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'Go to settings',
onPress: () => Linking.openSettings(),
},
]
);
useEffect(() => {
requestPermission();
}, []);
useEffect(() => {
if (permission && !permission.granted) {
goToSettings();
}
}, [permission]);
if (fontsLoaded) {
return (
<View style={styles.screenContainer}>
{permission.granted && (
<MaskedView
style={styles.maskViewStyle}
maskElement={
<>
<Header />
<Story />
{usersArray.map((user, i) => (
<Post key={i} user={user} />
))}
<Tabs />
</>
}>
<Camera style={{ flex: 1 }} ratio='16:9' type={CameraType.back}></Camera>
<BlurView
style={styles.blurViewStyle}
blurType='light'
blurAmount={20}
reducedTransparencyFallbackColor='white'
/>
</MaskedView>
)}
</View>
);
}
return null;
};
export default App;
const styles = StyleSheet.create({
screenContainer: {
flex: 1,
backgroundColor: 'black',
},
maskViewStyle: {
flex: 1,
flexDirection: 'row',
},
blurViewStyle: {
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
flex: 1,
display: Platform.OS === 'android' ? 'none' : 'flex',
},
});