Registry / database / react-native-sqlite-mobx

react-native-sqlite-mobx

JSON →
library1.3.18jsnpmunverified

Utility library bridging SQLite and MobX for React Native apps. Current version 1.3.18, under active development (status: active). Provides SQLite promise-based API, MobX observable models with CRUD operations via SQLiteMobxModel, and a reactive SQLiteMobxFlatList component. Differentiates by tightly coupling MobX state management with SQLite persistence, reducing boilerplate. Requires react-native >=0.61 and react >=16.9.0.

npm install react-native-sqlite-mobx
INSTALL
IMPORT
SIG · REACT-NATIVE-SQLIT
R
react-native-sqlite-mobx
databasejavascriptv1.3.18
harness data pending
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.

SQLite
✓ import { SQLite } from 'react-native-sqlite-mobx'
✗ const SQLite = require('react-native-sqlite-mobx')
ESM default? Actually named export. Requires ESM or Babel.
SQLiteMobxModel
✓ import { SQLiteMobxModel } from 'react-native-sqlite-mobx'
✗ import SQLiteMobxModel from 'react-native-sqlite-mobx'
Named export, not default.
SQLiteMobxFlatList
✓ import { SQLiteMobxFlatList } from 'react-native-sqlite-mobx'
Named export.

Demonstrates SQLite initialization, MobX model creation with schema, CRUD usage, and reactive FlatList.

import { SQLite, SQLiteMobxModel, SQLiteMobxFlatList } from 'react-native-sqlite-mobx'; // Initialize SQLite database const db = new SQLite({ name: 'test.db', location: 'default' }); // Create a model extending SQLiteMobxModel class UserModel extends SQLiteMobxModel { constructor() { super({ tableName: 'users', db: db, schema: { id: 'INTEGER PRIMARY KEY AUTOINCREMENT', name: 'TEXT', email: 'TEXT UNIQUE' } }); } } const userModel = new UserModel(); // Use CRUD methods await userModel.create({ name: 'John', email: 'john@example.com' }); const users = await userModel.read({}); console.log(users); // Use FlatList <SQLiteMobxFlatList model={userModel} renderItem={({ item }) => <Text>{item.name}</Text>} />
Debug
Known issues
gotchaPeer dependencies react-native and react must be installed. Missing peer deps cause crash on native SQLite operations.
fix
Ensure react-native >=0.61 and react >=16.9.0 are installed.
affects: >=1.0.0
deprecatedDocumentation states 'Under construction' – some APIs may change without notice.
fix
Lock version to 1.x if stability needed; monitor GitHub for updates.
affects: <2.0.0
gotchaSQLite location 'default' may not work on Android emulator; use absolute path or react-native-fs.
fix
Provide a writable path like `location: 'Library'` or use `react-native-fs` to get DocumentsDirectory.
affects: >=1.0.0
Errors
Common errors & fixes
Module 'react-native-sqlite-mobx' not found or undefined is not an object
Forget to link native module or missing peer dep react-native-sqlite-storage
fix
Run `npx react-native link react-native-sqlite-mobx` and ensure react-native-sqlite-storage is installed.
Cannot read property 'create' of undefined
SQLiteMobxModel super call missing db or tableName config
fix
Ensure you pass `{ tableName: '...', db: db, schema: {...} }` to super().
Upgrade
Version history
1.3.18latest on npm
Audit
Dependencies
react-nativerequiredpeer dependency required for native SQLite module
reactrequiredpeer dependency for React base
mobxoptionalused for observable state management
mobx-react-liteoptionalused for observer components
Agent activity
11 hits · last 30 days
node
8
Meta
1
Resources
react-native-sqlite-mobx — npm install react-native-sqlite-mobx · libregistry