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

Adds onTitleTouchTap to AppBar #2125

Merged
merged 3 commits into from
Nov 12, 2015
Merged
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
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/app-bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export default class AppBarPage extends React.Component {
desc: 'Callback function for when the right icon is selected via ' +
'a touch tap.',
},
{
name: 'onTitleTouchTap',
header: 'AppBar.onTitleTouchTap(e)',
desc: 'Callback function for when the title text is selected via ' +
'a touch tap.',
},
],
},
];
Expand Down
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;