Fix(preventScreenshot): fix logic on iOS#39
Merged
marineshaw merged 1 commit intomainfrom Apr 15, 2026
Merged
Conversation
4d74dd2 to
bae9969
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fixed : Opening Control Center during app launch causes the screenshot prevention overlay to get stuck visible on iOS. The overlay remains on screen while the app is fully active, producing a white screen over the app content. Subsequent background/foreground transitions are also affected.
File: RNASAppLifecyleDelegate.swift
Change: Added
private var becomeActiveObserver: NSObjectProtocol?Why: Holds a reference to the NotificationCenter observer for proper cleanup in deinit
────────────────────────────────────────
Change: Added
_ = launchScreen.viewin the lazylaunchScreenWindowinitializerWhy: Forces the storyboard view controller to load its view eagerly, so the overlay renders its content immediately instead of showing a blank white window on first display
────────────────────────────────────────
Change: In
didFinishLaunchingWithOptions: subscribe toUIApplication.didBecomeActiveNotificationvia NotificationCenterWhy: This notification is posted directly by UIKit at the OS level, independently of Expo's delegate chain. It fires reliably when the app becomes active even during launch, where the delegate method is dropped
────────────────────────────────────────
Change: Added deinit to remove the NotificationCenter observer
Why: Prevents a memory leak if the delegate is ever deallocated
────────────────────────────────────────
Change: Replaced
launchScreenWindow?.makeKeyAndVisible()withlaunchScreenWindow?.isHidden = falseinapplicationWillResignActiveWhy:
makeKeyAndVisible()steals key window status from the main app window, which triggers cascadingwillResignActiveevents from internal app activity, causing the overlay to re-appear unexpectedly. The window's .alert + 2 level already guarantees it appears on top without needing key window status────────────────────────────────────────
Change: Added a comment to
applicationDidBecomeActiveWhy: Kept as belt-and-suspenders fallback in case the NotificationCenter observer is not set up (e.g. preventRecentScreenshots is toggled at runtime)