React Native SDK
Run PostgreSQL in an iOS or Android app using TypeScript and native platform SDKs.
Use @oliphaunt/react-native with React Native's New Architecture on iOS or Android. The current package requires React Native 0.85+ and React 19+. Expo integration requires Expo 56+ and a native development or production build; Expo Go does not include this native module.
Install and build
npm install @oliphaunt/react-native@0.3.0 @oliphaunt/seed-native-ios-datum64-standard@0.2.2The seed package supplies the initial empty database for iOS; the plugin selects matching initialization resources on Android. For an Expo app, add the config plugin:
{
"expo": {
"plugins": ["@oliphaunt/react-native"]
}
}Build the native app for the platform you are testing:
npx expo run:iosnpx expo run:androidIf you manage native projects directly, integrate the package's iOS CocoaPods and Android Gradle setup as described in native integration. Rebuild after changing native resources or extensions.
Run your first query
Call this function from application initialization or a user action, not during React rendering:
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();
}
}Keep data between launches
Use this storage configuration instead of the disposable example above. Direct mode stays bound to its first root for the lifetime of the process; closing does not let the same process switch roots.
Let the platform SDK choose an app-private directory by name:
const db = await Oliphaunt.open({
storage: { kind: 'applicationData', name: 'main' },
});Keep this handle in an application service. Reopen the same name to use its data again. The default temporary storage is disposable.
Continue with the React Native guide or API reference.