Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions ios/OpenNotes/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ public class AppDelegate: ExpoAppDelegate {
reactNativeFactory = factory
bindReactNativeFactory(factory)

// React Native starts in SceneDelegate. iOS 27 terminates apps built with
// its SDK at launch unless they adopt the UIScene lifecycle.
#if DEBUG
// Debug keeps the original startup order: expo-dev-launcher's app delegate
// subscriber requires a window during didFinishLaunching. SceneDelegate
// attaches this window to the scene once it connects.
window = UIWindow(frame: UIScreen.main.bounds)
factory.startReactNative(withModuleName: "main", in: window, launchOptions: launchOptions)
#endif

// Release starts React Native in SceneDelegate. iOS 27 terminates apps built
// with its SDK at launch unless they adopt the UIScene lifecycle.
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

Expand Down Expand Up @@ -59,6 +67,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let factory = appDelegate.reactNativeFactory else {
return
}
// Debug already started React Native in a window during launch.
if let existing = appDelegate.window {
existing.windowScene = windowScene
existing.makeKeyAndVisible()
self.window = existing
return
}
let window = UIWindow(windowScene: windowScene)
self.window = window
appDelegate.window = window
Expand Down
Loading