adds mouseenter and mouseleave#556
Open
jaredshaunsmith wants to merge 1 commit intodominictobias:masterfrom
Open
adds mouseenter and mouseleave#556jaredshaunsmith wants to merge 1 commit intodominictobias:masterfrom
jaredshaunsmith wants to merge 1 commit intodominictobias:masterfrom
Conversation
Owner
|
Rather than add these props (and the list of possible attributes it can take are lengthy), how about using import { useState } from 'react'
/*
.crop-addon {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
*/
import './CropAddon.css'
export function CropAddon() {
const [overState, setOverState] = useState(false)
return (
<div
className="crop-addon"
onPointerEnter={() => setOverState(true)}
onPointerLeave={() => setOverState(false)}
>
<h1>{overState ? 'Pointer Over' : 'Pointer Left'}</h1>
</div>
)
}Demo: https://codesandbox.io/s/react-image-crop-demo-with-react-hooks-renderselectionaddon-xtqs6k |
Author
|
Seems a bit like a hammer for a screwdriver's job imho. Given that react / html handles mouse events like this natively we'd rather not implement this this way. Totally hear your concern on bloating the props list with adding too many but I feel these are table stakes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We found a usecase at VSCO to need to know when a mouseEnter and mouseLeave event fires in over the crop selection box. This PR addresses that by adding them to the spec.
Would love to see this get merged and will actively respond and update if there's any feedback.
Thanks!