import React, { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Text, View } from 'react-native'; import { withSafeAreaInsets } from 'react-native-safe-area-context'; import { useDispatch, useSelector } from 'react-redux'; import JitsiScreen from '../../../../base/modal/components/JitsiScreen'; import { LoadingIndicator, TintedView } from '../../../../base/react'; import { isLocalVideoTrackDesktop } from '../../../../base/tracks'; import { setPictureInPictureEnabled } from '../../../../mobile/picture-in-picture/functions'; import { setIsCarmode } from '../../../../video-layout/actions'; import ConferenceTimer from '../../ConferenceTimer'; import { isConnecting } from '../../functions'; import EndMeetingButton from './EndMeetingButton'; import MicrophoneButton from './MicrophoneButton'; import SoundDeviceButton from './SoundDeviceButton'; import TitleBar from './TitleBar'; import styles from './styles'; /** * Implements the carmode tab. * * @returns { JSX.Element} - The carmode tab. */ const CarmodeTab = (): JSX.Element => { const dispatch = useDispatch(); const { t } = useTranslation(); const connecting = useSelector(isConnecting); const isSharing = useSelector(isLocalVideoTrackDesktop); useEffect(() => { dispatch(setIsCarmode(true)); setPictureInPictureEnabled(false); return () => { dispatch(setIsCarmode(false)); if (!isSharing) { setPictureInPictureEnabled(true); } }; }, []); return ( {/* * The activity/loading indicator goes above everything, except * the toolbox/toolbars and the dialogs. */ connecting && } {t('carmode.labels.videoStopped')} ); }; export default withSafeAreaInsets(CarmodeTab);