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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 { connect } from 'react-redux';
  7. import { getConferenceName } from '../../../base/conference';
  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. <View
  37. pointerEvents = 'box-none'
  38. style = { styles.navBarContainer }>
  39. <LinearGradient
  40. colors = { NAVBAR_GRADIENT_COLORS }
  41. pointerEvents = 'none'
  42. style = { styles.gradient }>
  43. <SafeAreaView>
  44. <View style = { styles.gradientStretch } />
  45. </SafeAreaView>
  46. </LinearGradient>
  47. <SafeAreaView
  48. pointerEvents = 'box-none'
  49. style = { styles.navBarSafeView }>
  50. <View
  51. pointerEvents = 'box-none'
  52. style = { styles.navBarWrapper }>
  53. <PictureInPictureButton
  54. styles = { styles.navBarButton } />
  55. <View
  56. pointerEvents = 'box-none'
  57. style = { styles.roomNameWrapper }>
  58. <Text
  59. numberOfLines = { 1 }
  60. style = { styles.roomName }>
  61. { this.props._meetingName }
  62. </Text>
  63. </View>
  64. </View>
  65. </SafeAreaView>
  66. </View>
  67. );
  68. }
  69. }
  70. /**
  71. * Maps part of the Redux store to the props of this component.
  72. *
  73. * @param {Object} state - The Redux state.
  74. * @returns {{
  75. * _meetingName: string,
  76. * _visible: boolean
  77. * }}
  78. */
  79. function _mapStateToProps(state) {
  80. return {
  81. _meetingName: _.startCase(getConferenceName(state)),
  82. _visible: isToolboxVisible(state)
  83. };
  84. }
  85. // $FlowExpectedError
  86. export default connect(_mapStateToProps)(NavigationBar);