indexeddbshim / indexeddbshim/IndexedDBShim

React-Native support

Open
#313 41 comments 2 reactions 0 assignees View on GitHub
Bug-environment support
Dominant language
JavaScript
Stars
979
Forks
191
Avg merge
55m
Merged PRs (30d)
2

Description

I would like to use this library together with something like https://github.com/craftzdog/react-native-sqlite-2 (which provides a WebSQL compatible interface through SQLite) to get Indexeddb support on React-Native.

I was hopeing this would be easy and that something like the following should work:
```
import SQLite from 'react-native-sqlite-2';
import setGlobalVars from 'indexeddbshim';

let idb = {};
setGlobalVars(idb, { win: SQLite });
var { indexedDB, IDBKeyRange } = idb;
```
But this fails when trying to import indexeddbshim with the following error:
![screenshot_1515598757](https://user-images.githubusercontent.com/11624490/34780969-3d928c64-f62d-11e7-8206-bbaaeb3a1d49.png)

I think that maybe it is trying to do some fancy stuff because it might think it is running on Node. I passed the SQLite object as win in the config because it would not find openDatabase any other way.

What can I try to make this work?

Contributor guide

Open the contributing guide

Research direction

The issue provides a React-Native/SQLite setup snippet and an import error screenshot, but names no repository file or test. Reproduce the import with react-native-sqlite-2 and the shown setGlobalVars configuration first; done means the library initializes and exposes indexedDB and IDBKeyRange in React Native.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native, sqlite
Domain
databases, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.