From e1ae26985937cd66437305ce654ef00ba5b2d282 Mon Sep 17 00:00:00 2001 From: MARY PRATIMA YEDLURI Date: Thu, 22 Sep 2016 16:30:15 -0500 Subject: [PATCH] fix issue #2482 [Appbar] onLeftIconButtonTouchTap event doesn't fire --- .../components/pages/components/AppBar/ExampleIconButton.js | 5 +++++ src/AppBar/AppBar.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js b/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js index 2e39092d57530d..1ae7a90fae4f3d 100644 --- a/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js +++ b/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js @@ -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', @@ -19,6 +23,7 @@ const AppBarExampleIconButton = () => ( title={Title} onTitleTouchTap={handleTouchTap} iconElementLeft={} + onLeftIconButtonTouchTap={handleTouchTapLeftIconButton} iconElementRight={} /> ); diff --git a/src/AppBar/AppBar.js b/src/AppBar/AppBar.js index ba0687d65280b1..ab0e53a1e26df3 100644 --- a/src/AppBar/AppBar.js +++ b/src/AppBar/AppBar.js @@ -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; @@ -230,6 +230,7 @@ class AppBar extends Component { iconElementLeftNode = React.cloneElement(iconElementLeft, { iconStyle: Object.assign({}, iconButtonIconStyle, iconElementLeft.props.iconStyle), + onClick: self.handleTouchTapLeftIconButton.bind(self), }); } @@ -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;