2018-01-08 11:00:31 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { TouchableOpacity } from 'react-native';
|
|
|
|
|
|
|
|
import { Icon } from '../../base/font-icons';
|
|
|
|
|
2018-01-18 21:28:25 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
2018-01-08 11:00:31 +00:00
|
|
|
/**
|
2018-01-18 21:28:25 +00:00
|
|
|
* The type of the React {@code Component} props of {@link BackButton}
|
|
|
|
*/
|
2018-01-08 11:00:31 +00:00
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
2018-01-18 21:28:25 +00:00
|
|
|
* The action to be performed when the button is pressed.
|
|
|
|
*/
|
2018-01-08 11:00:31 +00:00
|
|
|
onPress: Function,
|
|
|
|
|
|
|
|
/**
|
2018-01-18 21:28:25 +00:00
|
|
|
* An external style object passed to the component.
|
|
|
|
*/
|
2018-01-08 11:00:31 +00:00
|
|
|
style: Object
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2018-01-26 10:17:44 +00:00
|
|
|
* A component rendering a back button.
|
2018-01-08 11:00:31 +00:00
|
|
|
*/
|
|
|
|
export default class BackButton extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}, renders the button.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
|
|
|
accessibilityLabel = { 'Back' }
|
|
|
|
onPress = { this.props.onPress }>
|
|
|
|
<Icon
|
2018-01-26 10:17:44 +00:00
|
|
|
name = { 'arrow_back' }
|
2018-01-08 11:00:31 +00:00
|
|
|
style = { [
|
|
|
|
styles.backIcon,
|
|
|
|
this.props.style
|
|
|
|
] } />
|
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|