Skip to content

Commit 512fb22

Browse files
committed
Adds onTitleTouchTap to AppBar
1 parent 23fd701 commit 512fb22

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docs/src/app/components/pages/components/app-bar.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ export default class AppBarPage extends React.Component {
103103
desc: 'Callback function for when the right icon is selected via ' +
104104
'a touch tap.',
105105
},
106+
{
107+
name: 'onTitleTouchTap',
108+
header: 'AppBar.onTitleTouchTap(e)',
109+
desc: 'Callback function for when the title text is selected via ' +
110+
'a touch tap.',
111+
},
106112
],
107113
},
108114
];

src/app-bar.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const AppBar = React.createClass({
3030
propTypes: {
3131
onLeftIconButtonTouchTap: React.PropTypes.func,
3232
onRightIconButtonTouchTap: React.PropTypes.func,
33+
onTitleTouchTap: React.PropTypes.func,
3334
showMenuIconButton: React.PropTypes.bool,
3435
style: React.PropTypes.object,
3536
iconClassNameLeft: React.PropTypes.string,
@@ -162,8 +163,8 @@ const AppBar = React.createClass({
162163
// If the title is a string, wrap in an h1 tag.
163164
// If not, just use it as a node.
164165
titleElement = typeof title === 'string' || title instanceof String ?
165-
<h1 style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</h1> :
166-
<div style={this.prepareStyles(styles.mainElement)}>{title}</div>;
166+
<h1 onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.title, styles.mainElement)}>{title}</h1> :
167+
<div onTouchTap={this._onTitleTouchTap} style={this.prepareStyles(styles.mainElement)}>{title}</div>;
167168
}
168169

169170
if (showMenuIconButton) {
@@ -254,6 +255,12 @@ const AppBar = React.createClass({
254255
}
255256
},
256257

258+
_onTitleTouchTap(event) {
259+
if (this.props.onTitleTouchTap) {
260+
this.props.onTitleTouchTap(event);
261+
}
262+
},
263+
257264
});
258265

259266
module.exports = AppBar;

0 commit comments

Comments
 (0)