Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a down chevron icon for scenes with a vertical direction #1900

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
import Actions from './Actions';
import _drawerImage from './menu_burger.png';
import _backButtonImage from './back_chevron.png';
import _downButtonImage from './down_chevron.png';

const styles = StyleSheet.create({
title: {
Expand Down Expand Up @@ -163,6 +164,11 @@ const styles = StyleSheet.create({
width: 13,
height: 21,
},
downButtonImage: {
width: 21,
height: 13,
marginTop: 4,
},
defaultImageStyle: {
height: 24,
resizeMode: 'contain',
Expand Down Expand Up @@ -200,6 +206,7 @@ const contextTypes = {
const defaultProps = {
drawerImage: _drawerImage,
backButtonImage: _backButtonImage,
downButtonImage: _downButtonImage,
titleOpacity: 1,
};

Expand Down Expand Up @@ -247,8 +254,12 @@ class NavBar extends React.Component {
/>
);
}

const backImage = (this.props.direction === 'vertical')
? this.props.downButtonImage
: this.props.backButtonImage;
const buttonImage = childState.backButtonImage ||
state.backButtonImage || this.props.backButtonImage;
state.backButtonImage || backImage;
let onPress = childState.onBack || childState.component.onBack;
if (onPress) {
onPress = onPress.bind(null, state);
Expand All @@ -262,6 +273,10 @@ class NavBar extends React.Component {
</Text>)
: null;

const backButtonImageStyle = this.props.direction === 'vertical'
? styles.downButtonImage
: styles.backButtonImage;

return (
<TouchableOpacity
testID="backNavButton"
Expand All @@ -272,7 +287,7 @@ class NavBar extends React.Component {
<Image
source={buttonImage}
style={[
styles.backButtonImage,
backButtonImageStyle,
this.props.leftButtonIconStyle,
state.barButtonIconStyle,
state.leftButtonIconStyle,
Expand Down
Binary file added src/down_chevron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.