Skip to content

Commit

Permalink
fix issue mui#2482 [Appbar] onLeftIconButtonTouchTap event doesn't fire
Browse files Browse the repository at this point in the history
  • Loading branch information
MARY PRATIMA YEDLURI authored and MARY PRATIMA YEDLURI committed Sep 22, 2016
1 parent 367d000 commit e1ae269
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function handleTouchTap() {
alert('onTouchTap triggered on the title component');
}

function handleTouchTapLeftIconButton() {
alert('onClick triggered on the left icon component');
}

const styles = {
title: {
cursor: 'pointer',
Expand All @@ -19,6 +23,7 @@ const AppBarExampleIconButton = () => (
title={<span style={styles.title}>Title</span>}
onTitleTouchTap={handleTouchTap}
iconElementLeft={<IconButton><NavigationClose /></IconButton>}
onLeftIconButtonTouchTap={handleTouchTapLeftIconButton}
iconElementRight={<FlatButton label="Save" />}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion src/AppBar/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class AppBar extends Component {

const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context);

const self = this;
let menuElementLeft;
let menuElementRight;

Expand Down Expand Up @@ -230,6 +230,7 @@ class AppBar extends Component {

iconElementLeftNode = React.cloneElement(iconElementLeft, {
iconStyle: Object.assign({}, iconButtonIconStyle, iconElementLeft.props.iconStyle),
onClick: self.handleTouchTapLeftIconButton.bind(self),
});
}

Expand Down Expand Up @@ -279,6 +280,7 @@ class AppBar extends Component {
case 'FlatButton':
iconElementRightNode = React.cloneElement(iconElementRight, {
style: Object.assign({}, styles.flatButton, iconElementRight.props.style),
onClick: self.handleTouchTapRightIconButton.bind(self),
});
break;

Expand Down

0 comments on commit e1ae269

Please sign in to comment.