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 2.4KB

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