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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // @flow
  2. import _ from 'lodash';
  3. import React, { Component } from 'react';
  4. import { SafeAreaView, Text, View } from 'react-native';
  5. import LinearGradient from 'react-native-linear-gradient';
  6. import { getConferenceName } from '../../../base/conference';
  7. import { connect } from '../../../base/redux';
  8. import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
  9. import { isToolboxVisible } from '../../../toolbox';
  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.gradientStretch } />
  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. </View>
  60. </View>
  61. ];
  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 {{
  69. * _meetingName: string,
  70. * _visible: boolean
  71. * }}
  72. */
  73. function _mapStateToProps(state) {
  74. return {
  75. _meetingName: _.startCase(getConferenceName(state)),
  76. _visible: isToolboxVisible(state)
  77. };
  78. }
  79. export default connect(_mapStateToProps)(NavigationBar);