andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.74k stars 521 forks source link

TypeError: Cannot read properties of undefined (reading 'open') #562

Open AhmedMustafa505 opened 11 months ago

AhmedMustafa505 commented 11 months ago

I'm stuck on using react-native-sqlite-storage, whenever I start initially open a new database as was mentioned in the documentation usage, I get this error: TypeError: Cannot read properties of undefined (reading 'open').

this is my code so far.

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

const App = () => { try { SQLite.openDatabase({name: 'UserDatabase', location: 'default'}); } catch (error) { console.log(error); }

return ( <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>

SQLite Database Example
</View>

); };

export default App;

any solutions for this ?

MacKenzieHnC commented 11 months ago

Please write code as:

```js \ ```

This will post it in a code block with javascript syntax highlighting and make it much easier to read

Additionally, when making react native issues, please provide which device type you're experiencing the issue on. I'm guessing Windows, and if so, have you found my pull request which fixes this?

Additionally, this repo is dead, and I think I might be the only person still answering questions here.

amiellion commented 9 months ago

Do you know about any alternatives @MacKenzieHnC for sqlite and react native?