This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Sphere/app/components/navigation/BackButton.js

45 lines
909 B
JavaScript
Raw Normal View History

2016-02-06 15:07:29 +00:00
import React from 'react-native';
2016-02-06 15:49:57 +00:00
import GlobalStyles from '../../settings/styles';
2016-02-06 15:07:29 +00:00
var {
StyleSheet,
TouchableHighlight,
View,
Text
} = React;
2016-02-06 15:49:57 +00:00
const styles = StyleSheet.create({
2016-02-06 15:07:29 +00:00
container: {
flex: 1,
justifyContent: 'center',
},
toolbarButton: {
2016-02-06 16:46:41 +00:00
paddingHorizontal: 15,
2016-02-06 15:07:29 +00:00
},
2016-02-06 15:49:57 +00:00
text: {
color: GlobalStyles.get('CIRCLE_NAVBAR_TEXT')
}
2016-02-06 15:07:29 +00:00
});
export default class NavigationButton extends React.Component {
2016-02-06 15:49:57 +00:00
goBack() {
2016-02-06 15:07:29 +00:00
this.props.nav.pop();
}
render() {
if (this.props.nav.getCurrentRoutes().length <= 1) {
return <View />;
}
return (
<View style={styles.container}>
<TouchableHighlight
style={styles.toolbarButton}
2016-02-06 15:49:57 +00:00
underlayColor={GlobalStyles.get('CIRCLE_NAVBAR_BG')}
onPress={this.goBack.bind(this)}>
2016-02-06 16:46:41 +00:00
<Text style={styles.text}>&lt;</Text>
2016-02-06 15:07:29 +00:00
</TouchableHighlight>
</View>
);
}
}