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.

BackButton.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { TouchableOpacity } from 'react-native';
  4. import { Icon } from '../../../base/font-icons';
  5. import { Header } from '../../../base/react';
  6. /**
  7. * The type of the React {@code Component} props of {@link BackButton}
  8. */
  9. type Props = {
  10. /**
  11. * The action to be performed when the button is pressed.
  12. */
  13. onPress: Function,
  14. /**
  15. * An external style object passed to the component.
  16. */
  17. style?: Object
  18. };
  19. /**
  20. * A component rendering a back button.
  21. */
  22. export default class BackButton extends Component<Props> {
  23. /**
  24. * Implements React's {@link Component#render()}, renders the button.
  25. *
  26. * @inheritdoc
  27. * @returns {ReactElement}
  28. */
  29. render() {
  30. return (
  31. <TouchableOpacity
  32. accessibilityLabel = { 'Back' }
  33. onPress = { this.props.onPress }>
  34. <Icon
  35. name = { 'arrow_back' }
  36. style = { [
  37. Header.buttonStyle,
  38. this.props.style
  39. ] } />
  40. </TouchableOpacity>
  41. );
  42. }
  43. }