Skip to content

Upgrading to 10.3.0 broke TypeScript detecting getReactNativePersistence function for Expo RN #7584

@seanblonien

Description

@seanblonien

Operating System

iOS 16.4

Browser Version

Chrome latest

Firebase SDK Version

10.3.0

Firebase SDK Product:

Auth

Describe your project's tooling

Expo tooling React Native app with Firebase JS SDK
(Expo 49.0.0)
(VSCode 1.81.1)

Describe the problem

I was following 10.3.0's new error message:

 WARN  [2023-08-24T04:43:17.235Z]  @firebase/auth: Auth (10.3.0): 
You are initializing Firebase Auth for React Native without providing
AsyncStorage. Auth state will default to memory persistence and will not
persist between sessions. In order to persist auth state, install the package
"@react-native-async-storage/async-storage" and provide it to
initializeAuth:

import { initializeAuth, getReactNativePersistence } from 'firebase/auth';
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
const auth = initializeAuth(app, {
  persistence: getReactNativePersistence(ReactNativeAsyncStorage)
});

introduced by #7570, and yet somehow it was missed that the getReactNativePersistence function is no longer exported from the firebase/auth entry point as of 10.0.0 according to VSCode (does not seem to pick up the native entry point if that function is exported):
image

how do I get my editor to detect the new native entry point?
is this new entry point pattern compatible with managed expo projects, or only bare react-native projects?
(running the numbers quickly, expo is just over 1/3 of the react-native community according to NPM downloads)

#7138 seems to blatantly remove those exported functions without re-exporting them, which seems like they literally are just not exposed and virtually "deleted" from the library. or the native detection just isn't working at all for me, so direction on how to get that working would be helpful

Steps and code to reproduce issue

  1. upgrade firebase to 10.3.0 in Expo 49.0.0 project
  2. try copying the code from above to initialize the auth object
  3. notice the error about it not finding that function

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions