22
22
* just use index.ts
23
23
*/
24
24
25
- import * as ReactNative from 'react-native' ;
26
-
27
25
import { FirebaseApp , getApp , _getProvider } from '@firebase/app' ;
28
- import { Auth , Persistence } from './src/model/public_types' ;
26
+ import { Auth } from './src/model/public_types' ;
29
27
30
28
import { initializeAuth } from './src' ;
31
29
import { registerAuth } from './src/core/auth/register' ;
32
30
import { ClientPlatform } from './src/core/util/version' ;
33
31
import { getReactNativePersistence } from './src/platform_react_native/persistence/react_native' ;
32
+ import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage' ;
34
33
35
34
// Core functionality shared by all clients
36
35
export * from './index.shared' ;
@@ -50,28 +49,6 @@ export {
50
49
// MFA
51
50
export { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone' ;
52
51
53
- /**
54
- * An implementation of {@link Persistence} of type 'LOCAL' for use in React
55
- * Native environments.
56
- *
57
- * @public
58
- */
59
- export const reactNativeLocalPersistence : Persistence =
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
- } ) ;
74
-
75
52
export { getReactNativePersistence } ;
76
53
77
54
export function getAuth ( app : FirebaseApp = getApp ( ) ) : Auth {
@@ -82,7 +59,7 @@ export function getAuth(app: FirebaseApp = getApp()): Auth {
82
59
}
83
60
84
61
return initializeAuth ( app , {
85
- persistence : reactNativeLocalPersistence
62
+ persistence : getReactNativePersistence ( ReactNativeAsyncStorage )
86
63
} ) ;
87
64
}
88
65
0 commit comments