If there are any breaking changes to the React Native SDK, we will document migration paths between versions here.
Migration guides
Migrating to v0.8
We have made significant changes to the Stytch React Native SDK to make installation and configuration easier for developers. This is a migration guide for all developers using the Stytch React Native and React Native Expo SDKs prior to v0.8.
- If you are currently using Expo Go, start at Development builds below.
- If you are currently using Expo development builds, start at Stytch React Native Expo SDK below.
- Otherwise, start at Stytch React Native SDK near the bottom of this section.
Development builds
The Stytch React Native SDK requires the use of custom native code for the best auth experience. Expo Go does not allow custom native code, and as a result, we no longer support apps using Expo Go.
We recommend moving to development builds to support custom native code and to continue using the Stytch React Native SDK. You may want to complete the steps in Stytch React Native Expo SDK and Stytch React Native SDK before starting to create a development build to have the correct dependencies set up. The Expo documentation provides an in-depth guide for creating a development build, but these are the main steps:
- Create an Expo account if you don't already have one.
- Install the eas-cli package globally.
npm install -g eas-cli
- Log into your Expo account.
eas login
- Install the expo-dev-client package in your project.
npx expo install expo-dev-client
- Create a development build using EAS Build.
eas build
Stytch React Native Expo SDK
All React Native and Expo projects can now use @stytch/react-native. The @stytch/react-native-expo package will no longer be maintained but is still available for existing customers using this version.
To migrate your Expo project to @stytch/react-native, the only changes that you'll need to make to your are installing the @stytch/react-native package and uninstalling the @stytch/react-native-expo package (along with other dependencies that are no longer required):
# Remove old package and dependencies
npm uninstall @stytch/react-native-expo @stytch/react-native-modules react-native-keychain react-native-device-info react-native-get-random-values
# Install new package
npm install @stytch/react-native @stytch/react-native-inappbrowser-reborn
Stytch React Native SDK
The @stytch/react-native-modules package is now included in @stytch/react-native by default.
Some of the previous dependencies for @stytch/react-native can be removed, this includes react-native-keychain, react-native-device-info, and react-native-get-random-values.
We recommend removing these old dependencies and adding the new @stytch/react-native-inappbrowser-reborn dependency to keep your build clean:
# Remove old dependencies
npm uninstall @stytch/react-native-modules react-native-keychain react-native-device-info react-native-get-random-values
# Install new dependency
npm install @stytch/react-native-inappbrowser-reborn
Migrating to v0.6
@stytch/react-native@0.6.0 updates the useStytchUser and useStytchSession hooks. The useStytchUser and useStytchSession hooks now return envelope objects, {(user, fromCache)} and {(session, fromCache)} respectively. On first render, the SDK will read the user or session out of local storage, and serve them with fromCache: true. The SDK will make network requests to update the user and session objects, and serve them with fromCache: false.