Skip to content

Commit

Permalink
Maybe fix deprecation warning (#5739)
Browse files Browse the repository at this point in the history
Related to #1847
  • Loading branch information
gaearon committed Jan 25, 2022
1 parent e04b745 commit e80d18d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/auth/index.rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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};

Expand Down

0 comments on commit e80d18d

Please sign in to comment.