Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

NavigationBar.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // @flow
  2. import React from 'react';
  3. import { Text, View } from 'react-native';
  4. import { getConferenceName } from '../../../base/conference';
  5. import { getFeatureFlag, CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED } from '../../../base/flags';
  6. import { connect } from '../../../base/redux';
  7. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  8. import { isToolboxVisible } from '../../../toolbox/functions.native';
  9. import ConferenceTimer from '../ConferenceTimer';
  10. import styles from './styles';
  11. type Props = {
  12. /**
  13. * Whether displaying the current conference timer is enabled or not.
  14. */
  15. _conferenceTimerEnabled: boolean,
  16. /**
  17. * Name of the meeting we're currently in.
  18. */
  19. _meetingName: string,
  20. /**
  21. * Whether displaying the current meeting name is enabled or not.
  22. */
  23. _meetingNameEnabled: boolean,
  24. /**
  25. * True if the navigation bar should be visible.
  26. */
  27. _visible: boolean
  28. };
  29. /**
  30. * Implements a navigation bar component that is rendered on top of the
  31. * conference screen.
  32. *
  33. * @param {Props} props - The React props passed to this component.
  34. * @returns {React.Node}
  35. */
  36. const NavigationBar = (props: Props) => {
  37. if (!props._visible) {
  38. return null;
  39. }
  40. return (
  41. <View
  42. pointerEvents = 'box-none'
  43. style = { styles.navBarWrapper }>
  44. <PictureInPictureButton
  45. styles = { styles.navBarButton } />
  46. <View
  47. pointerEvents = 'box-none'
  48. style = { styles.roomNameWrapper }>
  49. {
  50. props._meetingNameEnabled
  51. && <Text
  52. numberOfLines = { 1 }
  53. style = { styles.roomName }>
  54. { props._meetingName }
  55. </Text>
  56. }
  57. {
  58. props._conferenceTimerEnabled && <ConferenceTimer />
  59. }
  60. </View>
  61. </View>
  62. );
  63. };
  64. /**
  65. * Maps part of the Redux store to the props of this component.
  66. *
  67. * @param {Object} state - The Redux state.
  68. * @returns {Props}
  69. */
  70. function _mapStateToProps(state) {
  71. const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
  72. return {
  73. _conferenceTimerEnabled:
  74. getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer,
  75. _meetingName: getConferenceName(state),
  76. _meetingNameEnabled:
  77. getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
  78. _visible: isToolboxVisible(state)
  79. };
  80. }
  81. export default connect(_mapStateToProps)(NavigationBar);