This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExpoSqliteTupleStorageApi implements AsyncTupleStorageApi { | |
private db = SQLite.openDatabase("app.db"); | |
constructor() {} | |
async prepare() { | |
await this.db.execAsync( | |
[ | |
{ | |
sql: ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isFunction, isSymbol } from "lodash-es"; | |
import type { | |
KeyValuePair, | |
ReadOnlyTupleDatabaseClientApi, | |
TupleTransactionApi, | |
} from "tuple-database"; | |
import { | |
InMemoryTupleStorage, | |
TupleDatabase, | |
TupleDatabaseClient, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { unionBy } from "lodash-es"; | |
import React, { ReactElement, useEffect, useState } from "react"; | |
import { Animated, useAnimatedValue } from "react-native"; | |
function diffBy<T>(a: T[], b: T[], key: keyof T) { | |
const aKeys = a.map((item) => item[key]); | |
const bKeys = b.map((item) => item[key]); | |
const added = b.filter((item) => !aKeys.includes(item[key])); | |
const removed = a.filter((item) => !bKeys.includes(item[key])); |