-
Notifications
You must be signed in to change notification settings - Fork 111
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
CarPlay standalone mode won't show anything when react navigation screens are present #154
Comments
Is there any way to detect in React Native that Carplay is working without opening the app? This way maybe I could make a workaround: this way, all three cases would work I think. |
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: #158 |
Thank you for your efforts! Do you know any way to debug errors on Carplay? |
Well... after some testing I'm starting to suspect that is something related to api calls using axios. Will try to debug and to use another library (or maybe it's not possible to perform api calls when using carplay in standalone mode) |
@mursang The only way of debugging the stand-alone CarPlay app that I found was to add native logging as described here to my code and then checking the logs in the console (/System/Applications/Utilities/Console.app) of the physical device by filtering by process to only my app while the CarPlay-app is running in stand-alone mode. |
@DanielKuhn thank you for pointing me in the right direction and for sharing your code.
You saved my life!! |
@mursang great to hear that you got it fixed. Which versions of react native, react-navigation and react-native-screens are you using? I'm on
|
@DanielKuhn After some debugging I found an error in the logs file:
So I searched for that error and found it was related to orientation calculation in react-native-screens. I don't know exactly what fails, but disabling screens worked for me.
Seems like I am using an old version of the stack package. Maybe the latest version fixes the problem. |
FYI I just opened software-mansion/react-native-screens#2035 to address this issue. I also created a patch in the meantime. |
@uzegonemad Good to see you found the root cause and an actual fix for the problem. My CarPlay-app does not render anything or navigate in the phone app, that's probably why this isn't a problem in my case. My scene-finding code looks like this: let activeWindowScene = UIApplication.shared.connectedScenes.filter { scene in
return scene.activationState == .foregroundActive && scene is UIWindowScene
}.first The latest bug I found when using scenes is that in iOS, when you connect an external display, the app crashes. |
Hi, everyone! React Native Screens maintainer here. |
Describe the bug
CarPlay works in standalone mode (without phone app opened), but it won't work because of something related to react native navigators
CarPlay (please complete the following information):
Additional context
I made some changes on my Swift code, in order to CarPlay work in standalone mode by forcing bridge to be present without the need of the app as stated in this comment:
#109 (comment)
Everything seems working fine with the app opened, but if I try to use CarPlay without app, it crashes without an error.
Just noticed it is related to my React Navigation code, but can't find where and how to fix.
In my App.js (starting point of my app) I return this:
ApplicationNavigator:
So, just noticed that if I comment all Stack.Screens in the AppNavigator, CarPlay will work without any kind of problem, without the need of the app to be opened. (Obviously I can't open the app with these lines commented, as I see a blank scene).
I also tried to comment Screen by Screen, but seems something more related to Screens itself than with a specific one (or something that every screen loads, such as libraries?).
Did anyone have this problem and solved it?
Do you know how to debug this kind of crashes with CarPlay that don't drop any log?
Thank you very much!
The text was updated successfully, but these errors were encountered: