instea / react-native-color-picker

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

Recompute page-space origin coordinates every gesture #8

Open nikki93 opened 6 years ago

nikki93 commented 6 years ago

onLayout is only called when the position is changed within the parent container, but if the parent container itself moves, it's not called. This makes this._page{X,Y} be out of date. In my case, I have a draggable 'window' as the parent of the color picker and moving it around isn't updating this_page{X,Y}. This change makes it so this_page{X,Y} is computed whenever a new color picking gesture begins so that it's always up to date (unless the color picker moves while gesturing but we can take care of that later...).

madox2 commented 6 years ago

Hi, thanks for contribution! It looks good, I have tested it and it is working on Android. It would be nice to have such functionality also in holo picker.