-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase/auth/react-native
no longer exported in SDK 10
#7425
Comments
Yes, this explicit path was removed, see the release notes: https://firebase.google.com/support/release-notes/js#version_1000_-_july_6_2023 This version also implicitly includes persistence and no longer needs You should be able to import from Sorry about the blog post, will try to get it updated. Edit: Can you make a PR for the Expo doc page? |
Yep, happy to do so. |
Ran into the same issue after updating, I had to change from import {getAuth} from 'firebase/auth';
const auth = getAuth(app); |
In my case migrating to firebase 10.0.0 also introduces a weird bug showing me a white screen without any error import {
getAuth,
signInWithEmailAndPassword,
onAuthStateChanged,
// initializeAuth,
} from 'firebase/auth';
import { TFunction } from 'i18next';
// import { MMKV } from '~/services/storage';
import { Auth } from 'firebase/auth';
const firebaseOptions = {
apiKey: FIREBASE_API_KEY,
authDomain: FIREBASE_AUTH_DOMAIN,
};
// const authOptions = {
// persistence: reactNativeLocalPersistence,
// };
class AuthService {
private auth: Auth;
constructor() {
if (!getApps()?.length) {
const app = initializeApp(firebaseOptions);
this.auth = getAuth(app);
}
const app = getApp();
this.auth = getAuth(app);
} using initializeAuth also does not work constructor() {
if (!getApps()?.length) {
const app = initializeApp(firebaseOptions);
this.auth = initializeAuth(app, authOptions);
}
const app = getApp();
this.auth = getAuth(app);
} |
That’s what I’ve done. It’s best to just remove all persistence/react native references and just follow the web docs. I think the library handles it all now. |
@hernanif1 this seems to be a separate issue. Could you please file another issue request and include details about your apps setup? A minimum reproducible repo would be best |
I had to add I matched the exact version from |
@hernanif1 same occurs here. |
Closing this issue regarding v10 import and usage changes. New issue has been opened above regarding the crashing/white screen: #7448 |
Life saver! Couldn't figure out why persistence wasn't working for the life of me 😕 |
I'm running into the same issue as the original poster when trying to upgrade from 9.23.0 to 10.1.0 with getReactNativePersistence not working. I have a mono-repo setup with an internal package that imports the "firebase" dependency in package.json. In my Expo app I'm then using "getReactNativePersistence", and tried changing the import path as suggested from "firebase/auth/react-ative" to "firebase/auth". I've been searching the firebase code I'm importing, but I'm no longer finding any mention of "getReactNativePersistence" in the firebase library's code, at all. |
It's definitely still there: https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/index.rn.ts#L52 I suspect what might be happening is that you're not getting the RN auth bundle, possibly because of how your module resolution is configured. In a standard React Native project, the bundler (usually Metro) should look at the package.json for auth, here: https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/package.json#L7 and, see either the It's possible there's something about your configuration where it's grabbing the browser bundle instead (esm2017), which wouldn't have |
Operating System
Windows 11
Browser Version
React Native (Expo Go)
Firebase SDK Version
10.0.0
Firebase SDK Product:
Auth
Describe your project's tooling
Expo (SDK 49) with react-native (0.72.1) and typescript
Describe the problem
I was trying to use expo persistence as per this post and was unable to. I searched the internet and found this blog post from firebase, which seemed accurate to SDK 9, however did not work in SDK 10.
Specifically, this happened because:
reactNativeLocalPersistence
is not exported from anywhere else in the SDKWORKAROUND: I am currently staying on SDK 9.
Steps and code to reproduce issue
I'm happy to provide more code as required, and appreciate that this is not enough for a full repro.
The text was updated successfully, but these errors were encountered: