This repository has been archived by the owner on Feb 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
61 lines (52 loc) · 1.49 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
import React, { Component, useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as Font from 'expo-font';
import { BarCodeScanner } from 'expo-barcode-scanner';
import NavigationContainer from './src/services/navigator'
import NavigationBar from './src/components/navigation/navigationBar'
export default class App extends Component {
state = {
fontsLoaded: false,
firebaseInitialized: false,
hasCameraPermission: null
};
async loadFonts() {
await Font.loadAsync({
// Load fonts from static resources
LemonMilk: require('./assets/fonts/LEMONMILK-Medium.ttf'),
Raleway: require('./assets/fonts/Raleway-Regular.ttf'),
'Open Sans': require('./assets/fonts/OpenSans-Regular.ttf')
});
this.setState({ fontsLoaded: true });
}
async requestPermissions () {
const { status } = await BarCodeScanner.requestPermissionsAsync();
this.state.hasCameraPermission = status === 'granted';
}
componentDidMount() {
this.loadFonts();
this.requestPermissions();
}
render() {
if (this.state.fontsLoaded) {
return (
<View style={styles.container}>
<NavigationContainer style={styles.container}/>
<NavigationBar style={styles.navigationBar}/>
</View>
);
} else {
return null;
}
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white'
},
navigationBar: {
position: 'absolute',
bottom: 0
}
});