Skip to content

Title: [Feature Request] Native Dark Theme Support, Text Extraction API, and Full-Text Search in PDF View #1038

Description

@yoh-space

Description
Currently, react-native-pdf lacks robust cross-platform APIs for native dark theme rendering (PDF color inversion/custom theme application), programmatic text extraction (for copy/paste or integration with external tools like note-taking and AI assistants), and an accessible full-text search capability.

Adding these capabilities natively would significantly improve reading accessibility and power study/research applications that rely on text selection, themes, and search inside local or remote PDFs.

Requested Features

  1. Native Dark Theme / Color Inversion Support
    Current Limitation: The nightMode prop is inconsistent across Android/iOS platforms and often leaves the underlying PDF page white or distorts document colors.

Proposed Enhancement:

Add a consistent, cross-platform theme or colorInversion prop (e.g., theme="dark" | "light" | "system" or invertColors={true}).

Allow customization of background canvas colors and text/page color filters to ensure dark mode matches host application themes.

  1. Programmatic Text Extraction & Selection API
    Current Limitation: Text selection (enableTextSelection={true}) is unreliable across native views (especially on Android), and there is no direct programmatic API to extract text from a specific page or selected range.

Proposed Enhancement:

Expose an asynchronous helper method: extractText(pageNumber: number): Promise.

Add an onTextSelect callback returning selected text metadata:

TypeScript
onTextSelect={(selection: { text: string; page: number; bounds: BoundingBox }) => {
console.log(selection.text);
}}
3. Full-Text In-Document Search API
Current Limitation: Users cannot programmatically search for keywords or highlight match instances within the rendered PDF.

Proposed Enhancement:

Add a search execution method: search(keyword: string, options?: SearchOptions): Promise<SearchResult[]>.

Provide native highlight rendering for active search matches and a callback/prop to navigate between match instances (goToMatch(index: number)).

Use Case / Context
Dark Mode Accessibility: Users studying or reading at night require a complete dark theme UI, including the PDF document body.

Study & Productivity Tools: Applications (such as student module readers) need to allow users to select/copy key text, save quotes into built-in note editors, or feed extracted text directly to local/cloud AI assistants.

Navigation: Searching within long academic modules (100+ pages) for specific terms or exam chapters is essential for usability.

Environment & Platform Details
Library Version: Latest (react-native-pdf)

React Native / Expo: React Native (CLI & Expo Config Plugin workflows)

Platforms: Android (PdfRenderer / Pdfium) & iOS (PDFKit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions