Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import `getReactNativePersistence` in `[email protected]`

I cannot import the getReactNativePersistence module from the firebase/auth. I'm using Typescript.

Importing the function as below was possible, but it didn't work when I updated the Firebase SDK from 9.22.0 to 10.1.0.

import { getReactNativePersistence } from "firebase/auth/react-native";

It seems like there is no firebase/auth/react-native anymore.

I also tried the following code, as the document indicates,

import { getReactNativePersistence } from "firebase/auth";

But it throws an error.

Module '"firebase/auth"' has no exported member 'getReactNativePersistence'.

I'm using Expo, which uses Metro as default.

This is my metro.config.js

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

module.exports = getDefaultConfig(__dirname);

How can I import getReactNativePersistence in [email protected]?

like image 787
Keunwoo Park Avatar asked Aug 31 '25 15:08

Keunwoo Park


1 Answers

{
  "compilerOptions": {
    "paths": {
      "@firebase/auth": ["./node_modules/@firebase/auth/dist/index.rn.d.ts"]
    }
  },
  "extends": "expo/tsconfig.base"
}

Apparently, it is a typescript issue. Add the code above to your tsconfig.json file. This fix worked for me.

like image 111
Olalekan Ajayi Avatar answered Oct 14 '25 03:10

Olalekan Ajayi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!