umang desai
umang desai

Reputation: 13

How to get SQLite database file path for get Database using react-native

im using react-native-sqlite-storage For database https://github.com/andpor/react-native-sqlite-storage

Now i have pre-populated-sqlite-database in .../www/ folder for both android & ios.

Now insert some data with query & get proper output of it in app. But now im delete database from /www folder but still its results are get in app. SO i think its create copy database of it.

how im get proper database path for this copy database file for both android & ios in react-native

Upvotes: 1

Views: 3500

Answers (2)

Sayyam abbasi
Sayyam abbasi

Reputation: 109

Run your app with Xcode and it will show you in Xcode console local database path copy that path and find it in Finder (macOS) and you will get you database file

Upvotes: 0

helloworld
helloworld

Reputation: 2311

When you deploy an app (or use in emulator), the database is copied to the platform and isn't the same as www/ folder. If you want to remove data from app

Either uninstall and install (it will copy again from www)

OR

Clear Application Data (that will clean all storage and make app as originally installed)

If you're keen to find path (though I couldn't think of a usecase), You can run make use of package like https://www.npmjs.com/package/react-native-fs and run code within App.js to find current directory and console.log it.

Upvotes: 1

Related Questions