Open buynao opened 1 year ago
Same issue happening here under following conditions : "react-native": "0.71.8", "react-native-popover-view": "^5.1.7",
Android SDK :
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
I am facing the same issue on the following version.
"react-native-popover-view": "^5.1.8", "react-native": "0.72.3",
Android SDK : minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33
This issue with the popover showing in the wrong position appears when the status bar translucency is different in the popover. There are 2 cases:
statusBarTranslucent={true}
for the Popover component, or adjusting the vertical offset to account for the status bar height with verticalOffset={-StatusBar.currentHeight}
statusBarTranslucent={false}
for the Popover component, or adjusting the vertical offset to account for the status bar height with verticalOffset={StatusBar.currentHeight}
This issue as far as I understand happens because the popover position is computed in one coordinate system, but displayed in another one. When the status bar is translucent, the vertical coordinates are relative to the top of the screen, when it is not translucent - they are relative to the bottom of the status bar.
Not sure if there is a way to solve this automatically from the library, since there is no way to get if the status bar is translucent currently or not.
This issue with the popover showing in the wrong position appears when the status bar translucency is different in the popover. There are 2 cases:
- The status bar is translucent with the popover closed, but becomes non-translucent when the popover is shown. In this case the popover position is too low. Can be fixed by either setting
statusBarTranslucent={true}
for the Popover component, or adjusting the vertical offset to account for the status bar height withverticalOffset={-StatusBar.currentHeight}
- The status bar is non-translucent with the popover closed, but becomes translucent when the popover is shown. In this case the popover position is too high. Can be fixed by either setting
statusBarTranslucent={false}
for the Popover component, or adjusting the vertical offset to account for the status bar height withverticalOffset={StatusBar.currentHeight}
This issue as far as I understand happens because the popover position is computed in one coordinate system, but displayed in another one. When the status bar is translucent, the vertical coordinates are relative to the top of the screen, when it is not translucent - they are relative to the bottom of the status bar.
Not sure if there is a way to solve this automatically from the library, since there is no way to get if the status bar is translucent currently or not.
statusBarTranslucent={true}
can solved my issue. Thanks.
Describe the bug
This bug only occurs on specific Android Devices, where the popvoer is displayed in an unusual position.
It seems that the statusBar is hidden when the popover is displayed, resulting in the wrong value for
verticalOffset
.For the most part, there is no problem with this line of code.
Device/Setup Info:
react-native
: "0.70.5"react-native-popover-view
: "5.1.7",Screenshots
Debug Output
I can't reproduce the problem myself using the emulator, so I don't have any debug-related information to give
Code Config