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.8KB

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