Setup
This guide will demonstrate how you can make use of prebuild to generate the required native code. Start by creating a new expo app (or use an existing project):RunningBefore running your app, you first need to generate the iOS and Android native projects to take ownership of them. You can do this by runningnpx expo startwill not work as Expo Go does not include the native libraries needed to run Rive. If you were to run this command you’ll see the following error:Invariant Violation: requireNativeComponent: "RiveReactNativeView" was not found in the UIManager.
npx expo prebuild, or npx expo run:[ios|android] (which will run prebuild automatically).
npx expo run:androidrequires Android Studio and the Android SDK to be installed. See the setup environment guide.npx expo run:iosrequires Xcode (macOS only) installed on your computer. See the setup environment guide.
android and ios build folders in your project directory. These projects allow you to configure your iOS and Android application as you would for a traditional native application.
You may get the following error:
Which is likely due to the minimum target iOS version not being high enough.
Something went wrong running pod install in the ios directory.Which is likely due to the minimum target iOS version not being high enough.
14.0 (this is the minimum version that Rive iOS supports). Open ios/Podfile and look for the platform :ios version. It should look something like this:
13.0 to 14.0:
Local Assets
The example above demonstrates how to load ariv file as a network asset. To load files from the asset bundle they need to be included in Android Studio and XCode as assets, see Loading in Rive Files.
You can also see this Github Issue for an alternative approach to load assets.