@@ -27,6 +27,7 @@ import com.facebook.react.uimanager.JSKeyDispatcher
2727import com.facebook.react.uimanager.JSPointerDispatcher
2828import com.facebook.react.uimanager.JSTouchDispatcher
2929import com.facebook.react.uimanager.common.UIManagerType
30+ import com.facebook.react.views.view.isEdgeToEdge
3031import com.facebook.systrace.Systrace
3132import java.util.Objects
3233import kotlin.math.max
@@ -47,16 +48,19 @@ public class ReactSurfaceView(context: Context?, private val surface: ReactSurfa
4748
4849 private val viewportOffset: Point
4950 get() {
50- val locationOnScreen = IntArray (2 )
51- getLocationOnScreen(locationOnScreen )
51+ val locationInWindow = IntArray (2 )
52+ getLocationInWindow(locationInWindow )
5253
53- // we need to subtract visibleWindowCoords - to subtract possible window insets, split
54- // screen or multi window
55- val visibleWindowFrame = Rect ()
56- getWindowVisibleDisplayFrame(visibleWindowFrame)
57- locationOnScreen[0 ] - = visibleWindowFrame.left
58- locationOnScreen[1 ] - = visibleWindowFrame.top
59- return Point (locationOnScreen[0 ], locationOnScreen[1 ])
54+ if (! isEdgeToEdge) {
55+ // When not in edge-to-edge mode, subtract the visible window frame to get the offset
56+ // relative to the content area (below the status bar).
57+ val visibleWindowFrame = Rect ()
58+ getWindowVisibleDisplayFrame(visibleWindowFrame)
59+ locationInWindow[0 ] - = visibleWindowFrame.left
60+ locationInWindow[1 ] - = visibleWindowFrame.top
61+ }
62+
63+ return Point (locationInWindow[0 ], locationInWindow[1 ])
6064 }
6165
6266 init {
0 commit comments