You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CarMode.tsx 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* eslint-disable lines-around-comment */
  2. import React, { useEffect } from 'react';
  3. import { View } from 'react-native';
  4. import { withSafeAreaInsets } from 'react-native-safe-area-context';
  5. import { useDispatch, useSelector } from 'react-redux';
  6. // @ts-ignore
  7. import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
  8. // @ts-ignore
  9. import { LoadingIndicator, TintedView } from '../../../../base/react';
  10. // @ts-ignore
  11. import { isLocalVideoTrackDesktop } from '../../../../base/tracks';
  12. // @ts-ignore
  13. import { setPictureInPictureEnabled } from '../../../../mobile/picture-in-picture/functions';
  14. // @ts-ignore
  15. import { setIsCarmode } from '../../../../video-layout/actions';
  16. // @ts-ignore
  17. import ConferenceTimer from '../../ConferenceTimer';
  18. // @ts-ignore
  19. import { isConnecting } from '../../functions';
  20. import CarModeFooter from './CarModeFooter';
  21. import MicrophoneButton from './MicrophoneButton';
  22. import TitleBar from './TitleBar';
  23. // @ts-ignore
  24. import styles from './styles';
  25. /**
  26. * Implements the carmode component.
  27. *
  28. * @returns { JSX.Element} - The carmode component.
  29. */
  30. const CarMode = (): JSX.Element => {
  31. const dispatch = useDispatch();
  32. const connecting = useSelector(isConnecting);
  33. const isSharing = useSelector(isLocalVideoTrackDesktop);
  34. useEffect(() => {
  35. dispatch(setIsCarmode(true));
  36. setPictureInPictureEnabled(false);
  37. return () => {
  38. dispatch(setIsCarmode(false));
  39. if (!isSharing) {
  40. setPictureInPictureEnabled(true);
  41. }
  42. };
  43. }, []);
  44. return (
  45. <JitsiScreen
  46. footerComponent = { CarModeFooter }
  47. style = { styles.conference }>
  48. {/*
  49. * The activity/loading indicator goes above everything, except
  50. * the toolbox/toolbars and the dialogs.
  51. */
  52. connecting
  53. && <TintedView>
  54. <LoadingIndicator />
  55. </TintedView>
  56. }
  57. <View
  58. pointerEvents = 'box-none'
  59. style = { styles.titleBarSafeViewColor }>
  60. <View
  61. style = { styles.titleBar }>
  62. {/* @ts-ignore */}
  63. <TitleBar />
  64. </View>
  65. <ConferenceTimer textStyle = { styles.roomTimer } />
  66. </View>
  67. <View
  68. pointerEvents = 'box-none'
  69. style = { styles.microphoneContainer }>
  70. <MicrophoneButton />
  71. </View>
  72. </JitsiScreen>
  73. );
  74. };
  75. export default withSafeAreaInsets(CarMode);