Closed tecno40 closed 3 years ago
Was FIX_SHIFT purposely off by an increment of 1 to offset for the driver issue? Maybe the driver has since been fixed, or it only applies to certain versions of react native?
That's a decent explanation of what is going on, but out of date since the last commit. I now replaced all the FIX_SHIFT * 2
with FIX_SHIFT
, which should bring everything in sync. I don't want styles.container to contain the shift for consistency reasons.
The shift was the result of hours of debugging an issue with useNativeDriver, where it would flash the popover on and off really quickly, and then animate in normally. Now, because of the shift, the flash happens off screen, and then it is shifted on screen just before beginning the actual animation. I'm unsure of what versions and platforms it is happening on, but if you have the time, you are welcome to remove it and test on a variety of combinations to see if it still occurs. I would love to get rid of it if it is no longer an issue.
See if this commit fixes it. I won't have time to test until the weekend unfortunately.
I didn't do a comprehensive test, but it does seem to be working from the areas I tested.
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.
I tested the change in commit
1d273d3
and it looks like there was a small issue with it. I also found my original understanding of the problem was incorrect. Here's an updated fix and a better explanation.<View pointerEvents="box-none" style={styles.container}
(styles.container
originally had a `-1 FIX_SHIFT` as part of it)<Animated.View pointerEvents="box-none" style={containerStyle}>
(styles.container
originally had a `-1 FIX_SHIFT` as part of it)1d273d3
did fix the issue on line 328, but it accidentally removed the -1 * FIX_SHIFT at line 1170, which we still needcontainerStyle
which line 1170 references