Introduction
iCloud and Google Drive for React Native.
React Native Cloud Storage allows you to use iCloud (iOS only) and Google Drive as file and data storage in your React Native app. Its API is intentionally developer-friendly, mirroring known tools like fs and AsyncStorage.
Features
- File storage with
fs-like API —readFile,writeFile,appendFile,readdir,mkdir,stat,unlink, and more, modeled on Node'sfsso there's nothing new to learn. - Key-value storage — save preferences and small app state through native iCloud key-value storage or an emulated Google Drive store.
- Two providers, one API — iCloud (via a native CloudKit module) and Google Drive (via the REST API). Use the platform default or switch between them at runtime.
- React hooks —
useCloudFile,useCloudKV, anduseIsCloudAvailablekeep your components in sync with cloud state. - Scopes — read and write in a hidden, app-private container (
AppData) or the user-visible iCloud Drive / Google DriveDocumentsfolder. - Expo config plugin — configures the native iCloud capability automatically, with no manual Xcode steps.
- Built for the New Architecture — ships as a Turbo Module and is fully typed with TypeScript.
Quick example
import { CloudStorage, CloudKVStorage, CloudStorageScope } from 'react-native-cloud-storage';
// Write a file to the app-private scope (iCloud on iOS, Google Drive elsewhere).
await CloudStorage.writeFile('/data.txt', 'Hello, world!', CloudStorageScope.AppData);
// Or write to the key-value store (iCloud ubiquitous key-value store on iOS, Google Drive with emulated JSON file elsewhere)
await CloudKVStorage.setItem('theme', 'dark');
// Read it back later.
const helloWorld = await CloudStorage.readFile('/data.txt', CloudStorageScope.AppData); // 'Hello, world!'
const theme = await CloudKVStorage.getItem('theme'); // 'dark'Prefer hooks? useCloudFile and useCloudKV wrap this into reactive values.
Provider & platform support
| Provider | iOS | Android | Notes |
|---|---|---|---|
| iCloud | ✅ | — | Backed by a native CloudKit module; available out of the box. |
| Google Drive | ✅ | ✅ | Backed by the Drive REST API; you provide an access token. |
By default, the library picks the right provider for each platform: iCloud on iOS, Google Drive everywhere else. You can override this or even use both providers at once.
Get started
Install in Expo
Add the library to an Expo managed project with the config plugin.
Install in bare React Native
Set up the native iCloud capability in a bare project.
Configure Google Drive
Acquire and provide an access token for the Drive API.
Cloud key-value storage
Store preferences and small app state across devices.
API Reference
Browse the full CloudStorage API, hooks, and types.