From e80d18d6537b2c60bcb930dad347ea35f418b0c8 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 25 Jan 2022 17:51:28 +0000 Subject: [PATCH] Maybe fix deprecation warning (#5739) Related to https://github.com/firebase/firebase-js-sdk/issues/1847 --- packages/auth/index.rn.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/auth/index.rn.ts b/packages/auth/index.rn.ts index 46166af803c..42e6b5476ba 100644 --- a/packages/auth/index.rn.ts +++ b/packages/auth/index.rn.ts @@ -22,7 +22,7 @@ * just use index.ts */ -import { AsyncStorage } from 'react-native'; +import * as ReactNative from 'react-native'; import { FirebaseApp, getApp, _getProvider } from '@firebase/app'; import { Auth, Persistence } from './src/model/public_types'; @@ -57,7 +57,20 @@ export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions * @public */ export const reactNativeLocalPersistence: Persistence = - getReactNativePersistence(AsyncStorage); + getReactNativePersistence({ + getItem(...args) { + // Called inline to avoid deprecation warnings on startup. + return ReactNative.AsyncStorage.getItem(...args); + }, + setItem(...args) { + // Called inline to avoid deprecation warnings on startup. + return ReactNative.AsyncStorage.setItem(...args); + }, + removeItem(...args) { + // Called inline to avoid deprecation warnings on startup. + return ReactNative.AsyncStorage.removeItem(...args); + }, + }); export {getReactNativePersistence};