Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Rendering menu button when drawer is present
  • Loading branch information
Froelund committed Mar 27, 2016
commit 253dc8e0dc81d25ea3f48d11f335ea15178ab053
18 changes: 17 additions & 1 deletion src/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
Header: NavigationHeader,
} = NavigationExperimental;

export default class extends React.Component {
export default class NavBar extends React.Component {
componentWillMount(){
const state = this.props.navigationState;
this._renderRightButton = this._renderRightButton.bind(this);
Expand Down Expand Up @@ -78,7 +78,18 @@ export default class extends React.Component {

_renderBackButton() {
if (this.props.navigationState.index === 0) {
if(!!this.context.drawer && typeof this.context.drawer.toggle === 'function'){
return (
<TouchableOpacity style={[styles.backButton, this.props.navigationState.leftButtonStyle]} onPress={() => {
var drawer = this.context.drawer;
drawer.toggle();
}}>
<Image source={require('./menu_burger.png')} style={[styles.backButtonImage, this.props.navigationState.barButtonIconStyle]}/>
</TouchableOpacity>
);
}else{
return null;
}
}
return (
<TouchableOpacity style={[styles.backButton, this.props.navigationState.leftButtonStyle]} onPress={Actions.pop}>
Expand Down Expand Up @@ -153,6 +164,11 @@ export default class extends React.Component {

}


NavBar.contextTypes = {
drawer: React.PropTypes.object
}

const styles = StyleSheet.create({
title: {
textAlign: 'center',
Expand Down
Binary file added src/menu_burger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.