Skip to content

refactor: replace NitroSQLiteOnLoad with a platform context - #462

Open
chrispader wants to merge 1 commit into
nitro-v1/hybrid-object-namesfrom
nitro-v1/platform-context
Open

chrispader wants to merge 1 commit into
nitro-v1/hybrid-object-namesfrom
nitro-v1/platform-context

Conversation

@chrispader

@chrispader chrispader commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

NitroSQLite sets its database directory differently on each platform. On Android, JavaScript calls NitroSQLiteOnLoad.init(), which passes the app's files and cache directories to C++ through a hand-written JNI function. On iOS, an Objective-C +load method sets the same static C++ path before JavaScript runs.

A PlatformContext hybrid object now returns the database, temporary, and legacy database directories. Android implements it in Kotlin, and iOS in Objective-C++ with the existing RNNitroSQLite_AppGroup and RNNitroSQLite_DatabaseLocation options. JavaScript passes the directories to the NitroSQLite constructor, so each root resolves databases against its own directories.

🤖 Generated with Claude Code

@chrispader
chrispader added this pull request to stack #461 October 22, 2026 18:37
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
react-native-nitro-sqlite Skipped Skipped Oct 23, 2026 12:19am UTC

Request Review

@chrispader
chrispader removed this pull request from stack #461 October 22, 2026 20:15
@chrispader
chrispader force-pushed the nitro-v1/platform-context branch from a74e32f to 66c38e0 Compare October 22, 2026 20:15
@chrispader
chrispader added this pull request to stack #464 October 22, 2026 20:16
A PlatformContext hybrid object now returns the database, temporary
and legacy database directories. Kotlin reads them from the Android
application context, and Objective-C++ applies the iOS Info.plist
options that OnLoad.mm handled at launch. JavaScript passes them to
the NitroSQLite constructor, so each root resolves databases against
its own directories instead of static paths, and the Android JNI
setter and the iOS +load hook go away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrispader
chrispader removed this pull request from stack #464 October 23, 2026 00:18
@chrispader
chrispader force-pushed the nitro-v1/platform-context branch from 66c38e0 to 537737b Compare October 23, 2026 00:19
@chrispader
chrispader added this pull request to stack #466 October 23, 2026 00:19

This branch was previously deployed

1 inactive deployment
Preview — 537737bc Deployed Oct 23, 2026 by vercel[bot]
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.

1 participant