NitroSQLite

Configuration

SQLite build settings for React Native and NitroUI.

SQLite compile options determine which features the native library provides. JavaScript updates cannot change those options. See supported platforms for the hosts and operating systems.

React Native build settings

The react-native-nitro-sqlite build reads nitroSQLite in your app's package.json. These are its defaults for bundled SQLite:

{
  "nitroSQLite": {
    "threadSafe": true,
    "performanceMode": true,
    "enableRTree": true
  }
}

All values are booleans. Rebuild the native app on every platform after changing them. On iOS with the 11.0.0 alpha, delete ~/Library/Caches/org.swift.swiftpm/manifests before rebuilding so Swift Package Manager reads the new settings. On macOS and visionOS with Nitro SQLite 10.x, install Pods again before rebuilding.

Thread safety

Keep threadSafe enabled. Disabling it rejects independent connections and requires serializing all SQLite calls across the process, including calls to different databases.

Performance mode

performanceMode applies SQLite's recommended build optimizations, independently of threadSafe and enableRTree. Use single quotes for SQL strings; LIKE and GLOB do not match BLOBs.

WAL databases default to synchronous = NORMAL, which can lose recent commits after a power failure. Set PRAGMA synchronous = FULL on each connection if you need that durability. See SQLite's synchronous settings. Performance mode does not enable WAL.

RTree support

enableRTree includes spatial and interval indexes. Disabling it can cause no such module: rtree for schemas using them. See query examples.

When supplying custom flags, omit SQLITE_ENABLE_RTREE to disable it. Defining it as 0 still enables the module.

For platform settings and alternative React Native build flags, see iOS, Android, or macOS.

NitroUI build settings

nitro-sqlite compiles bundled SQLite with thread safety and RTree enabled. Its Package.swift and Android nitro-ui.cmake define those flags directly. The adapter does not read nitroSQLite settings, nitroSqliteFlags, or the React Native package's environment overrides. It also does not apply the React Native performanceMode defaults described above.

To change its compile options, customize the adapter's native build files, then run your host's native preparation and rebuild. Keep SQLite thread safety enabled. The iOS storage settings and Android database directory apply to both hosts.

On this page