How react-native-async-storage/async-storage works
React Native Async Storage exposes asynchronous key-value operations, including batch access and named databases, over platform-specific persistent backends. A client uses the JavaScript API, which dispatches to native storage or the web implementation; native calls reach platform adapters and, on Android and Apple platforms, shared SQLite storage. Windows uses a legacy fallback, while the README documents IndexedDB for web and legacy fallbacks for visionOS and Windows. The graph preserves documented platform capabilities, but some links to unsampled web and legacy implementations are necessarily unverified.
Main entry points: SharedStorageImpl.kt Storage implementation · NativeAsyncStorage.ts Native bridge · RNStorage.swift Apple adapter · SharedStorage.kt Shared storage API
Components 19
JavaScript API
- Storage API
packages/async-storage/src/AsyncStorage.ts - Native factory
packages/async-storage/src/createAsyncStorage.native.ts - Native bridge
packages/async-storage/src/native-module/NativeAsyncStorage.ts - Web factory
packages/async-storage/src/createAsyncStorage.ts
Platform Adapters
- IndexedDB storage
packages/async-storage/src/web-module/IndexedDBStorage.ts - Connection registry
packages/async-storage/src/web-module/IndexedDBConnectionRegistry.ts - Android module
packages/async-storage/android/src/main/kotlin/org/asyncstorage/legacy_storage/LegacyStorageModule.kt - Android registry
packages/async-storage/android/src/main/kotlin/org/asyncstorage/storage/StorageRegistry.kt - Android adapter
packages/async-storage/android/src/main/kotlin/org/asyncstorage/storage/RNStorage.kt - Apple adapter
packages/async-storage/apple/storage/RNStorage.swift - Apple registry
packages/async-storage/apple/storage/StorageRegistry.swift
Shared SQLite
- Shared storage API
shared-storage/src/commonMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.kt - Storage implementation
shared-storage/src/commonMain/kotlin/org/asyncstorage/shared_storage/SharedStorageImpl.kt - Room database
shared-storage/src/commonMain/kotlin/org/asyncstorage/shared_storage/database/StorageDatabase.kt - Android database setup
shared-storage/src/androidMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.android.kt - Apple database setup
shared-storage/src/appleMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.apple.kt
Legacy Backends
- Windows fallback
packages/async-storage/src/createAsyncStorage.windows.ts - Windows SQLite
packages/async-storage/windows/code/DBStorage.cpp
Other components
- React Native app
Connections 21
- React Native app → Storage API: uses
README.md - Storage API → Native factory: creates
packages/async-storage/src/createAsyncStorage.native.ts - Native factory → Native bridge: dispatches
packages/async-storage/src/createAsyncStorage.native.ts - React Native app → Web factory: uses on web
README.md - Web factory → IndexedDB storage: selects
- IndexedDB storage → Connection registry: uses connections
packages/async-storage/src/web-module/IndexedDBStorage.ts - Native bridge → Android module: calls
- Android module → Android registry: dispatches
packages/async-storage/android/src/main/kotlin/org/asyncstorage/legacy_storage/LegacyStorageModule.kt - Android registry → Android adapter: selects
packages/async-storage/android/src/main/kotlin/org/asyncstorage/storage/StorageRegistry.kt - Android adapter → Shared storage API: calls
packages/async-storage/android/src/main/kotlin/org/asyncstorage/storage/RNStorage.kt - Native bridge → Apple adapter: calls
- Apple adapter → Shared storage API: calls
packages/async-storage/apple/storage/RNStorage.swift - Apple registry → Apple adapter: registers
packages/async-storage/apple/storage/StorageRegistry.swift - Shared storage API → Storage implementation: implemented by
shared-storage/src/commonMain/kotlin/org/asyncstorage/shared_storage/SharedStorageImpl.kt - Storage implementation → Room database: queries
shared-storage/src/commonMain/kotlin/org/asyncstorage/shared_storage/SharedStorageImpl.kt - Android database setup → Storage implementation: constructs
shared-storage/src/androidMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.android.kt - Android database setup → Room database: opens
shared-storage/src/androidMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.android.kt - Apple database setup → Storage implementation: constructs
shared-storage/src/appleMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.apple.kt - Apple database setup → Room database: opens
shared-storage/src/appleMain/kotlin/org/asyncstorage/shared_storage/SharedStorage.apple.kt - React Native app → Windows fallback: uses on Windows
README.md - Windows fallback → Windows SQLite: calls legacy module