-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
32 lines (29 loc) · 1022 Bytes
/
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
import React, { useState ,useEffect} from 'react'
import Dashboard from './Components/Dashboard'
import { NavigationContainer } from '@react-navigation/native';
import { createContext } from 'react';
import { Alert, StatusBar } from 'react-native';
import SplashScreen from 'react-native-splash-screen'
export const LockedContext = createContext();
export default function App() {
useEffect (()=>{
SplashScreen.hide();
},[])
const [locked, setlocked] = useState(true);
const [status, setstatus] = useState(true);
const handleLock = ()=>{
setlocked(!locked);
locked?Alert.alert('Unclocked successfully'):Alert.alert('Locked successfully!!');
}
const handleStatus =()=>{
setstatus(!status);
}
return (
<LockedContext.Provider value={{ locked ,handleLock, status, handleStatus}}>
<StatusBar backgroundColor='#380E6B' />
<NavigationContainer>
<Dashboard/>
</NavigationContainer>
</LockedContext.Provider>
)
}