{"id":46052,"library":"react-native-sqlite-storage","title":"React Native SQLite Storage","description":"react-native-sqlite-storage provides native SQLite3 bindings for React Native on Android and iOS. Version 6.0.1 supports both callback and Promise-based APIs, transactions, pre-populated database import, and Windows via callback. It requires react-native >=0.14.0 and has been tested with React 16.2. The library is the standard choice for SQLite in React Native, offering a familiar Cordova-like API. It supports automatic linking via CocoaPods for RN >=0.60 and manual linking for older versions.","status":"active","version":"6.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/andpor/react-native-sqlite-storage","tags":["javascript","react-native-sqlite-storage","react-native-sqlite","react-component","reactnative","react-native","sqlite","sqlite3","ios"],"install":[{"cmd":"npm install react-native-sqlite-storage","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-sqlite-storage","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-sqlite-storage","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for React Native platform APIs","package":"react-native","optional":false}],"imports":[{"note":"Default export is an object containing SQLite, openDatabase, etc. Use named import for clarity.","wrong":"const SQLite = require('react-native-sqlite-storage'); // may need .default","symbol":"SQLite","correct":"import { SQLite } from 'react-native-sqlite-storage'"},{"note":"Also available as SQLite.openDatabase if using default import.","wrong":"","symbol":"openDatabase","correct":"import { openDatabase } from 'react-native-sqlite-storage'"},{"note":"Call once at startup to enable Promise-based API instead of callbacks.","wrong":"import { SQLite } from 'react-native-sqlite-storage'; SQLite.enablePromise(true); // works but less explicit","symbol":"enablePromise","correct":"import { enablePromise } from 'react-native-sqlite-storage'; enablePromise(true);"}],"quickstart":{"code":"import { openDatabase } from 'react-native-sqlite-storage';\n\nconst db = openDatabase({ name: 'test.db', location: 'default' });\ndb.transaction(tx => {\n  tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id INTEGER PRIMARY KEY, name TEXT)', []);\n  tx.executeSql('INSERT INTO Users (name) VALUES (?)', ['Alice']);\n  tx.executeSql('SELECT * FROM Users', [], (_, results) => {\n    for (let i = 0; i < results.rows.length; i++) {\n      console.log(results.rows.item(i).name);\n    }\n  });\n});","lang":"typescript","description":"Open a SQLite database, create table, insert and select data using callbacks."},"warnings":[{"fix":"Call enablePromise(true) once at app startup.","message":"Enable promise mode explicitly with SQLite.enablePromise(true) before using Promise-based API.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Run 'cd ios && pod install' after npm install.","message":"React Native 0.60+ requires CocoaPods for iOS; manual linking will fail.","severity":"breaking","affected_versions":">=0.60"},{"fix":"Use { name: 'mydb', location: 'default' }.","message":"Database location must be specified; 'default' is recommended for most cases.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ES6 named imports.","message":"Using require() style import may lead to missing default export issues.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Use promise-based transactions with execSQL for async operations.","message":"Transaction callbacks must be synchronous; do not use async/await inside tx callback.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'0.14.0':46 '0.60':80 '16.2':53 '6.0.1':22 'android':18 'api':30,71 'automat':74 'base':29 'bind':13 'callback':25,40 'choic':59 'cocoapod':77 'compon':99 'cordova':69 'cordova-lik':68 'databas':35 'familiar':67 'import':36 'io':20,106 'javascript':87 'librari':55 'like':70 'link':75,83 'manual':82 'nativ':2,7,11,16,45,64,90,95,103 'offer':65 'older':85 'popul':34 'pre':33 'pre-popul':32 'promis':28 'promise-bas':27 'provid':10 'react':1,6,15,44,52,63,89,94,98,102 'react-compon':97 'react-nat':43,101 'react-native-sqlit':93 'react-native-sqlite-storag':5,88 'reactnat':100 'requir':42 'rn':79 'sqlite':3,8,61,91,96,104 'sqlite3':12,105 'standard':58 'storag':4,9,92 'support':23,73 'test':50 'transact':31 'version':21,86 'via':39,76 'window':38","created_at":"2026-06-07T12:58:02.424655+00:00","updated_at":"2026-06-07T12:58:02.424655+00:00","problems":[{"fix":"Run 'npm install react-native-sqlite-storage' and for RN <0.60: 'react-native link react-native-sqlite-storage'.","cause":"Package not installed or not linked.","error":"Module react-native-sqlite-storage cannot be found"},{"fix":"Add 'sqlite3.0.tbd' to 'Link Binary With Libraries' in Xcode.","cause":"Missing SQLite library linking in Xcode (iOS).","error":"No such module 'libsqlite3'"},{"fix":"Use 'import { SQLite } from 'react-native-sqlite-storage'' instead of default import.","cause":"Default import not destructured.","error":"TypeError: Cannot read property 'enablePromise' of undefined"},{"fix":"Check that db is opened before performing operations; handle using promises/callbacks.","cause":"Attempting to use database after closing or before opening.","error":"database is not open"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/andpor/react-native-sqlite-storage","github":"https://github.com/andpor/react-native-sqlite-storage","docs":null,"changelog":null,"pypi":null,"npm":"react-native-sqlite-storage","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}