SteffeyDev / react-native-popover-view

A well-tested, adaptable, lightweight <Popover> component for react-native
MIT License
614 stars 92 forks source link

Added comment explaining what FIX_SHIFT does #105

Closed tecno40 closed 3 years ago

tecno40 commented 3 years ago

This comment was mostly copied from a comment on another PR https://github.com/SteffeyDev/react-native-popover-view/pull/101 . I believe adding it to the code will make it easier for other developers to understand what FIX_SHIFT is doing in the code.

tecno40 commented 3 years ago

Also I didn't address this in the current PR, but while reading over the code again I noticed FIX_SHIFT is being set to the window height via export var FIX_SHIFT = Dimensions.get('window').height * 2. Could this potentially create an issue when they rotate the phone as the height would change, or does the x 2 end up taking care of that in most cases? I did go and look at a few phones screen sizes and it looks like the width is generally half the height. Sometimes it's a bit less, but it's generally only off by a few pixels in those cases.

SteffeyDev commented 3 years ago

Comment is helpful, thanks! The actual value of FIX_SHIFT doesn't really matter, as long as it is off screen we are fine. I could have done 10000000 as the value, and in theory it would be the same. I think Dimensions height is always the height in portrait mode, and does not change on rotation, but I could be wrong on that. No one has reported an issue yet in practice, so I'm assuming it's working out. Hoping to get rid of FIX_SHIFT sooner than later.