Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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(() => {
import {createLogger} from 'redux-logger';
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())
);
import SQLiteStorage from 'react-native-sqlite-storage';
SQLiteStorage.DEBUG(__DEV__); // 启动调试信息
SQLiteStorage.enablePromise(true); // 使用 promise(true) 或者 callback(false)
export default class SQLite {
static delete(database) {
return SQLiteStorage.deleteDatabase(database)
.then(res => ({ res }))
.catch(err => ({ err }));
}
constructor(databaseName, databaseVersion, databaseDisplayName, databaseSize) {
this.databaseName = databaseName;
this.databaseVersion = databaseVersion;
this.databaseDisplayName = databaseDisplayName;
this.databaseSize = databaseSize;
this.successInfo = (text, absolutely) => {
if (__DEV__) {
import React, { Component } from 'react'
import SQLiteStorage from 'react-native-sqlite-storage'
SQLiteStorage.DEBUG(false)
const database_name = 'reader.db'
const database_version = '1.0'
const database_displayname = 'ReaderSQLite'
const database_size = -1
let db
const Book_TABLE_NAME = 'Book' // 书架表
const Chapter_TABLE_NAME = 'Chapter' // 目录表
export default class SQLite extends Component {
constructor() {
super()
}
componentWillUnmount() {
if (db) {
this._successCB('close')
* See http://opensource.org/licenses/alphabetical for full text.
*/
'use strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView
} 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;
class SQLiteDemo extends Component {
constructor() {
super();
this.progress = [];
this.state = {
progress: [],
ds: new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2}
* See http://opensource.org/licenses/alphabetical for full text.
*/
'use strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView
} from 'react-native';
import SQLite from 'react-native-sqlite-storage';
SQLite.DEBUG(true);
SQLite.enablePromise(true);
const database_name = "Test.db";
const database_version = "1.0";
const database_displayname = "SQLite Test Database";
const database_size = 200000;
let db;
class SQLiteDemo extends Component {
constructor() {
super();
this.progress = [];
this.state = {
progress: [],
ds: new ListView.DataSource({
import React, {Component} from 'react'
import {View, WebView, Dimensions} from "react-native";
import Toast from 'dore-toast';
import Orientation from 'react-native-orientation';
import RNIconBadge from 'dore-icon-badge'
import RNDeviceInfo from "react-native-device-info";
import DeviceBrightness from 'react-native-device-brightness';
import Permissions from 'react-native-permissions'
import {captureScreen} from "react-native-view-shot";
import {AppInstalledChecker} from "react-native-check-app-install";
import RNShakeEvent from 'react-native-shake-event';
import Torch from 'react-native-torch';
import SendSMS from 'react-native-sms'
import RNCalendarEvents from 'react-native-calendar-events';
import SQLite from 'react-native-sqlite-storage';
SQLite.DEBUG(true);
SQLite.enablePromise(true);
import Dore from 'dore';
let {
height: deviceHeight,
width: deviceWidth
} = Dimensions.get('window');
export default class ExampleWebView extends Component {
static componentName = 'ExampleWebView';
constructor() {
super();
this.state = {
isLoading: true
};
'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({