React Native SQLite 2 is a native SQLite3 plugin for React Native supporting iOS, Android, Windows, and macOS. It provides a WebSQL-compatible API and serves as a drop-in replacement for react-native-sqlite-storage, specifically solving issues with null characters (\u0000) in string data and attachment storage that affected PouchDB compatibility. It uses sqlite-android to deliver a newer SQLite version on Android with support for JSON1, CTE, expression indexes, and FTS5. Current stable version: 3.6.3. Release cadence is irregular; maintained by craftzdog. Key differentiator: PouchDB-friendly due to proper handling of null characters and stable attachment storage, and a more up-to-date SQLite engine on Android.
npm install react-native-sqlite-2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Opens a database, creates a table, inserts a row, and queries all rows using WebSQL-compatible transaction API.
Use positional arguments: openDatabase('mydb', '1.0', '', 1)Use openDatabase('mydb', '1.0', '', 1).catch(err => console.error(err))Use absolute paths if you need custom location; otherwise rely on default.
Update React Native to 0.60+ and run pod install in ios/ directory.
Ensure your app does not rely on foreign keys being off by default.
Run npm install react-native-sqlite-2 --save and for RN < 0.60 run react-native link react-native-sqlite-2
Use default import: import SQLite from 'react-native-sqlite-2'
Manage database lifecycle properly; use a single instance and avoid closing while transactions are pending.
Use ? placeholders only for values, not for table/column names.
No dependency data recorded yet.