React Native Document Picker
A React Native module for picking, importing, and saving documents from cloud providers and local storage on iOS and Android.
Repository Health
Technical Analysis
@react-native-documents/picker is a React Native library that exposes the native document picker interfaces on iOS and Android through a single, promise-based JavaScript API. It lets your app open the system file browser so users can select documents from local storage or connected providers like iCloud, Google Drive, and Dropbox.
Beyond simple selection, it supports importing files, opening documents for one-off or long-term access via security-scoped bookmarks, picking directories, saving documents back out, and keeping local copies. Written in TypeScript with native Kotlin and Swift/Objective-C implementations, it is a widely used building block for file-handling flows in React Native apps.
What You Get
- A promise-based
pick()API returning typed metadata for selected documents - Access to cloud providers (iCloud, Google Drive, Dropbox) and local files through the OS picker
- Directory picking, document saving, and long-term security-scoped bookmark support
- Predefined and custom file-type filters via the
typeshelper - First-class TypeScript types and structured error codes for robust handling
Common Use Cases
- Letting users attach documents from cloud storage or their device to an app
- Importing files for processing, upload, or in-app editing
- Selecting a directory for persistent read/write access to user files
- Saving generated documents back to the user’s chosen location
Under The Hood
Architecture - The picker is a React Native TurboModule (packages/document-picker) whose TypeScript surface in src/index.ts re-exports focused modules — pick.ts, pickDirectory.ts, saveDocuments.ts, keepLocalCopy.ts, isKnownType.ts — each of which calls into a codegen’d native spec (NativeDocumentPicker). The native side is implemented in Kotlin for Android and Swift/Objective-C++ for iOS, bridging the JS calls to the platform document-picker controllers and returning normalized responses. Input validation (validateTypes.ts) and error normalization (errors.ts) sit in the JS layer so callers get consistent, typed results across platforms.
Tech Stack - TypeScript (~85% of the codebase) for the JS API, Kotlin for Android, and Swift/Objective-C++ for iOS. It is a React Native module (peer-depending on react and react-native >= 0.79) built in a Yarn monorepo alongside a companion viewer package, using the modern TurboModule/codegen architecture.
Code Quality - The package ships a __tests__ directory with Jest, uses codegen specs for native type safety, and organizes the public API into small single-purpose files. Errors are surfaced through a structured errorCodes map with an isErrorWithCode guard, and options are validated before hitting native code, reflecting a mature, well-typed codebase.
API Design - The API is ergonomic and discoverable: a primary pick() call with option variants (import, open-once, long-term) expressed as distinct TypeScript types, plus a types constant for common file categories. Rich JSDoc, a dedicated documentation site, and typed responses keep boilerplate low, though the underlying platform differences (bookmarks, scoped access) add conceptual surface for advanced flows.
Used by 2 apps in this directory
Joplin
Note Taking
The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.
Notesnook
Note Taking · File Storage · Security
End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.