Skip to content

davidsonsns/poc-rn-realm-instance

Repository files navigation

POC - React Native Realm Instance

This project was initially cloned by MongoDB University - realm-tutorial and the first thing made was to change the structure to use Typescript.

The main goal here is to create a POC, or maybe to propose some alternative maybe, to how creating a default Realm instance without stuck the app while running a long migration processing.

Steps

Install dependencies:

# install package.json dependencies
yarn install

# install pod dependecies
cd ios && pod install && cd ..

# run app
yarn ios # or yarn android

Migration testing

  1. Run the app and add fake tasks using the seed button on the top. To see how long your app can be stuck I highly recommend adding more than 200000 items.
  2. Close the app and change the lines below:
2.1 `./src/database/index.ts` => change line 5 to value 1;
2.2 `./src/database/Task.ts` => uncomment line 38
  1. Open the app again and you should see the ActivityIndicator running while realm runs the migration.