Firebase.JS
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
const firebaseConfig = {
// ...
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
RegisterScreen.js
import { auth } from "../firebase";
import { createUserWithEmailAndPassword } from "firebase/auth";
const RegisterScreen = ({ navigation }) => {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const register = () => {
createUserWithEmailAndPassword(auth, email, password)
.then(() => {
console.log("User created!");
})
.catch((error) => alert(error.message));
console.log("Inside register!");
};
My Error:
ERROR TypeError: _firebase.auth.createUserWithEmailAndPassword is not a function (it is undefined), js engine: hermes
https://firebase.google.com/docs/auth/web/start?authuser=0#web
I have tried moving around the import statements so it’s all on one page.
I have tried clearing the cache in expo.
New contributor
WannaBeSoftwareEngineer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.