Ich habe in meinem Paket.json Datei:
.
Code: Select all
"dependencies": {
....
"@react-native-firebase/analytics": "^21.7.1",
"@react-native-firebase/app": "^21.7.1",
"firebase": "10.13",
....
}
Code: Select all
import { getAuth, signInWithEmailAndPassword, onAuthStateChanged } from "firebase/auth";
const App = () => {
const [verified, setVerified] = useState(false);
const [currentUser, setCurrentUser] = useState(null);
...
...
...
useEffect(() => {
const auth = getAuth();
const unsubscribe = onAuthStateChanged(auth, (user) => {
if(user){
setCurrentUser(user);
setVerified(user.emailVerified);
}else{
setCurrentUser(null);
}
});
return () => unsubscribe();
}, []);
...
...
...
if(!currentUser){
return (
);
}
else if (currentUser && !verified){
return (
);
}
else{
return (
);
}
};
export default App;