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.

NavigationBar.js 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { SafeAreaView, Text, View } from 'react-native';
  4. import LinearGradient from 'react-native-linear-gradient';
  5. import { getConferenceName } from '../../../base/conference';
  6. import { getFeatureFlag, CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED } from '../../../base/flags';
  7. import { connect } from '../../../base/redux';
  8. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  9. import { isToolboxVisible } from '../../../toolbox/functions.native';
  10. import ConferenceTimer from '../ConferenceTimer';
  11. import styles, { NAVBAR_GRADIENT_COLORS } 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. class NavigationBar extends Component<Props> {
  35. /**
  36. * Implements {@Component#render}.
  37. *
  38. * @inheritdoc
  39. */
  40. render() {
  41. if (!this.props._visible) {
  42. return null;
  43. }
  44. return [
  45. <LinearGradient
  46. colors = { NAVBAR_GRADIENT_COLORS }
  47. key = { 1 }
  48. pointerEvents = 'none'
  49. style = { styles.gradient }>
  50. <SafeAreaView>
  51. <View style = { styles.gradientStretchTop } />
  52. </SafeAreaView>
  53. </LinearGradient>,
  54. <View
  55. key = { 2 }
  56. pointerEvents = 'box-none'
  57. style = { styles.navBarWrapper }>
  58. <PictureInPictureButton
  59. styles = { styles.navBarButton } />
  60. <View
  61. pointerEvents = 'box-none'
  62. style = { styles.roomNameWrapper }>
  63. {
  64. this.props._meetingNameEnabled
  65. && <Text
  66. numberOfLines = { 1 }
  67. style = { styles.roomName }>
  68. { this.props._meetingName }
  69. </Text>
  70. }
  71. {
  72. this.props._conferenceTimerEnabled && <ConferenceTimer />
  73. }
  74. </View>
  75. </View>
  76. ];
  77. }
  78. }
  79. /**
  80. * Maps part of the Redux store to the props of this component.
  81. *
  82. * @param {Object} state - The Redux state.
  83. * @returns {Props}
  84. */
  85. function _mapStateToProps(state) {
  86. return {
  87. _conferenceTimerEnabled: getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true),
  88. _meetingName: getConferenceName(state),
  89. _meetingNameEnabled: getFeatureFlag(state, MEETING_NAME_ENABLED, true),
  90. _visible: isToolboxVisible(state)
  91. };
  92. }
  93. export default connect(_mapStateToProps)(NavigationBar);