Registry /
database / react-native-nitro-sqlite
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
NitroSQLite
✓ import { NitroSQLite } from 'react-native-nitro-sqlite'
✗ const { NitroSQLite } = require('react-native-nitro-sqlite')
ESM-only package; CommonJS require not supported.
open
✓ import { open } from 'react-native-nitro-sqlite'
✗ import open from 'react-native-nitro-sqlite'
open is a named export, not default.
type Database
✓ import { type Database } from 'react-native-nitro-sqlite'
✗ import { Database } from 'react-native-nitro-sqlite'
Database is a type-only export; use 'type' import to avoid runtime side effects.
Opens a SQLite database, creates a table, inserts a row, and selects data.
import { open, type Database } from 'react-native-nitro-sqlite';
async function setupDatabase() {
const db: Database = await open({
name: 'example.db',
location: 'default',
});
await db.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT UNIQUE)');
await db.execute('INSERT INTO users (name, email) VALUES (?, ?)', ['Alice', 'alice@example.com']);
const { rows } = await db.execute('SELECT * FROM users');
console.log(rows);
await db.close();
}
setupDatabase().catch(console.error);
Errors
Common errors & fixes
TypeError: Cannot read property 'NitroSQLite' of undefined
Using CommonJS require instead of ESM import.
fixUse 'import { NitroSQLite } from 'react-native-nitro-sqlite'' (ESM). Error: React Native version is not compatible. Please upgrade to at least 0.75.0.
Project uses an older React Native version.
fixUpgrade React Native to 0.75.0+ or use an older version of this library.
TypeError: db.execute is not a function
Calling execute synchronously; open() returns a Promise that resolves to an object with async methods.
fixUse await db.execute(...).
Audit
Dependencies
react-native-nitro-modulesrequiredRequired at runtime for Nitro Modules integration