Skip to content

Commit e80d18d

Browse files
authored
Maybe fix deprecation warning (#5739)
Related to #1847
1 parent e04b745 commit e80d18d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/auth/index.rn.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* just use index.ts
2323
*/
2424

25-
import { AsyncStorage } from 'react-native';
25+
import * as ReactNative from 'react-native';
2626

2727
import { FirebaseApp, getApp, _getProvider } from '@firebase/app';
2828
import { Auth, Persistence } from './src/model/public_types';
@@ -57,7 +57,20 @@ export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions
5757
* @public
5858
*/
5959
export const reactNativeLocalPersistence: Persistence =
60-
getReactNativePersistence(AsyncStorage);
60+
getReactNativePersistence({
61+
getItem(...args) {
62+
// Called inline to avoid deprecation warnings on startup.
63+
return ReactNative.AsyncStorage.getItem(...args);
64+
},
65+
setItem(...args) {
66+
// Called inline to avoid deprecation warnings on startup.
67+
return ReactNative.AsyncStorage.setItem(...args);
68+
},
69+
removeItem(...args) {
70+
// Called inline to avoid deprecation warnings on startup.
71+
return ReactNative.AsyncStorage.removeItem(...args);
72+
},
73+
});
6174

6275
export {getReactNativePersistence};
6376

0 commit comments

Comments
 (0)