File tree Expand file tree Collapse file tree
packages/auth/src/platform_react_native/persistence Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,6 +250,28 @@ export declare function getReactNativePersistence(storage: ReactNativeAsyncStora
250250
251251[ Persistence] ( ./auth.persistence.md#persistence_interface )
252252
253+ ### Example
254+
255+
256+ ``` javascript
257+ import { initializeAuth , getReactNativePersistence } from ' firebase/auth' ;
258+
259+ // For @react-native-async-storage/async-storage v3:
260+ import { createAsyncStorage } from ' @react-native-async-storage/async-storage' ;
261+ const appStorage = createAsyncStorage (' app' );
262+ const persistence = getReactNativePersistence (appStorage);
263+
264+ // For @react-native-async-storage/async-storage v2:
265+ // import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
266+ // const persistence = getReactNativePersistence(ReactNativeAsyncStorage);
267+
268+ // Then, initialize auth:
269+ const auth = initializeAuth (app, {
270+ persistence
271+ });
272+
273+ ```
274+
253275## function(auth, ...)
254276
255277### applyActionCode(auth, oobCode) {:#applyactioncode_d2ae15a}
Original file line number Diff line number Diff line change @@ -30,6 +30,25 @@ import {
3030 * `react-native` or `@react-native-async-storage/async-storage`, and can
3131 * be used in the persistence dependency field in {@link initializeAuth}.
3232 *
33+ * @example
34+ * ```javascript
35+ * import { initializeAuth, getReactNativePersistence } from 'firebase/auth';
36+ *
37+ * // For @react -native-async-storage/async-storage v3:
38+ * import { createAsyncStorage } from '@react-native-async-storage/async-storage';
39+ * const appStorage = createAsyncStorage('app');
40+ * const persistence = getReactNativePersistence(appStorage);
41+ *
42+ * // For @react -native-async-storage/async-storage v2:
43+ * // import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
44+ * // const persistence = getReactNativePersistence(ReactNativeAsyncStorage);
45+ *
46+ * // Then, initialize auth:
47+ * const auth = initializeAuth(app, {
48+ * persistence
49+ * });
50+ * ```
51+ *
3352 * @public
3453 */
3554export function getReactNativePersistence (
You can’t perform that action at this time.
0 commit comments