-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble upgrading to 0.71 while using iOS Scenes #37278
Comments
Hi @gavrichards - while adding CarPlay-support to my react native app (with push notifications support) I am now stuck at exactly this point. Did you manage to find a solution yet? |
Hi, I have the same problem. After adding react-native-carplay, I can't get the launchOptions, so I can't find out exactly how the app was opened when using deepLink. I get userActivity in PhoneScene, but I don't know how to make this data reach the react application |
@alex-vasylchenko check out @gavrichards implementation in birkir/react-native-carplay#132 (comment) |
After fiddling around with this topic for quite some time now, always in doubt of what's happening under the hood and seeing ever more questions around starting on CarPlay without having the app running on phone, I took the liberty to create (and document!) an example app which runs independently of the phone app and supports launching on CarPlay directly (without having the phone app running) in this PR: birkir/react-native-carplay#158 |
@DanielKuhn My problem with carplay & scenes is that my RootComponent is rendered twice with scenes and navigation complays about linking setup called twice. Maybe you know how to avoid that? |
@KestasVenslauskas I poured all the knowledge I gained into the stand-alone-example, especially into the README of the stand-alone-example. |
@DanielKuhn Thank you so much! I just needed additional fix for handling deep links but the fix is mentioned here #35191 (comment) |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
1 similar comment
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
New Version
0.71.7
Old Version
0.70.8
Build Target(s)
iOS on iPhone in local development
Output of
react-native info
Issue and Reproduction Steps
I am attempting to upgrade React Native in my application from 0.70.x to 0.71.x.
My app uses iOS Scenes, so that it can support CarPlay.
Therefore I have previously converted AppDelegate to Swift and introduced PhoneScene and CarScene delegates.
My app also has to handle receiving a URL from a push notification, and being launched via Siri Shortcuts with metadata.
For all of this to work, I had to move the setup of RCTBridge and RCTRootView to PhoneScene and CarScene (plus rootViewController and window to PhoneScene).
This is because with Scenes
launchOptions
in AppDelegate is always empty.But traditionally that's where useful properties would be held from how the app was launched via a notification or Siri Shortcut.
With Scenes, that data comes via
connectionOptions
in each Scene delegate. But RCTBridge expects to receivelaunchOptions
, and they differ in format.Therefore I had to write something to convert
launchOptions
intoconnectionOptions
, to pass to the bridge.Therefore the bridge and root view both have to be initiated in the Scene delegate, not AppDelegate.
If those are initiated there, then rootViewController and window have to be too, as they use the bridge/root view.
CarScene also therefore has to do the same as PhoneScene, just without initiating rootViewController and window, as they're not required for CarPlay.
My app also uses react-native-bootsplash, and that has to be initiated after the rootView has been initiated, so therefore that has to happen in PhoneScene.
Here's the problem.
With React Native 0.71, the initiation of RCTBridge, RCTRootView, rootViewController etc is all abstracted away to RCTAppDelegate, so there's no where for us to intervene and do what we’re doing for Scenes, passing launch/connectionOptions and initiating BootSplash.
With everything I've tried so far, I can get the app to build and launch on my device, but I just get a full black screen and can't get any further.
I would appreciate if anyone has any suggestions. I surely can't be the only developer who is using Scenes in their app and wants to use the latest version of React Native.
Thanks!
What follows is how my AppDelegate and PhoneScene look before attempting the upgrade. This all works well.
AppDelegate
PhoneScene
The text was updated successfully, but these errors were encountered: