Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Rive drains battery in the background on Android

オープン
#413 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@mfazekas がすでに取り組んでいます。

2026年10月10日 から。

  • #416 @mfazekas による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, react-native, typescript

調査の方向性

Start with android/src/new/java/com/rive/RiveReactNativeView.kt and android/src/new/java/com/margelo/nitro/rive/HybridRiveFileFactory.kt, the two frame-callback loops identified in the report. Reproduce on Android using the linked Expo app and the provided atrace command; compare callbacks after pressing Home with the reported baseline. Done means the app no longer continuously wakes the main thread in the background when Rive views are paused or unmounted.

索引モデルが issue の本文から書いたものです。

説明

android bug
Submission checklist
  • I have confirmed the issue is present in the latest version of @rive-app/react-native
  • I have searched the documentation and forums and could not find an answer
  • I have searched existing issues and this is not a duplicate
Description

On Android with the new backend, once an app has loaded a Rive file it keeps a Choreographer frame callback posted on every vsync for the rest of the process. Even when every Rive view is paused or unmounted, the main thread wakes 60 times a second. This is not a big deal while the app running normally, but it keeps happening when the app is backgrounded.

Here's what my Claude found, but you probably know better:

Two loops are responsible. Both have been there since the new backend landed in 0.5.0 (#134):

  1. The view's render loop never stops while paused. In RiveReactNativeView.kt#L172-L178,
    a paused view with nothing to redraw just refreshes lastFrameTimeNs and posts itself again.
    Every other path posts again too (L221).
    The loop only stops when the view is disposed.
  2. The CommandQueue is polled on every vsync for the life of the process. Once the shared worker
    exists, HybridRiveFileFactory.startPolling
    posts a frame callback that calls pollMessages() and re-posts itself forever, even when no Rive
    view is mounted.
Previous working version

No response

Reproduction steps / code

https://github.com/Nezz/expo-repro/tree/repro/RivePausedFrames

bun install
npx expo run:android --variant release
scripts/run.sh 3

Then press Home and count frame callbacks for 10 s:

adb shell atrace -t 10 view | grep -c "B|$(adb shell pidof com.adamys.exporepro)|Choreographer#doFrame"

That gives ~600. The same app before it loads a Rive file gives 0.

Upload your reproduction files / stack trace

No response

Source .riv / .rev file

No response

Screenshots / video

No response

@rive-app/react-native version

0.5.4

Platform

Android only

React Native version

0.86.3

React Native environment info

Expo setup

Yes — Expo prebuild / EAS Build

Expo SDK version (if applicable)

No response

iOS device & OS version (if applicable)

57.0.27

Android device & OS version (if applicable)

Android Emulator — API Level 36 (Medium Phone, 60 Hz)

Additional context

New Android backend, release build

主要言語
TypeScript
スター
157
フォーク
17
平均マージ
1日 10時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rive-app/rive-nitro-react-native のほかの issue

rive-app/rive-nitro-react-native の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。