-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
96 lines (77 loc) · 2.58 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
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View,SafeAreaView } from 'react-native';
import * as LocalAuthentication from 'expo-local-authentication';
import { useEffect, useState } from 'react';
import Report from './components/Report.js'
import Home from './components/Home.js'
import Constants from 'expo-constants'
import Details from './components/Details';
import Options from './components/Options';
import Twitter from './components/Twitter';
import Insta from './components/Insta'
import Cameraa from './components/Cameraa'
// import {Report} from './components/Report.js'
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
const Stack=createStackNavigator()
function App() {
let [auth,isAuth]=useState(null);
useEffect(() => {
const checkAuth = async () => {
const hasHardware = await LocalAuthentication.hasHardwareAsync();
if (hasHardware) {
const supported = await LocalAuthentication.supportedAuthenticationTypesAsync();
if (supported.includes(LocalAuthentication.AuthenticationType.FINGERPRINT)) {
const result = await LocalAuthentication.authenticateAsync();
if (result.success) {
console.log('Authenticated')
isAuth(true);
} else {
console.log('Not Authenticated');
isAuth(false);
}
} else {
console.log('Fingerprint not supported');
}
} else {
console.log('No hardware');
}
};
checkAuth();
}, []);
return (
auth ?
<SafeAreaView style={styles.container}>
<StatusBar style="auto" />
<Stack.Navigator>
<Stack.Screen name="Options" component={Options} />
<Stack.Screen name="Twitter"component={Twitter} />
<Stack.Screen name="Insta" component={Insta} />
<Stack.Screen name="Home" component={Home} />
{/* <Stack.Screen name="Report" component={Report} /> */}
<Stack.Screen name="Report" component={Report} />
<Stack.Screen name="Details" component={Details} />
<Stack.Screen name="Cameraa" component={Cameraa} />
</Stack.Navigator>
</SafeAreaView>
:
<View style={styles.container}>
<Text>
Not Authenticated
</Text>
</View>
);
}
export default () =>
{
return (
<NavigationContainer>{ <App/> }</NavigationContainer>
)
}
const styles = StyleSheet.create({
container: {
marginTop: Constants.statusBarHeight,
flex:3,
backgroundColor: '#fff',
},
});