How to use expo-sqlite - 4 common examples

To help you get started, we’ve selected a few expo-sqlite 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 expo / expo / packages / expo / src / deprecated.ts View on Github external
get() {
      deprecatedModule(
        `import { SQLite } from 'expo' -> import { SQLite } from 'expo-sqlite'`,
        'expo-sqlite'
      );
      return require('expo-sqlite').SQLite;
    },
  },
github expo / expo / packages / expo / src / globals.ts View on Github external
get() {
      return require('expo-sqlite').SQLite;
    },
  },
github expo / sqlite-example / App.js View on Github external
import React from "react";
import {
  ScrollView,
  StyleSheet,
  Text,
  View,
  TextInput,
  TouchableOpacity
} from "react-native";
import Constants from "expo-constants";
import { SQLite } from "expo-sqlite";

const db = SQLite.openDatabase("db.db");

class Items extends React.Component {
  state = {
    items: null
  };

  componentDidMount() {
    this.update();
  }

  render() {
    const { done: doneHeading } = this.props;
    const { items } = this.state;
    const heading = doneHeading ? "Completed" : "Todo";

    if (items === null || items.length === 0) {
github wheatandcat / Peperomia / PeperomiaNative / src / lib / db / index.ts View on Github external
import * as SQLite from 'expo-sqlite';
import { create as createItem } from './item';
import { create as createItemDetail } from './itemDetail';
import { create as createUser } from './user';
import { create as createCalendar } from './calendar';

export const db: any = SQLite.openDatabase('db.db');
export type ResultError = Error | null;

export const success = (
  data: any,
  callback?: (data: any, error: ResultError) => void
) => {
  if (!callback) {
    return;
  }
  callback(data, null);
};

export const error = (
  err: ResultError,
  callback?: (data: any, err: ResultError) => void
) => {

expo-sqlite

Provides access to a database that can be queried through a WebSQL-like API (https://www.w3.org/TR/webdatabase/). The database is persisted across restarts of your app.

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis