Find path for Realm file with Realm React Native to use with Realm Browser

Just found the answer myself by digging through the docs:

console.log('create db:', db.path)

Just in case you can't get the above to work. Here is how I did it:

1) import the file in which you define the schema and create a new realm into a component that will mount when you refresh the simulator.

import realm from './path_to_file_where_realm created'

2) console.log(realm.path) in the componentWillMount() lifecycle method & enable remote debugging to see the output.

3) open up realm browser and click open realm file. Command Shift G on mac will let you paste in the path from the console.log

click on the realm file to open it with the realm browser.

Also for those not familiar with the realm browser, it can be found here. It just lets you see & edit data in your realm with a graphical interface.


In my case i used,

const Realm = require('realm');
console.log('REALM PATH', Realm.defaultPath);