Repository navigation
Conversation
Apps built with the iOS 27 SDK must adopt the UIScene life cycle. Everything here is opt-in: apps without a UIApplicationSceneManifest behave as before. - +[ReactNativeNavigation mainWindow] is the single main-window accessor (replaces every delegate.window read; delegate.window keeps pointing at the same window). - +[ReactNativeNavigation attachMainWindowToScene:] attaches the main window to a UIWindowScene. - Overlay windows (#8345) and bottom-tab preload windows are created in the main window's scene; keyWindow / statusBarFrame reads go through scene-aware helpers (RNNSceneUtils). - New RNNSceneDelegate base class: attaches the window, forwards scene:openURLContexts: and scene:continueUserActivity:, dispatches cold-start links from the connection options. - Deep-link queue moved to RNNDeepLinkDispatcher behind +[ReactNativeNavigation dispatchDeepLinkURL:] (-[RNNAppDelegate dispatchDeepLinkURL:] stays public). It keeps the UIOpenURLContexts / NSUserActivities iOS delivered and replays them through +[RCTLinkingManager scene:...] on RN >= 0.88 in scene apps (RNN_RN_VERSION_88_OR_NEWER + RCTIsSceneDelegateApp()), otherwise through the app-delegate API. App-generated URLs that RN >= 0.88 drops under scenes are logged. - RN 0.88: gate the removed RCTAppSetupPrepareApp / interop bridge proxy, guard removed legacy header imports. - Playground: playgroundScene app target and NavigationSceneTests (scene-hosted unit tests), scene schemes and Detox configs, deployment target 15.1 (Xcode 27), new unit tests for the window helper and the deep-link queue. - CI / version switch: ios_rn_88, ios_rn_85_scene, ios_rn_88_scene lanes; versionMapping entries for 0.79 and 0.88; registry override for changeReactNativeVersion.js. - Docs: ios/ARCHITECTURE.md, "Adopting UIScene (iOS)", deep linking under the UIScene life cycle.
This branch has not been deployed
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.
Why
Apps built with the iOS 27 SDK (Xcode 27) must adopt the UIScene life cycle. Without it, UIKit refuses to launch them:
Application failed to launch: UIScene life cycle is required for apps built with this SDK.RNN assumed the app-delegate window model throughout:
delegate.windowin 9 places;initWithFrame:and no scene, so overlays never appear under scenes (showOverlaycreates a scene-lessUIWindow, so overlays never appear under UIScene lifecycle #8345);This PR adds opt-in UIScene support. It also makes RNN build and run on React Native 0.88, the first RN with built-in SceneDelegate support. RN 0.79+ keeps working, and apps without a scene manifest are unchanged.
What changed (iOS)
Windows
+[ReactNativeNavigation mainWindow]is the single main-window accessor and replaces everydelegate.windowread.delegate.windowstill points at the same window, so libraries that read it (Sentry, etc.) keep working.+[ReactNativeNavigation attachMainWindowToScene:]. It moves the existing main window to the scene, or creates it withinitWithWindowScene:, then callsmakeKeyAndVisible.showOverlaycreates a scene-lessUIWindow, so overlays never appear under UIScene lifecycle #8345) and bottom-tab preload windows are created in the main window's scene when the app uses the scene life cycle (RNNSceneUtils). App-delegate apps still getinitWithFrame:.UIApplication.keyWindowandstatusBarFramereads go through scene-aware helpers. They are unchanged for app-delegate apps.RNNSplashScreenViewController showOnWindow:uses the window it is given.RNNSceneDelegate(new public base class, the counterpart ofRNNAppDelegate)scene:willConnectToSession:options:attaches the main window. It exposeslaunchURLContexts,launchUserActivitiesandlaunchURL, and dispatches the cold-start links throughdispatchLaunchLinksFromConnectionOptions:scene:. That gives cold-start parity with the app-delegate path; subclasses can override it.scene:openURLContexts:andscene:continueUserActivity:(browsing web) forward to RNN's deep-link queue.RNNAppDelegatestill creates the React host indidFinishLaunching.Deep-link queue (R5a)
RNNAppDelegatetoRNNDeepLinkDispatcher, behind+[ReactNativeNavigation dispatchDeepLinkURL:],+dispatchOpenURLContexts:inScene:and+dispatchUserActivity:inScene:.-[RNNAppDelegate dispatchDeepLinkURL:]stays public and forwards to it.NSURL,UIOpenURLContexts,NSUserActivity). It replays each entry through the matching API:RCTIsSceneDelegateApp():+[RCTLinkingManager scene:openURLContexts:](one context per call, because RN only forwards the first) or+scene:continueUserActivity:;+application:openURL:options:.RNN_RN_VERSION_88_OR_NEWER(inRNNReactNativeVersion.h, fromREACT_NATIVE_VERSION_MINORin<cxxreact/ReactNativeVersion.h>, which RN has had since at least 0.79). It sits alongside the existingRNN_RN_VERSION_*macros.RCTOpenURLNotificationitself.RN 0.88 compile fixes
RCTAppSetupPrepareAppandRCTEnableTurboModuleInteropBridgeProxywere removed in 0.88. They are gated off on 0.88; RNN keeps the debug idle-timer behavior and still callsRCTEnableTurboModuleInterop.RCTSafeAreaView.handRCTRootContentView.hare guarded with__has_include.Decision for maintainers: app-generated URLs on RN ≥ 0.88 under scenes
URLs an app builds itself and passes to
dispatchDeepLinkURL:(notification handlers, push SDKs) have noUIOpenURLContext. On RN ≥ 0.88 in a scene app, RN's app-delegate Linking methods returnNOand deliver nothing, and apps can't construct aUIOpenURLContext.Implemented (option b):
[UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]makes iOS deliver the link toscene:openURLContexts:. The playground uses it for notification taps.Question (option a): should RNN own a JS deep-link event, for example
Navigation.events().registerDeepLinkListener, so app-generated URLs reachLinkingHandlerwithout going throughLinking? It would cover non-custom-scheme URLs as well. I didn't build it here; I'd like a maintainer decision first.RN version support
ios_rn_78laneios_rn_85_sceneios_rn_88andios_rn_88_scenelanesThe playground default stays 0.85.2, and Android is untouched; this PR is iOS-only. Version-switch changes in
scripts/versionMapping.js:changeReactNativeVersion.jshonorsYARN_NPM_REGISTRY_SERVER/npm_config_registry.Manual RN 0.79 run:
Playground and tests
playgroundScene: same sources, plusSceneDelegate(anRNNSceneDelegatesubclass) andInfo-Scene.plistwith a scene manifest. It has the same bundle id, so only one of the two apps is installed at a time and the URL scheme is unambiguous. Schemes:playgroundScene/playgroundScene_release.NavigationSceneTests: the fullNavigationTestssuite hosted byplaygroundScene.RNNSceneUtilsTest(window helper with and without a scene, attach) andRNNDeepLinkDispatcherTest(queueing, order, replay API selection).ios.sim.{debug,release}.sceneconfigurations;--sceneflag fortest-e2e/test-unit, andIOS_LIFECYCLE=sceneinci.ios.sh;DETOX_IOS_DEVICE/DETOX_IOS_OS/DETOX_IOS_DERIVED_DATAoverrides.device.openURLcallsapplication:openURL:options:, which UIKit never calls in scene apps. Scene runs therefore open URLs through the notification handler, which re-opens the app's own scheme so iOS delivers a realUIOpenURLContext.xcrun simctl openurltakes the same path but shows an "Open in…?" prompt that Detox can't accept; I verified it by hand.post_installraises pods below it, because Xcode 27 rejects deployment targets below iOS 15.Validation
All of these ran locally; CI has not run yet. Simulator runtimes: iOS 26.3.1 and iOS 27.2. Detox ran with one worker and
--retries 1.playground_release+playgroundScene_releaseplayground_release+playgroundScene_releaseNavigationTests(app-delegate host)testTopBarNoBorderOfffails (nav-bar appearance, untouched here; not checked against master on this runtime)NavigationSceneTests(scene host)RNNSceneUtilsTest,RNNDeepLinkDispatcherTest)simctl openurlunder scenes → "Open" → modalyarn test-jsDeep links: cold-start and warm custom-scheme links and notification taps are covered by e2e under both life cycles. Universal links (
NSUserActivity) are covered by unit tests only, because the playground has no associated domain.Not run locally: a build on the default RN 0.85.2 (the new
ios_rn_85*lanes cover it), the CI-pinned iOS 15.5 unit-test simulator, and Android (untouched).Not covered / follow-ups
startReactNativeWithModuleName:inWindow:connectionOptions:(RN 0.88): RNN still creates the React host in the app delegate, so under scenesLinking.getInitialURL()returns null. RNN'sLinkingHandlerstill gets the link via theurlevent. Revisit once RNN's minimum RN is 0.88.npx rnn-linkdoesn't handle the RN 0.88 template'sSceneDelegateyet. The docs describe the manual change.