diff --git a/components/provider.tsx b/components/provider.tsx index d1940019..cd66e565 100644 --- a/components/provider.tsx +++ b/components/provider.tsx @@ -6,8 +6,8 @@ import { CarPlayInterface, NowPlayingTemplate, TabBarTemplate } from "react-nati // 'react-native-carplay' has also been disabled for android builds in react-native.config.js const CarPlay = Platform.OS === 'ios' ? require('react-native-carplay').CarPlay as CarPlayInterface : null; -const CarPlayNavigation : TabBarTemplate = CarPlay ? require('./CarPlay/Navigation').CarPlayNavigation : null; -const CarPlayNowPlaying : NowPlayingTemplate = CarPlay ? require('./CarPlay/NowPlaying') : null; +const CarPlayNavigation = !!CarPlay ? require('./CarPlay/Navigation').CarPlayNavigation : null; +const CarPlayNowPlaying = !!CarPlay ? require('./CarPlay/NowPlaying').CarPlayNowPlaying : null interface JellifyContext { loggedIn: boolean; @@ -34,6 +34,10 @@ const JellifyContextInitializer = () => { setCarPlayConnected(true); if (loggedIn && CarPlay) { + + console.debug(CarPlayNavigation); + console.debug(CarPlayNowPlaying); + CarPlay.setRootTemplate(CarPlayNavigation, true); CarPlay.pushTemplate(CarPlayNowPlaying, true); CarPlay.enableNowPlaying(true); // https://github.com/birkir/react-native-carplay/issues/185