Enable local persistence

Version 0.9.2 introduces local persistence for React Native apps using SQLite. In version 0.12, we've separated the implementations for Expo and framework-less React Native.

If you are upgrading from a version before 0.9.2, you need to enable local persistence by following the steps below.

Local persistence is enabled by default in version 0.12 and higher.

Choose your implementation

Depending on whether you're using Expo or framework-less React Native, you'll need to follow different steps:

Add the required dependencies

For Expo

As SQLite package, Expo uses expo-sqlite. Install it with:

npx expo install expo-sqlite
npx expo install expo-secure-store

For framework-less React Native

As SQLite package, we use @op-engineering/op-sqlite and react-native-mmkv for key-value storage:

npm install @op-engineering/op-sqlite react-native-mmkv
npx pod-install

Update your JazzProvider

In version 0.12 and higher, you need to use either the jazz-expo package (for Expo) or the jazz-react-native package (for framework-less React Native). Local persistence is enabled by default in both packages.

To enable it, you need to pass the storage option to the JazzProvider component:

<JazzProvider
  auth={auto}
  storage="sqlite"
  peer="wss://cloud.jazz.tools/?key=you@example.com"
  AccountSchema={MyAppAccount}
>
  <App />
</JazzProvider>