@rive-app/react-native is the recommended Rive runtime for React Native. Built with Nitro, it replaces the legacy rive-react-native package.Starting with 0.5.0, it runs on Rive’s new native runtimes: the new Apple runtime on iOS, and on Android the runtime behind the new Compose API. If you’re upgrading from 0.4.x or from rive-react-native, see the migration guide.Overview
This guide documents how to get started using the Rive React Native runtime. The source for the new runtime is available in its GitHub repository.- New Runtime (Recommended)
- Legacy Runtime
Requirements
- React Native: 0.78 or later (0.79+ recommended for improved Android error messages)
- Expo SDK: 53 or later (for Expo users)
- iOS: 15.1 or later
- Android: SDK 24 (Android 7.0) or later
- Xcode: 16.4 or later
- JDK: 17 or later
- Nitro Modules: 0.35.10 or later (0.36.2 or later on React Native 0.87+)
Quick Start
Follow these quick start steps to get familiar with the Rive React Native runtime.Rive File
Remix/download the Rive file used in this quick start guide
Complete example
View the complete quick start example
1
Install the dependency
react-native-nitro-modules is required as this library relies on Nitro Modules.2
Setup
Import the necessary components and define styles for the following steps.
Imports
Styles
3
Rive File and Component
The Further reading:
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.Loading a file
Props
Available view props for
RiveViewLoading Rive Files
How to load Rive files in your app
Caching Rive Files
Cache Rive files for better performance
4
Layout
Configure how the graphic fits within its container.For this example, we’ll set Further reading:
fit to Layout, which automatically resizes the artboard to match the view size. This is ideal for responsive Rive graphics built with Layouts.Layout
Runtime layout
Control how Rive graphics fit and align within their containers
5
View Reference
Use the Further reading:
useRive() hook to access the Rive view reference for programmatic control.useRive hook
View methods
See all the available view reference methods.
Hybrid Views
Read more on Nitro Hybrid Views.
6
Data binding
Create the view model instance manually using the Use the view model property hooks to update and listen to property changes.Further reading:
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.Manually create view model instance
Property hooks
Data binding
See the runtime data binding documentation for more information.
See our example app for more usage examples.
Key Components
RiveView
The component to render Rive content:useRiveFile
Hook for loading Rive files from a URL or local source:useRive
Hook to access the Rive view reference for programmatic control:useViewModelInstance
Hook to create a view model instance from a RiveFile, ViewModel, or RiveViewRef.Pass async: true to create the instance asynchronously. The hook returns { instance, isLoading, error } and the instance is not available on the first render, so gate rendering on it. Without async: true, the instance is created through deprecated synchronous APIs that block the JS thread.async: true is available in @rive-app/react-native@0.4.18 and later. The synchronous creation path is deprecated and will be removed in a future release.dataBind prop in RiveView.RiveViewRef — the hook waits for the view’s auto-bound instance to become available:Frame rate
By default,RiveView renders at the display’s refresh rate. Use the frameRate prop to cap it, for example to reduce the CPU and battery cost of a looping animation that doesn’t need 120 Hz:CAFrameRateRange on iOS. Android doesn’t support ranges, so it caps at preferred, or maximum if preferred isn’t set. Remove the prop to return to the display’s refresh rate.Capping limits how many frames are drawn, not animation speed: playback still advances by the real time elapsed between frames.frameRate requires 0.5.0 or later.Semantics
Rive views can expose semantics defined in the editor to VoiceOver on iOS. See Semantics for the available modes.Troubleshooting
Android build fails on Windows (CMake long-path error)
On Windows, the Android build can fail withninja: error: mkdir(CMakeFiles/rive.dir/...): No such file or directory because paths exceed the Windows MAX_PATH (260-character) limit. This is a known issue across React Native libraries that use CMake.To fix this, set the CMAKE_VERSION environment variable to a newer CMake version (e.g. 3.31.6) before building: