The Storage panel lists the keys and values in your app’s AsyncStorage and MMKV instances, and looks up SecureStore keys by name. You can edit, add and delete keys from the desktop app.
Using Storage in the desktop app
Accepts
false | StoragePluginConfig Opt-in| Option | Type | Default | Description |
|---|---|---|---|
asyncStorage | AsyncStorageLike | — | AsyncStorage instance to read, write and delete string values from. |
mmkv | Record<string, MMKVLike> | — | MMKV instances to inspect, keyed by the name the desktop app shows for each one. |
secureStore | SecureStoreLike | — | SecureStore module to read, write and delete individual keys from. It cannot list its keys. |
Pass the storage your app uses to init():
import AsyncStorage from '@react-native-async-storage/async-storage';import { init } from '@xerlock/client';import * as SecureStore from 'expo-secure-store';import { createMMKV } from 'react-native-mmkv';
const caseFiles = createMMKV({ id: 'case-files' });
init({ storage: { asyncStorage: AsyncStorage, mmkv: { caseFiles }, secureStore: SecureStore, },});import AsyncStorage from '@react-native-async-storage/async-storage';import { init } from '@xerlock/client';import * as SecureStore from 'expo-secure-store';import { MMKV } from 'react-native-mmkv';
const caseFiles = new MMKV({ id: 'case-files' });
init({ storage: { asyncStorage: AsyncStorage, mmkv: { caseFiles }, secureStore: SecureStore, },});Each MMKV instance is listed by its key in mmkv, so caseFiles appears as mmkv::caseFiles.
Live updates
Section titled “Live updates”Changes your app makes show up in the panel as they happen:
- MMKV: each change is reported through the instance’s
addOnValueChangedListener. - AsyncStorage: the SDK wraps the write methods of the object you pass, such as
setItemandmultiRemove, and reports each write once it finishes. Pass the same object your app writes with. If the object can’t be changed, for example because it’s frozen, click Refresh to see new values. - SecureStore can’t report changes. Click Refresh to read a key again.
Shapes
Section titled “Shapes”The SDK doesn’t depend on AsyncStorage, MMKV or expo-secure-store. Any object with these shapes
works:
| Member | Description |
|---|---|
getAllKeys(): Promise<readonly string[]> | Resolves to every key in storage. |
multiGet(keys: readonly string[]): Promise<readonly (readonly [string, string | null])[]> | Resolves to [key, value] pairs for the given keys. |
getItem(key: string): Promise<string | null> | Resolves to the value for key, or null if it isn't set. |
setItem(key: string, value: string): Promise<void> | Sets key to value. |
removeItem(key: string): Promise<void> | Removes key. |
| Member | Description |
|---|---|
getAllKeys(): string[] | Returns every key currently stored. |
getString(key: string): string | undefined | Decodes key as a string, or returns undefined if it isn't set or doesn't decode as one. |
getNumber(key: string): number | undefined | Decodes key as a number, or returns undefined if it isn't set or doesn't decode as one. |
getBoolean(key: string): boolean | undefined | Decodes key as a boolean, or returns undefined if it isn't set or doesn't decode as one. |
set(key: string, value: string | number | boolean): void | Sets key to a string, number or boolean value. |
delete?(key: string): void | Removes key. Renamed to remove in react-native-mmkv v4. |
remove?(key: string): void | Removes key. The v4 replacement for delete. |
addOnValueChangedListener?(listener: (key: string) => void): { remove(): void } | Calls the listener with each key that changes, and returns a handle to stop listening. Enables live updates. |
| Member | Description |
|---|---|
getItemAsync(key: string, options?: SecureStoreOptionsLike): Promise<string | null> | Resolves to the value for key, or null if it isn't set. |
setItemAsync(key: string, value: string, options?: SecureStoreOptionsLike): Promise<void> | Sets key to value. |
deleteItemAsync(key: string, options?: SecureStoreOptionsLike): Promise<void> | Removes key. |
AFTER_FIRST_UNLOCK?: number | Keychain accessibility constant matching SecureStoreKeychainAccessible's AFTER_FIRST_UNLOCK. |
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY?: number | Keychain accessibility constant matching AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY. |
ALWAYS?: number | Keychain accessibility constant matching ALWAYS. |
ALWAYS_THIS_DEVICE_ONLY?: number | Keychain accessibility constant matching ALWAYS_THIS_DEVICE_ONLY. |
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY?: number | Keychain accessibility constant matching WHEN_PASSCODE_SET_THIS_DEVICE_ONLY. |
WHEN_UNLOCKED?: number | Keychain accessibility constant matching WHEN_UNLOCKED. |
WHEN_UNLOCKED_THIS_DEVICE_ONLY?: number | Keychain accessibility constant matching WHEN_UNLOCKED_THIS_DEVICE_ONLY. |
Turning it off
Section titled “Turning it off”Leave out storage, or pass false, to hide the Storage panel for this app.
Limits and Troubleshooting
Section titled “Limits and Troubleshooting”- The Storage panel is missing: pass
storagetoinit(). - AsyncStorage changes don’t appear until you refresh: pass
init()the same AsyncStorage object your app writes with.