1

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

2
  • You can find path using path module and __dirname. Then you can delete the file using that. Commented May 21, 2020 at 16:33
  • not proper idea about that, can you please provide some detail about that @helloworld Commented Jun 15, 2020 at 11:38

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi ! any idea on how to locate the path of newly created db using the same package?
@HarshitMadhav When I really want to explore the database, I use ios simulator. Sqlite for iOS shows the path in console automatically. You can simply copy that and open in tools like sqlite db browser
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.