@oliphaunt/react-native
v0.3.2
Published
React Native New Architecture SDK for Oliphaunt.
Readme
Oliphaunt React Native SDK
Embed PostgreSQL in an iOS or Android app using React Native's New Architecture. The package requires React Native 0.85+ and React 19+; Expo integration requires Expo 56+ and a native build.
Install
npm install @oliphaunt/react-native @oliphaunt/seed-native-ios-datum64-standardFor Expo, add "@oliphaunt/react-native" to expo.plugins in app.json, then build with npx expo run:ios or npx expo run:android. Expo Go does not include this native module. For bare projects, follow the native integration guide.
The quickstart covers prerequisites and the versions documented by the current site. Pin dependencies in your application manifest or lockfile.
First query
Call firstQuery() from application initialization or a user action.
import Oliphaunt from '@oliphaunt/react-native';
export async function firstQuery() {
const db = await Oliphaunt.open();
try {
const result = await db.query('SELECT $1::int4 AS answer', [42]);
console.log(result.rows[0]?.answer); // 42
} finally {
await db.close();
}
}Default storage is a disposable temporary directory. Direct mode stays bound to its first root and configuration for the lifetime of the process, even after closing a handle. Use the quickstart's persistent-storage example for application data; run it as an alternative to this disposable example. Always close database handles explicitly.
Build your integration
- Guide: parameters, transactions, extensions, backups, and shutdown.
- API reference: methods, configuration, results, and errors.
- Runtime support: platforms, storage, and concurrency.
- Releases and upgrades: dependency and database upgrades.
