Rive drains battery in the background on Android
I maintainer di solito rispondono entro 1 giorno
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
- Ambito
- mobile, performance
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
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):
- The view's render loop never stops while paused. In
RiveReactNativeView.kt#L172-L178,
a paused view with nothing to redraw just refresheslastFrameTimeNsand posts itself again.
Every other path posts again too (L221).
The loop only stops when the view is disposed.- 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 callspollMessages()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
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rive-app/rive-nitro-react-native
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
rive-app/rive-nitro-react-native#424 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Android] Fit.Layout content stale after resize on the new backend (surface keeps creation size)Forse già presa @mfazekas l’ha presa 5 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
rive-app/rive-nitro-react-native#418 ·
I maintainer di solito rispondono entro 1 giorno
-
[Android] RiveFonts: loadFont({name}) fails for script fonts on OEM fonts.xml; systemFallback() is not script-aware (tofu for Thai/Hebrew/Arabic/CJK)Forse già presa @mfazekas l’ha presa 15 giorni fa. Apertaandroid bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
rive-app/rive-nitro-react-native#369 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement iOS
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
rive-app/rive-nitro-react-native#58 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rive-app/rive-nitro-react-native
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
paperclipai/paperclip#16785 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
code-yeongyu/senpi#3661 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
lingdojo/kana-dojo#32731 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mastra-ai/mastra#27538 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Yeachan-Heo/oh-my-codex#3822 ·
I maintainer di solito rispondono entro 1 giorno