Upgrade to Jazz 0.13.0 for React Native Expo
Version 0.13.0 introduces a significant architectural change in how Jazz supports React Native applications. We've separated the React Native implementation into two distinct packages to better serve different React Native development approaches:
- jazz-expo: Dedicated package for Expo applications
- jazz-react-native: Focused package for framework-less React Native applications
- jazz-react-native-core: Shared core functionality used by both implementations (probably not imported directly)
This guide focuses on upgrading Expo applications. If you're using framework-less React Native, please see the React Native upgrade guide.
Migration Steps for Expo
- Update Dependencies
Remove the old packages and install the new jazz-expo
package.
# Remove the old package npm uninstall jazz-react-native # Install the new Expo-specific packages npx expo install expo-sqlite expo-secure-store expo-file-system @react-native-community/netinfo # Install the new packages npm install jazz-expo jazz-react-native-media-images
- Update Imports
Update your imports to use the new jazz-expo
package.
// Before import {
function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvider,useAccount,
function useAccount<A extends RegisteredAccount>(): { me: A; logOut: () => void; } (+1 overload)
useCoState } from "jazz-react-native"; // After import {
function useCoState<V extends CoValue, const R extends RefsToResolve<V> = true>(Schema: CoValueClass<V>, id: ID<CoValue> | undefined, options?: { resolve?: RefsToResolveStrict<V, R>; }): Resolved<V, R> | undefined | null
function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvider,useAccount,
function useAccount<A extends RegisteredAccount>(): { me: A; logOut: () => void; } (+1 overload)
useCoState } from "jazz-expo";
function useCoState<V extends CoValue, const R extends RefsToResolve<V> = true>(Schema: CoValueClass<V>, id: ID<CoValue> | undefined, options?: { resolve?: RefsToResolveStrict<V, R>; }): Resolved<V, R> | undefined | null
- Update Type Declarations
Update your type declarations to use the new jazz-expo
package.
// Before declare module "jazz-react-native" { interface Register {
Register.Account: MyAppAccount
Account:type MyAppAccount = /*unresolved*/ any
MyAppAccount; } } // After declare module "jazz-expo" { interface Register {Register.Account: MyAppAccount
Account:type MyAppAccount = /*unresolved*/ any
MyAppAccount; } }
Clerk Authentication
Clerk authentication has been moved inside the jazz-expo
package. This is a breaking change that requires updating both your imports and providers.
If you're using Clerk auth in your Expo application, you'll need to:
// Before import {
import JazzProviderWithClerk
JazzProviderWithClerk } from "jazz-react-native-clerk"; // After import {JazzProviderWithClerk } from "jazz-expo/auth/clerk";
const JazzProviderWithClerk: (props: { clerk: MinimalClerkClient; } & JazzProviderProps) => JSX.Element | null
Since Clerk only supports Expo applications, this consolidation makes sense and simplifies your dependency structure. You'll need to completely remove the jazz-react-native-clerk
package from your dependencies and use the Clerk functionality that's now built into jazz-expo
.
Storage Adapter Changes
The jazz-expo
package now uses:
ExpoSQLiteAdapter
for database storage (usingexpo-sqlite
)ExpoSecureStoreAdapter
for key-value storage (usingexpo-secure-store
)
These are now the default storage adapters in the JazzProvider
for Expo applications, so you don't need to specify them explicitly.
Example Provider Setup
import {
function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvider } from "jazz-react-native"; import {function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvider } from "jazz-expo"; import {import MyAppAccount
MyAppAccount } from "./schema"; export functionMyJazzProvider({
function MyJazzProvider({ children }: { children: React.ReactNode; }): React.JSX.Element
children: React.ReactNode
children }: {children: React.ReactNode
children:export namespace React
React.type React.ReactNode = string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | null | undefined
Represents all of the things React can render. Where {@link ReactElement } only represents JSX, `ReactNode` represents everything that can be rendered.ReactNode }) { return ( <function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvidersync: SyncConfig
sync={{peer: "wss://cloud.jazz.tools/?key=you@example.com"
peer: "wss://cloud.jazz.tools/?key=you@example.com" }}AccountSchema?: AccountClass<MyAppAccount> | undefined
AccountSchema={import MyAppAccount
MyAppAccount} > {children: React.ReactNode
children} </function JazzProvider(props: JazzProviderProps): React.JSX.Element
JazzProvider> ); } // Register the Account schema declare module "jazz-react-native" { interface Register {Register.Account: MyAppAccount
Account:import MyAppAccount
MyAppAccount; } } declare module "jazz-expo" { interface Register {Register.Account: MyAppAccount
Account:import MyAppAccount
MyAppAccount; } }
New Architecture Support
The jazz-expo
implementation supports the Expo New Architecture.
For More Information
For detailed setup instructions, refer to the React Native Expo Setup Guide