Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Rive drains battery in the background on Android

Aperta
#413 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@mfazekas ci sta già lavorando.

Dal 10/10/2026.

  • #416 di @mfazekas — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, react-native, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
155
Fork
17
Merge medio
1g 10h
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rive-app/rive-nitro-react-native

Tutte le issue di rive-app/rive-nitro-react-native

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.