react-nativereact-native-iosreact-native-sqlite-storage

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


Solution

  • 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.