Skip to content

Commit

Permalink
Adds onTitleTouchTap to AppBar
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Nov 11, 2015
1 parent 23fd701 commit 7d9fdf6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const AppBar = React.createClass({
propTypes: {
onLeftIconButtonTouchTap: React.PropTypes.func,
onRightIconButtonTouchTap: React.PropTypes.func,
onTitleTouchTap: React.PropTypes.func,
showMenuIconButton: React.PropTypes.bool,
style: React.PropTypes.object,
iconClassNameLeft: React.PropTypes.string,
Expand Down Expand Up @@ -162,8 +163,8 @@ const AppBar = React.createClass({
// If the title is a string, wrap in an h1 tag.
// If not, just use it as a node.
titleElement = typeof title === 'string' || title instanceof String ?
<h1 style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</h1> :
<div style={this.prepareStyles(styles.mainElement)}>{title}</div>;
<h1 onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</h1> :
<div onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.mainElement)}>{title}</div>;
}

if (showMenuIconButton) {
Expand Down Expand Up @@ -254,6 +255,12 @@ const AppBar = React.createClass({
}
},

_onTitleTouchTap(event) {
if (this.props.onTitleTouchTap) {
this.props.onTitleTouchTap(event);
}
},

});

module.exports = AppBar;

0 comments on commit 7d9fdf6

Please sign in to comment.