Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

CarMode.tsx 2.7KB

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