rive-app / rive-app/rive-react-native

Expo: Automatically add assets to platforms

Open
#185 34 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
783
Forks
81
Avg merge
3d 6h
Merged PRs (30d)
3

Description

Description

I'm using rive-react-native in the expo dev build and it's working perfectly for IOS but I have a blank page on Android

Device & Versions (please complete the following information)
  • Device: Android
  • react-native: 0.71.8
  • NPM Version: 9.5.1
  • rive-react-native: ^4.1.0
Additional context

The rive file output after using useAssets is

LOG {"url": "file:///data/user/0/com.aumio.app.dev/cache/ExponentAsset-178c3de6e80c005b7cdc90b52c58f947.riv"}

This is the source code:

const RIVE_ANIMATION: riveAnimation[] = [
  {
    name: 'downloadAnimation',
    url: require('src/assets/animations/downloadAnimation.riv'),
  },
];

export const useRiveAnimation = () => {
  const animations = RIVE_ANIMATION.map((animation) => animation.url);
  const [assets, error] = useAssets(animations);
  if (error) return;
  return assets?.[0]?.localUri;
};

  const url = useRiveAnimation();

      {url && (
        <Rive
          ref={riveRef}
          url={url}
          autoplay={false}
          stateMachineName="downloadAnimation"
          onStateChanged={(stateMachineName, stateName) => {
            console.log(
              'onStateChanged: ',
              'stateMachineName: ',
              stateMachineName,
              'stateName: ',
              stateName,
            );
          }}
        />
      )}

app.config.js

plugins: [
...
[
      'expo-build-properties',
      {
        android: {
          minSdkVersion: 21,
          compileSdkVersion: 33,
          targetSdkVersion: 33,
          buildToolsVersion: '33.0.1',
          kotlinVersion: '1.8.10',
        },
        ios: {
          deploymentTarget: '14.0',
          useFrameworks: 'static',
        },
      },
    ],
    ...
    ]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, tests, or implementation entry points. Start by reproducing the blank Android page in an Expo dev build with the supplied useAssets example, then trace how the .riv asset is packaged and loaded on Android; done means the asset is automatically available and the Rive animation renders on both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
build-system, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.