Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

NavigationBar.js 2.7KB

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