Use this file to discover all available pages before exploring further.
Note that certain Rive features may not be supported yet for a particular runtime, or may require using the Rive Renderer.For more details, refer to the feature support and choosing a renderer pages.
🚀 The new Rive React Native runtime is now available! Built with Nitro for improved performance and better React Native integration.Get started:
The RiveView component displays Rive graphics. It requires a single prop: file, a RiveFile object.Use the useRiveFile hook to load a riv file and create a RiveFile object. This object can be cached and reused across multiple components.
Configure how the graphic fits within its container.For this example, we’ll set fit to Layout, which automatically resizes the artboard to match the view size. This is ideal for responsive Rive graphics built with Layouts.
Create the view model instance manually using the useViewModelInstance hook and pass it to the view.This approach lets you set initial property values in the onInit callback before the view loads and decouples the ViewModelInstance from the RiveView.
We call playIfNeeded to force the state machine to play. Under some circumstances, the state machine might be settled if there is no active timeline in the graphic.This is a temporary workaround. In the future, this will happen automatically.
Further reading:
Data binding
See the runtime data binding documentation for more information.
The legacy runtime is still supported, but we recommend migrating to the new runtime for better performance and features.
This guide documents how to get started using the legacy React Native runtime library. The source is available in its GitHub repository. This library contains an API for React Native apps to easily integrate Rive assets.The minimum iOS target is 14.0
Follow the steps below for a quick start on integrating Rive into your React Native app.
1
Install the dependency
npm install rive-react-native# or for Yarnyarn add rive-react-native
2
iOS - Pod Install
cd inside the ios folder and run pod install (if deploying to iOS)
If you run into issues here, you may need to bump the ios deployment version target to at least 14.0. You can find this version in the Podfile of the ios/ folder.
3
Android - Set Kotlin Dependency Resolution
This step may be optional - however, if your Android setup in the React Native project does not have Kotlin v1.8.0+ set up, you may run into duplicate class issues when building the project. To mitigate these issues, as suggested by Kotlin docs, add the following to your dependencies in your application’s build.gradle file to deal with version alignment: