Working on secure device lock authentication with automatic app locking.

This commit is contained in:
mansi-dev
2026-01-16 23:51:44 +05:30
parent 9660a3267c
commit e4f91128ed
3 changed files with 49 additions and 0 deletions

34
src/screen/Managelock.tsx Normal file
View File

@@ -0,0 +1,34 @@
import React, { useEffect, useState } from 'react';
import { AppState, View, Text } from 'react-native';
const App = () => {
const [locked, setLocked] = useState(true);
const [pinExists, setPinExists] = useState(false);
useEffect(() => {
isPinSet().then(setPinExists);
isAppLocked().then(setLocked);
const sub = AppState.addEventListener('change', state => {
if (state !== 'active') lockApp();
});
return () => sub.remove();
}, []);
if (!pinExists) {
return <SetPinScreen onDone={() => setPinExists(true)} />;
}
if (locked) {
return <LockScreen onUnlock={() => setLocked(false)} />;
}
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>🔓 App Unlocked (Home Screen)</Text>
</View>
);
};
export default App;