Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

When hovering, remove :hover from the previous hovered component #368

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions modules/plugins/resolve-interaction-styles-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ var _isInteractiveStyleField = function (styleFieldName) {
styleFieldName === ':focus';
};

var lastHover;

var resolveInteractionStyles = function (config: PluginConfig): PluginResult {
var {
ExecutionEnvironment,
Expand All @@ -32,7 +34,11 @@ var resolveInteractionStyles = function (config: PluginConfig): PluginResult {
var existingOnMouseEnter = props.onMouseEnter;
newProps.onMouseEnter = function (e) {
existingOnMouseEnter && existingOnMouseEnter(e);
if (lastHover) {
lastHover.setState(':hover', false);
}
setState(':hover', true);
lastHover = config;
};

var existingOnMouseLeave = props.onMouseLeave;
Expand Down