You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@rive-app/react-native

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rive-app/react-native

Rive React Native

latest
Source
npmnpm
Version
0.2.7
Version published
Maintainers
5
Created
Source

@rive-app/react-native

Build NPM Version Downloads React Native iOS Android Rive iOS Runtime Rive Android Runtime

Rive React Native 2.0

Rive hero image

Early Release

⚠️ Early Release: This package is in active development. We recommend testing thoroughly before using in production applications. We're actively gathering feedback to improve the library. Please share your thoughts and report any issues you encounter.

Requirements

  • React Native: 0.78 or later (0.79+ recommended for better 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.33.2 or later

Known Issues

  • Error messages on Android in React Native 0.78-0.79 may not be descriptive, this is a known issue in React Native and is fixed in RN 0.80

Installation

npm install @rive-app/react-native react-native-nitro-modules

react-native-nitro-modules is required as this library relies on Nitro Modules.

Usage

import { Fit, RiveView, useRiveFile } from '@rive-app/react-native';

function App() {
  const { riveFile } = useRiveFile({
    url: 'https://cdn.rive.app/animations/vehicles.riv',
  });

  if (!riveFile) {
    return null;
  }

  return (
    <RiveView
      autoPlay={true}
      fit={Fit.Contain}
      file={riveFile}
      onError={(error) => console.error('Rive error:', error.message)}
      style={{ width: '100%', height: 400 }}
    />
  );
}

Native SDK Version Customization

⚠️ Advanced Usage: Customizing native SDK versions is intended for advanced users only. Using non-default versions may cause build-time errors, or compatibility issues. Always review and update custom versions when upgrading @rive-app/react-native.

Custom Native SDK Version instructions - only use if you need it!

By default, @rive-app/react-native uses specific versions of the Rive native SDKs defined in the library's package.json (runtimeVersions.ios and runtimeVersions.android). You can customize these versions if needed.

Vanilla React Native

Add the appropriate properties to your configuration files:

iOS - Add to ios/Podfile.properties.json:

{
  "RiveRuntimeIOSVersion": "6.13.0"
}

Android - Add to android/gradle.properties:

Rive_RiveRuntimeAndroidVersion=10.6.0

Expo

Use an inline config plugin in your app.config.ts:

import {
  withPodfileProperties,
  withGradleProperties,
} from '@expo/config-plugins';

export default {
  expo: {
    // ... other config
    plugins: [
      (config) => {
        config = withPodfileProperties(config, (config) => {
          config.modResults['RiveRuntimeIOSVersion'] = '6.13.0';
          return config;
        });

        config = withGradleProperties(config, (config) => {
          config.modResults.push({
            type: 'property',
            key: 'Rive_RiveRuntimeAndroidVersion',
            value: '10.6.0',
          });
          return config;
        });

        return config;
      },
    ],
  },
};

Error Handling

All Rive operations can be wrapped in try/catch blocks for error handling, for example, loading a file:

try {
  const riveFile = await RiveFileFactory.fromURL(
    'https://cdn.rive.app/animations/vehicles.riv'
  );
  // Use the riveFile...
} catch (error) {
  // Handle any errors that occur during Rive file loading
  console.error('Error loading Rive file:', error);
}

View-Based Errors

The RiveView component provides an onError callback prop to handle errors that occur during view configuration or runtime operations:

<RiveView
  file={riveFile}
  onError={(error) => {
    // error.type contains the error type enum value
    // error.message contains a descriptive error message
    console.error(`Rive Error [${error.type}]: ${error.message}`);
  }}
/>

Error Types

The following error types can occur during view operations:

Error TypeValueDescription
RiveErrorType.Unknown0An unknown error occurred
RiveErrorType.FileNotFound1The specified Rive file could not be found
RiveErrorType.MalformedFile2The Rive file is malformed or corrupted
RiveErrorType.IncorrectArtboardName3The specified artboard name does not exist
RiveErrorType.IncorrectStateMachineName4The specified state machine name does not exist
RiveErrorType.ViewModelInstanceNotFound6The specified view model instance was not found
RiveErrorType.IncorrectStateMachineInputName8The specified state machine input name does not exist

You can use these error types to provide specific error handling:

import { RiveView, RiveErrorType } from '@rive-app/react-native';

<RiveView
  file={riveFile}
  artboardName="MainArtboard"
  onError={(error) => {
    switch (error.type) {
      case RiveErrorType.IncorrectArtboardName:
        console.error('Artboard not found:', error.message);
        // Handle missing artboard (e.g., use default artboard)
        break;
      case RiveErrorType.IncorrectStateMachineName:
        console.error('State machine not found:', error.message);
        // Handle missing state machine
        break;
      case RiveErrorType.MalformedFile:
        console.error('Corrupted file:', error.message);
        // Handle corrupted file (e.g., show error UI)
        break;
      default:
        console.error('Rive error:', error.message);
    }
  }}
  style={{ width: '100%', height: 400 }}
/>;

Note: If no onError handler is provided, errors will be logged to the console by default.

Feature Support

This section provides a comprehensive overview of feature availability in @rive-app/react-native, comparing it with the previous Rive React Native runtime and outlining the development roadmap.

Runtime Feature Comparison

Status Legend: ✅ Supported | ⚠️ Partial | 🚧 In Development | ❌ Not Planned

The following table compares feature availability with the previous Rive React Native runtime.

FeatureStatusDescription
Artboard selectionSpecify artboard to render
State machine selectionSpecify a state machine to play
View autoPlay & play/pauseControl view playback
Fit & AlignmentFit modes supported, alignment coming soon
Layout & ResponsivenessBasic responsive layouts supported
Data BindingControl data binding through runtime code
Asset managementLoad assets out of band (referenced)
State machine inputs (Deprecated)Get/Set (nested) state machine inputs (legacy, see data binding)
Text Runs (Deprecated)Update (nested) text runs (legacy, see data binding)
Rive Events (Deprecated)Listen to Rive events
Rive AudioRive audio playback supported
useRive() hookConvenient hook to access the Rive View ref after load
useRiveFile() hookConvenient hook to load a Rive file
RiveView error handlingError handler for failed view operations
source .riv file loadingConveniently load .riv files from JS source
Animation selectionAnimation playback not planned, use state machines
Renderer optionsSingle renderer option available (Rive)

Note: Several features in the table above (state machine inputs, text runs, and events) represent legacy approaches to runtime control. We recommend using data binding instead, as it provides a more maintainable way to control your Rive graphics (both at edit time and runtime).

Roadmap

Status Legend: ✅ Completed | 🚧 Planned |

This section tracks new features and improvements planned for this runtime that were not available in the previous Rive React Native runtime.

FeatureStatus
Reusable .riv File resources (preloading)
Data Binding - Images
Data Binding - Artboards🚧
Data Binding - Lists
Data Binding - Value props🚧
Suspense🚧

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Made with create-react-native-library

Keywords

react-native

FAQs

Package last updated on 06 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts