From 9bd6b6a607dbbe32ee5b2200dcaf4f61baa8796d Mon Sep 17 00:00:00 2001 From: John Knox Date: Tue, 7 May 2019 11:23:50 -0700 Subject: [PATCH] Disable onClick for resize area of Interactive components Summary: This was causing resizing to trigger onClick every time, which isn't wanted. Reviewed By: passy Differential Revision: D15219039 fbshipit-source-id: ea5d9221b0ce8fa7a050a8410876cf78bfee2bc6 --- src/ui/components/Interactive.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/components/Interactive.js b/src/ui/components/Interactive.js index 0834b9f43..663f6fd25 100644 --- a/src/ui/components/Interactive.js +++ b/src/ui/components/Interactive.js @@ -323,6 +323,12 @@ export default class Interactive extends React.Component< } }; + onClick = (e: SyntheticMouseEvent<>) => { + if (this.state.couldResize) { + e.stopPropagation(); + } + }; + calculateMove(event: SyntheticMouseEvent<>) { const {movingInitialCursor, movingInitialProps} = this.state; @@ -687,6 +693,7 @@ export default class Interactive extends React.Component< onMouseDown={this.startAction} onMouseMove={this.onLocalMouseMove} onMouseLeave={this.onMouseLeave} // eslint-disable-next-line + onClick={this.onClick} style={style}> {this.props.children}