How to use react-native-sqlite-2 - 4 common examples

To help you get started, we’ve selected a few react-native-sqlite-2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / notes / native / app / vendor / kinto-client.js View on Github external
import { KINTO_SERVER_URL } from '../utils/constants';

// IndexedDB shim begins
// See https://github.com/axemclion/IndexedDBShim/issues/313#issuecomment-361593309
Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  obj.__proto__ = proto;
  return obj;
};

// Make indexeddbshim happy with React Native's environment
if (global.window.navigator.userAgent === undefined) {
  global.window.navigator = { ...global.window.navigator, userAgent: '' };
}

// Import native SQLite
const SQLite = require('react-native-sqlite-2').default;

global.window.openDatabase = SQLite.openDatabase;

require('indexeddbshim');
global.shimIndexedDB.__setConfig({ checkOrigin: false });

const Kinto = require('./kinto');
const client = new Kinto({
  remote: KINTO_SERVER_URL,
  bucket: 'default',
});

export default client;
github mozilla / notes / native / app / vendor / kinto-client.js View on Github external
// IndexedDB shim begins
// See https://github.com/axemclion/IndexedDBShim/issues/313#issuecomment-361593309
Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  obj.__proto__ = proto;
  return obj;
};

// Make indexeddbshim happy with React Native's environment
if (global.window.navigator.userAgent === undefined) {
  global.window.navigator = { ...global.window.navigator, userAgent: '' };
}

// Import native SQLite
const SQLite = require('react-native-sqlite-2').default;

global.window.openDatabase = SQLite.openDatabase;

require('indexeddbshim');
global.shimIndexedDB.__setConfig({ checkOrigin: false });

const Kinto = require('./kinto');
const client = new Kinto({
  remote: KINTO_SERVER_URL,
  bucket: 'default',
});

export default client;
github craftzdog / react-native-sqlite-2 / test / app.js View on Github external
loadAndQueryDB() {
    this.addLog('Opening database ...')
    db = SQLite.openDatabase(
      database_name,
      database_version,
      database_displayname,
      database_size,
      this.openCB,
      this.errorCB
    )
    this.populateDatabase(db)
  }
github cliqz-oss / browser-core / platforms / react-native / history / sqlite-history.es View on Github external
constructor() {
    this.db = SQLite.openDatabase('visits.db', '1.0', '', 1);
    this.db.transaction((txn) => {
      txn.executeSql(CREATE_VISIT_TABLE, []);
      txn.executeSql('PRAGMA case_sensitive_like=OFF;');
    });
    events.sub('history:add', (entry) => {
      this.addHistoryEntry(entry);
    });
  }

react-native-sqlite-2

SQLite3 Native Plugin for React Native for iOS, Android, Windows and macOS

Apache-2.0
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis