Skip to content

[Draft] feat(android): Implement Kotlin Coroutines for React Native 0.78 Compatibility #829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

isouravganguly
Copy link

Overview

This PR implements a React Native document picker module using Kotlin coroutines for efficient asynchronous operations. This is a draft PR intended for reference and discussion purposes, as I am maintaining a local version while the main package has moved to newer implementations.

Technical Details

Coroutines Implementation (RNDocumentPickerModule.kt)

  • Utilizes Kotlin coroutines for handling asynchronous file operations
  • Implements CoroutineScope for structured concurrency
  • Uses Dispatchers.IO for file system operations to avoid blocking the main thread
  • Manages coroutine lifecycle with SupervisorJob for proper cleanup
  • Handles file metadata extraction and copying in background threads

Native Module Architecture (RNDocumentPickerPackage.java)

  • Implements React Native's Native Module system
  • Registers document picker functionality through ReactPackage interface
  • Provides native Android document picking capabilities to React Native
  • Handles both single and multiple file selection
  • Supports directory selection

Status

This PR will remain in draft status as it serves as a reference implementation for our local project needs. The main package has evolved to newer features, but this implementation is maintained for specific project requirements.

Purpose

Sharing this implementation for:

  • Code review and feedback
  • Reference for similar implementations
  • Documentation of an approach to handling file operations with Kotlin coroutines in React Native

Note

This is not intended for merging into the main package but serves as a documented implementation of forked requirements, on and before 9.x version.

Copy link

changeset-bot bot commented May 24, 2025

⚠️ No Changeset found

Latest commit: fe763fb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@isouravganguly isouravganguly changed the title Kotlin coroutines [Draft] feat(android): Implement Kotlin Coroutines for React Native 0.78 Compatibility May 24, 2025
@vonovak
Copy link
Member

vonovak commented May 25, 2025

Hello,
Thanks for the PR.

Just to be clear, I don't intend to merge major PRs to old versions of the package. I do intend to merge bug fixes with limited scope. Rewriting to kotlin goes beyond that.

Instead people should move to the new package.

Thank you for your understanding. 🙏

@vonovak vonovak closed this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants