Description
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):
- Device: Simulator and real device
- OS version: iOS 17.0
- RNCarPlay version 2.3.0
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:
---- code to connect Carplay that is correctly working ---
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<ApplicationNavigator />
</PersistGate>
</Provider>
);
ApplicationNavigator:
const ApplicationNavigator = () => {
const { Layout, darkMode, NavigationTheme } = useTheme()
const { colors } = NavigationTheme
return (
<SafeAreaView style={[Layout.fill, { backgroundColor: colors.card }]}>
<NavigationContainer theme={NavigationTheme} ref={navigationRef}>
<StatusBar barStyle={darkMode ? 'light-content' : 'dark-content'} />
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Startup" component={IndexStartupContainer} />
<Stack.Screen name="Login" component={LoginContainer} />
<Stack.Screen
name="Main"
component={MainNavigator}
options={{
animationEnabled: false,
}}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaView>
)
}
export default 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!
Activity