How to use the react-native-sqlite-storage.enablePromise function in react-native-sqlite-storage

To help you get started, we’ve selected a few react-native-sqlite-storage 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 blefebvre / react-native-sqlite-demo / src / database / Database.ts View on Github external
public open(): Promise {
    SQLite.DEBUG(true);
    SQLite.enablePromise(true);
    let databaseInstance: SQLite.SQLiteDatabase;

    return SQLite.openDatabase({
      name: DATABASE.FILE_NAME,
      location: "default"
    })
      .then(db => {
        databaseInstance = db;
        console.log("[db] Database open!");

        // Perform any database initialization or updates, if needed
        const databaseInitialization = new DatabaseInitialization();
        return databaseInitialization.updateDatabaseTables(databaseInstance);
      })
      .then(() => {
        this.database = databaseInstance;
github prsn / redux-persist-sqlite-storage / examples / rn / ReduxPersistSQLiteExample / store.js View on Github external
import thunk from 'redux-thunk';
import todoReducer from './reducers/todo-reducers';
// import storage from 'redux-persist/lib/storage';
import SQLite from 'react-native-sqlite-storage';
import SQLiteStorage from 'redux-persist-sqlite-storage';

const storeEngine = SQLiteStorage(SQLite);
// import logger from 'redux-logger';
const logger = createLogger({
  collapsed: true,
  duration: true,
  logErrors: true
});

SQLite.DEBUG(true);
SQLite.enablePromise(true);


const persistConfig = {
  storage: storeEngine,
  debug: true
};
// const persistedReducer = persistReducer(persistConfig, todoReducer);
// let store = createStore(persistedReducer, {}, applyMiddleware([thunk, logger]));

const store = createStore(
  todoReducer,
  undefined,
  compose(applyMiddleware(thunk, logger),
  autoRehydrate())
);
const persistor = persistStore(store, {storage: storeEngine}, () => console.log('hi'));
github AbelTesfaye / dingo / src / BL / Database / database.js View on Github external
static open() {
		this.databaseName = 'sqlite.db';

		SQLite.enablePromise(true);

		return SQLite.openDatabase({ name: this.databaseName, createFromLocation: '~sqlite.db' }).then(db => {
			console.log('[db] Database open!');
			this.database = db;
			return db;
		});
	}
github MiEcosystem / miot-plugin-sdk / projects / com.xiaomi.demo / Main / ThirdPartDemo / SQLiteDemo.js View on Github external
'use strict';


import React, { Component } from 'react';
import { ListView, StyleSheet, Text, View } from 'react-native';
import SQLite from 'react-native-sqlite-storage';


SQLite.DEBUG(true);
SQLite.enablePromise(false);

const database_name = "Test.db";
const database_version = "1.0";
const database_displayname = "SQLite Test Database";
const database_size = 200000;
let db;

export default class SQLiteDemo extends Component {

  constructor() {
    super();
    this.progress = [];
    this.state = {
      progress: [],
      ds: new ListView.DataSource({
        rowHasChanged: (r1, r2) => r1 !== r2
github MiEcosystem / miot-plugin-sdk / projects / com.xiaomi.demo / Main / SQLiteDemo.js View on Github external
'use strict';


import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  ListView,
  Button
} from 'react-native';


import SQLite from 'react-native-sqlite-storage';
SQLite.DEBUG(true);
SQLite.enablePromise(false);

const database_name = "Test.db";
const database_version = "1.0";
const database_displayname = "SQLite Test Database";
const database_size = 200000;
let db;

export default class SQLiteDemo extends Component {

  constructor() {
    super();
    this.progress = [];
    this.state = {
      progress: [],
      ds: new ListView.DataSource({
        rowHasChanged: (r1, r2) => r1 !== r2}