instea / react-native-color-picker

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

evt.nativeEvent.page{X, Y} to evt.nativeEvent.location{X, Y} #1

Closed polaris340 closed 7 years ago

polaris340 commented 7 years ago

The picker doesn't works properly when it is in a Animatid.View with translate value. I think it's because onLayout doesn't call again when translate{X, Y} changed, so picker._pageX and picker._pageY are not changed but nativeEvent.pageX and nativeEvent.pageY are based on the root element. I changed those to nativeEvent.location{X, Y} and it works well.

From document:

locationX - The X position of the touch, relative to the element locationY - The Y position of the touch, relative to the element pageX - The X position of the touch, relative to the root element pageY - The Y position of the touch, relative to the root element

polaris340 commented 7 years ago

I found some errors on android. I will fix it and create pull request again.

gunn commented 6 years ago

👍 for fixing this. Interaction is completely broken currently when e.g. in a scrolled down view.