Skip to content

Commit 85aa69a

Browse files
committed
fix: rename "mouseEnter" to "mouseOver"
The "mouseEnter" event in browsers does not bubble, while "mouseOver" does.
1 parent 91d566d commit 85aa69a

8 files changed

Lines changed: 11 additions & 11 deletions

File tree

Libraries/Components/Touchable/TouchableOpacity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ var TouchableOpacity = createReactClass({
259259
onResponderMove={this.touchableHandleResponderMove}
260260
onResponderRelease={this.touchableHandleResponderRelease}
261261
onResponderTerminate={this.touchableHandleResponderTerminate}
262-
onMouseEnter={this.props.onMouseEnter}
262+
onMouseOver={this.props.onMouseOver}
263263
onMouseLeave={this.props.onMouseLeave}
264264
onContextMenuItemClick={this.props.onContextMenuItemClick}
265265
contextMenu={this.props.contextMenu}>

Libraries/Components/Touchable/TouchableWithoutFeedback.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const TouchableWithoutFeedback = createReactClass({
110110
* views.
111111
*/
112112
hitSlop: EdgeInsetsPropType,
113-
onMouseEnter: PropTypes.func,
113+
onMouseOver: PropTypes.func,
114114
onMouseLeave: PropTypes.func,
115115
onContextMenuItemClick: PropTypes.func,
116116
contextMenu: PropTypes.array,
@@ -213,7 +213,7 @@ const TouchableWithoutFeedback = createReactClass({
213213
onResponderMove: this.touchableHandleResponderMove,
214214
onResponderRelease: this.touchableHandleResponderRelease,
215215
onResponderTerminate: this.touchableHandleResponderTerminate,
216-
onMouseEnter: this.props.onMouseEnter,
216+
onMouseOver: this.props.onMouseOver,
217217
onMouseLeave: this.props.onMouseLeave,
218218
onContextMenuItemClick: this.props.onContextMenuItemClick,
219219
contextMenu: this.props.contextMenu,

Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`TouchableHighlight renders correctly 1`] = `
1111
isTVSelectable={true}
1212
nativeID={undefined}
1313
onLayout={undefined}
14-
onMouseEnter={undefined}
14+
onMouseOver={undefined}
1515
onMouseLeave={undefined}
1616
onResponderGrant={[Function]}
1717
onResponderMove={[Function]}

Libraries/Components/View/ReactNativeViewAttributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ReactNativeViewAttributes.UIView = {
3030
renderToHardwareTextureAndroid: true,
3131
shouldRasterizeIOS: true,
3232
onLayout: true,
33-
onMouseEnter: true,
33+
onMouseOver: true,
3434
onMouseLeave: true,
3535
onAccessibilityTap: true,
3636
onMagicTap: true,

Libraries/Components/View/ViewPropTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ module.exports = {
433433
* Desktop specific events
434434
* @platform macos
435435
*/
436-
onMouseEnter: PropTypes.func,
436+
onMouseOver: PropTypes.func,
437437
onMouseLeave: PropTypes.func,
438438
onDragEnter: PropTypes.func,
439439
onDragLeave: PropTypes.func,

RNTester/js/DragnDropExample.macos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DragExample extends React.Component {
4141
this.state.mouseOver ? 'orange' : 'white',
4242
padding: 40, alignItems: 'center'}}
4343
draggedTypes={['NSFilenamesPboardType']}
44-
onMouseEnter={() => this.setState({mouseOver: true})}
44+
onMouseOver={() => this.setState({mouseOver: true})}
4545
onMouseLeave={() => this.setState({mouseOver: false})}
4646
onDragEnter={() => this.setState({dragOver: true})}
4747
onDragLeave={() => this.setState({dragOver: false})}

React/Base/RCTTouchHandler.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ @implementation RCTTouchHandler
4747
CFTimeInterval _mostRecentEnqueueJS;
4848

4949
/*
50-
* Storing tag to dispatch mouseEnter and mouseLeave events
50+
* Storing tag to dispatch mouseOver and mouseLeave events
5151
*/
5252
NSNumber *_currentMouseOverTag;
5353
}
@@ -338,11 +338,11 @@ - (void)mouseMoved:(NSEvent *)event
338338
[_bridge enqueueJSCall:@"RCTEventEmitter.receiveEvent"
339339
args:@[_currentMouseOverTag, @"topMouseLeave"]];
340340
[_bridge enqueueJSCall:@"RCTEventEmitter.receiveEvent"
341-
args:@[reactTag, @"topMouseEnter"]];
341+
args:@[reactTag, @"topMouseOver"]];
342342
_currentMouseOverTag = reactTag;
343343
} else if (_currentMouseOverTag == 0) {
344344
[_bridge enqueueJSCall:@"RCTEventEmitter.receiveEvent"
345-
args:@[reactTag, @"topMouseEnter"]];
345+
args:@[reactTag, @"topMouseOver"]];
346346
_currentMouseOverTag = reactTag;
347347
}
348348
}

React/Views/RCTViewManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ - (RCTShadowView *)shadowView
7373
@"touchEnd",
7474

7575
// Mouse events
76-
@"mouseEnter",
76+
@"mouseOver",
7777
@"mouseLeave",
7878
];
7979
}

0 commit comments

Comments
 (0)