Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

HeaderNavigationButton.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // @flow
  2. import React from 'react';
  3. import { Text, TouchableRipple } from 'react-native-paper';
  4. import { Icon } from '../../../base/icons';
  5. import type { StyleType } from '../../../base/styles';
  6. import styles from '../../../conference/components/native/styles';
  7. type Props = {
  8. /**
  9. * Style of the header button .
  10. */
  11. buttonStyle?: StyleType,
  12. /**
  13. * Is the button disabled?
  14. */
  15. disabled?: boolean,
  16. /**
  17. * Label of the button.
  18. */
  19. label?: string,
  20. /**
  21. * Callback to invoke when the {@code HeaderNavigationButton} is clicked/pressed.
  22. */
  23. onPress?: Function,
  24. /**
  25. * The ImageSource to be rendered as image.
  26. */
  27. src?: Object,
  28. /**
  29. * Header has two actions.
  30. */
  31. twoActions?: boolean
  32. }
  33. const HeaderNavigationButton
  34. = ({
  35. buttonStyle,
  36. disabled,
  37. label,
  38. onPress,
  39. src,
  40. twoActions
  41. }: Props) =>
  42. (
  43. <>
  44. {
  45. src ? (
  46. <TouchableRipple
  47. onPress = { onPress }
  48. rippleColor = { 'transparent' }
  49. style = { [
  50. buttonStyle,
  51. styles.headerNavigationButton ] } >
  52. <Icon
  53. size = { 24 }
  54. src = { src }
  55. style = { styles.headerNavigationIcon } />
  56. </TouchableRipple>
  57. ) : (
  58. <TouchableRipple
  59. disabled = { disabled }
  60. onPress = { onPress }
  61. rippleColor = { 'transparent' }>
  62. <Text
  63. style = {
  64. twoActions
  65. ? styles.headerNavigationTextBold
  66. : styles.headerNavigationText
  67. }>
  68. { label }
  69. </Text>
  70. </TouchableRipple>
  71. )}
  72. </>
  73. );
  74. export default HeaderNavigationButton;