Introduction
iCloud and Google Drive for React Native.
React Native Cloud Storage allows you to use iCloud (iOS only) and Google Drive as file storage in your React Native app. The API of its core functionality follows the conventions of the Node.js module fs. React hooks and other utilities make working with cloud files even easier.
Features
fs-like API —readFile,writeFile,appendFile,readdir,mkdir,stat,unlink, and more, modeled on Node'sfsso there's almost nothing new to learn.- 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 —
useCloudFileanduseIsCloudAvailablekeep 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, CloudStorageScope } from 'react-native-cloud-storage';
// Write a JSON file to the app-private scope (iCloud on iOS, Google Drive elsewhere).
await CloudStorage.writeFile('/state.json', JSON.stringify({ level: 7 }), CloudStorageScope.AppData);
// Read it back later.
if (await CloudStorage.exists('/state.json', CloudStorageScope.AppData)) {
const json = await CloudStorage.readFile('/state.json', CloudStorageScope.AppData);
const { level } = JSON.parse(json);
}Prefer hooks? useCloudFile wraps this read/write cycle into a single reactive value.
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.
API Reference
Browse the full CloudStorage API, hooks, and types.