Android
Database storage, batch atomic writes, and Gradle overrides.
The database directory applies to both React Native and NitroUI. The Gradle options below belong to react-native-nitro-sqlite. For NitroUI's native build, see Configuration and supported platforms.
Database location
By default, Nitro SQLite opens databases in the app's internal filesDir, including existing databases after an app upgrade. When SQLite stores temporary tables on disk, it uses the app's cache directory. See file locations for the location option and prepopulated databases.
Manual initialization
React Native autolinking initializes the native library. An app that loads it manually calls com.margelo.nitro.nitrosqlite.RNNitroSQLiteOnLoad.initializeNative(). Version 11.0.0 moved this class from com.margelo.nitro.rnnitrosqlite. Repeated calls are safe.
NitroUI uses the activity initializer declared by nitro-sqlite. It records the application context before JavaScript starts. A custom runtime host must call com.margelo.nitro.nitrosqlite.SQLiteModule.initialize(applicationContext) before importing the package. Repeated calls are safe; the initializer retains only the application context.
Commit I/O
In React Native apps, disable batch atomic writes with this setting in package.json:
{
"nitroSQLite": {
"enableBatchAtomicWrite": false
}
}enableBatchAtomicWrite defaults to true on Android, independently of performanceMode. It uses atomic filesystem commits when supported and otherwise falls back to SQLite's journal. Rebuild after changing it.
SQLite compile flags
For React Native, use nitroSqliteFlags in android/gradle.properties for additional SQLite features or to override individual build defaults. For example, to enable FTS5:
nitroSqliteFlags="-DSQLITE_ENABLE_FTS5=1"Separate several definitions with spaces, for example nitroSqliteFlags="-DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1". Custom definitions take precedence over package.json defaults. To disable batch atomic writes, use enableBatchAtomicWrite: false and remove custom SQLITE_ENABLE_BATCH_ATOMIC_WRITE definitions; setting that flag to 0 still enables it.
Android flushes data with fdatasync(). To use fsync(), add -DHAVE_FDATASYNC=0. Rebuild after changing flags.
Vector search
For React Native, install react-native-nitro-sqlite-vec and add this to android/gradle.properties:
nitroSqliteVec=trueRebuild and follow the vector search guide. For SEE build settings, see encryption.