jodhman / react-eyedrop

Seamlessly integrate a static typed, fully-tested color-picking React component/hook!
24 stars 11 forks source link

How can I tell when the component exits the picking state? #38

Closed lgharib-flowlabs closed 2 years ago

lgharib-flowlabs commented 2 years ago

The prop onPickStart is called when the picker begins However, I'm looking for a prop like onPickEnd to tell when the user is not selecting a color anymore.

Referring: https://github.com/jodhman/react-eyedrop/blob/master/src/eyeDropper.tsx#L70

Is there any easy way to tell when the user exits the pick state? I'm currently checking for onChange and when the user presses the escape key, but would be nice to have a prop like onPickEnd

jodhman commented 2 years ago

Hi there! I can see the issue you're having.

Funny thing is we even used to have an onPickEnd property. This was awhile back, and I can't seem to recall why we removed it here.

Anyways, just had a look and unless I'm missing something, onPickEnd could really come in handy. Give me a moment, and I'll re-introduce it.

jodhman commented 2 years ago

Alright! We're set. ~Go ahead & give version 5.2.0 a try.~ Let me know if you run into any further issues! :partying_face:

EDIT Ooooops. Silly me. Published absolutely nothing. Give 5.2.1 a try, my bad. :sweat_smile:

lgharib-flowlabs commented 2 years ago

Just tested it out and it works, thanks a lot for the speedy response @jodhman 👏

jodhman commented 2 years ago

My pleasure! :blush: