11import { NavigationContainer } from '@react-navigation/native' ;
22import React , { createContext , ReactNode , useState } from 'react' ;
3- import { NativeModules , StyleSheet , useColorScheme } from 'react-native' ;
43import RootStack from './Navigation/RootStack' ;
54
6-
75type AuthContextType = {
86 authenticated : boolean | null ;
9- setAuthenticated : ( u : boolean ) => void ;
7+ setAuthenticated : ( u : boolean ) => void ;
108} ;
119
1210type AuthProviderProps = {
1311 children : ReactNode ;
14- }
12+ } ;
1513
1614export const AuthContext = createContext < AuthContextType | undefined > ( undefined ) ;
1715
18- function AuthProvider ( { children} : AuthProviderProps ) {
16+ function AuthProvider ( { children } : AuthProviderProps ) {
1917 const [ authenticated , setAuthenticated ] = useState ( false ) ;
20- return (
18+ return (
2119 < AuthContext . Provider value = { { authenticated, setAuthenticated } } >
2220 { children }
2321 </ AuthContext . Provider >
24- )
22+ ) ;
2523}
2624
2725function App ( ) {
28- const { BuzzCardReader } = NativeModules ;
29- const isDarkMode = useColorScheme ( ) === 'dark' ;
30- const [ readerText , setReaderText ] = useState ( "No text found" ) ;
31- const [ scanning , setScanning ] = useState ( false ) ;
32-
33- const selectApp = [ 0x90 , 0x5A , 0x00 , 0x00 , 0x03 , 0xCD , 0xBB , 0xBB , 0x00 ] ;
34- const readFile = [ 0x90 , 0xBD , 0x00 , 0x00 , 0x07 , 0x01 , 0x00 , 0x00 , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 ] ;
35-
36- async function readNfc ( ) {
37- setScanning ( true ) ;
38- }
39-
40- /*return (
41- <View style={styles.container}>
42- <Text style={styles.baseText}>
43- {readerText}
44- </Text>
45- <Button title="Scan" onPress={readNfc} />
46- <NfcScanModal scanning={scanning} appCmd={selectApp}
47- readCmd={readFile} modalText='Place your BuzzCard near the phone.'
48- callback={(error, result) => {
49- if (error) {
50- setReaderText(error.message);
51- } else {
52- //setReaderText(result?.toString() ?? 'yeet');
53- setReaderText(typeof result);
54- }
55- setScanning(false);
56- }}/>
57- </View>
58- );*/
5926 return (
6027 < AuthProvider >
6128 < NavigationContainer >
@@ -65,15 +32,4 @@ function App() {
6532 ) ;
6633}
6734
68- const styles = StyleSheet . create ( {
69- container : {
70- flex : 1 ,
71- } ,
72- baseText : {
73- fontFamily : 'Cochin' ,
74- textAlign : 'center' ,
75- marginTop : 50 ,
76- } ,
77- } ) ;
78-
7935export default App ;
0 commit comments