React Native Document Picker

A React Native module for picking, importing, and saving documents from cloud providers and local storage on iOS and Android.

Library
npm
v12.0.2
1,516stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity60
Maintenance60
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture84
Code Quality85
Innovation78
Learning Curve72

@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 types helper
  • 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.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search