instea / react-native-color-picker

Color picker component for IOS/Android
Apache License 2.0
272 stars 67 forks source link

Handle touchRelease #9

Closed paul-git closed 6 years ago

paul-git commented 6 years ago

Hey there, I'm using the TriangleColorPickerand think, that it is somehow tricky as an unexperienced user to know, that I have to press the colored bar to select a color.

So I'm trying to detect when the user releases the finger from within the triangle and use that event as onColorSelected. I was able to insert that functionality (it seems, you alreade started that in utils.js) . But unfortunately I unable to distinguish between clicking on the circle and picking the color from inside the triangle.

Is there any line where you determine that? I mean at some point you need to know whether to rotate the triangle or not, right? My fork is https://github.com/paul-git/react-native-color-picker

Thanks and Greetings, Paul

sodik82 commented 6 years ago

hi there,

if you don't want user to confirm selection, you can use onColorChange prop instead.

however if you would like to play with "releasing" inside, you can just simple calculate the distance of the release point from the center and so determine if you are on the circle or not.

paul-git commented 6 years ago

Thank you sodik82, I just want to hide the picker after the user chose a color, so I can't close it immediately on onColorChange :(

I just thought I could hook in, where you check if the user clicked inside the triangle (where the dot moves within the triangle) or in the cicrcle (where the triangle rotates in the circle). But I was unable to locate that in your code.

Again, Thanks, Paul

sodik82 commented 6 years ago

I believe it is controlled by _changingHColor - but you have to check more details in code :)

paul-git commented 6 years ago

Thank you. I will dive into it!

baharb commented 3 years ago

Hi @paul-git Could you find any solution for this?

paul-git commented 3 years ago

@baharb This is years old. I'm not working with the color-picker anymore. if I solved it, than it was using _changingHColor. Good luck, Paul