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

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