From fbc9f5d555f0b528645b7bafd8f59c188f0c2b7a Mon Sep 17 00:00:00 2001 From: MARY PRATIMA YEDLURI Date: Thu, 22 Sep 2016 15:01:08 -0500 Subject: [PATCH] fix issue #2482 [Appbar] onLeftIconButtonTouchTap event doesn't fire. --- .../components/pages/components/AppBar/ExampleIconButton.js | 5 +++++ src/AppBar/AppBar.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js b/docs/src/app/components/pages/components/AppBar/ExampleIconButton.js index 2e39092d57530d..c5c6b765c53725 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 5ccd9b31af534e..0853caeaeea457 100644 --- a/src/AppBar/AppBar.js +++ b/src/AppBar/AppBar.js @@ -216,6 +216,7 @@ class AppBar extends Component { const iconLeftStyle = Object.assign({}, styles.iconButtonStyle, iconStyleLeft); if (showMenuIconButton) { + let self = this; let iconElementLeftNode = iconElementLeft; if (iconElementLeft) { @@ -229,6 +230,7 @@ class AppBar extends Component { iconElementLeftNode = React.cloneElement(iconElementLeft, { iconStyle: Object.assign({}, iconButtonIconStyle, iconElementLeft.props.iconStyle), + onClick: self.handleTouchTapLeftIconButton.bind(self), }); }