Skip to content

fix(ios): clean up Voltra event monitoring on reload#191

Merged
V3RON merged 1 commit into
mainfrom
fix/ios-voltra-invalidating
Jun 9, 2026
Merged

fix(ios): clean up Voltra event monitoring on reload#191
V3RON merged 1 commit into
mainfrom
fix/ios-voltra-invalidating

Conversation

@V3RON

@V3RON V3RON commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What is this?

This PR fixes an iOS native lifecycle issue where Voltra event monitoring can survive a Metro reload and keep stale native event callbacks alive. When ActivityKit delivers a token or state event after reload, those stale callbacks can reach the old React Native event emitter path and crash the example app.

How does it work?

NativeVoltra now conforms to RCTInvalidating and tears down monitoring from invalidate instead of relying on dealloc. Its event handler weakly captures the module instance and ignores events after invalidation. The Voltra event bus also replaces its NotificationCenter observer cleanly, and Live Activity monitoring stops any existing manager before installing a new one.

Why is this useful?

This makes the iOS event pipeline resilient to Metro reloads and prevents old ActivityKit observers from calling into a previous React Native runtime. It also gives Voltra a clearer native-module cleanup path that matches React Native New Architecture lifecycle expectations.

Use RCTInvalidating to tear down iOS event monitoring and prevent stale native event callbacks from surviving Metro reloads.
@V3RON V3RON force-pushed the fix/ios-voltra-invalidating branch from 013c207 to dcb327a Compare June 9, 2026 08:10
@V3RON V3RON merged commit 053113e into main Jun 9, 2026
12 checks passed
@V3RON V3RON deleted the fix/ios-voltra-invalidating branch June 9, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant