It used getWindowVisibleDisplayFrame which tells you the available area where content can be placed and remain visible to users. This was always taking status bar height into account, even if the app could be drawn behind it.
It was calling this method on the decorView, which is drawn under system bars anyway
This PR changes it to use contentView of the current activity and getLocationOnScreen which gets the coordinates of this view in the coordinate space of the device screen, irrespective of system decorations and whether the system is in multi-window mode.
In a nutshell, after this PR the absolute position will take into account whether the app is displayed behind the status bar.
Description
In https://github.com/software-mansion/react-native-gesture-handler/pull/1812 I changed how absolute position is calculated to be relative to the window instead of the screen, but there were two things wrong with it:
tells you the available area where content can be placed and remain visible to users
. This was always taking status bar height into account, even if the app could be drawn behind it.decorView
, which is drawn under system bars anywayThis PR changes it to use
contentView
of the current activity and getLocationOnScreen whichgets the coordinates of this view in the coordinate space of the device screen, irrespective of system decorations and whether the system is in multi-window mode
.In a nutshell, after this PR the absolute position will take into account whether the app is displayed behind the status bar.
Test plan
Tested on the example app:
https://github.com/software-mansion/react-native-gesture-handler/assets/21055725/c3230a2d-7bba-483b-b160-1c9fb32b0da1
https://github.com/software-mansion/react-native-gesture-handler/assets/21055725/701d9fa0-0c9f-4126-af58-f80c6a0a6526