You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rive drains battery in the background on Android #413
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 refreshes lastFrameTimeNs and 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 calls pollMessages() and re-posts itself forever, even when no Rive
view is mounted.
Activity
fix(android): stop idle frame callbacks on the new backend
fix(android): stop idle frame callbacks on the new backend