Skip to content

measure or measureInWindow broken in 0.77 with (android) targetSdk 35 (maybe) #50509

Open

Description

@dcorbin

Description

First, I am aware of the changes made in 0.77 to forced edge-to-edge displays when targeting SDK 35. But I'm concerned that a bug has been introduced in to measure() or measureInWindow().

I have written a small RN project to show what I'm concerned with: https://github.com/dcorbin/LayoutEdgeToEdge. When targeting SDK 35 with this code, I call both methods and they return different values for y. However, if this project is built with targetSDK 34, the report they same Y value. (Screenshots below)

It makes sense to me that the value changes when edge-to-edge is enabled, but given how the views are laid out it seem that it should be the same Y for both methods.

I have seen this behavior cause regressions in two different circumstances where the layout of a view is being used to calculate a relative position of another view.

Probably unrelated, but I am curious why the onLayout information is different than the measure/measureInWindow information.

Steps to reproduce

  1. Checkout and run the example application.
  2. Notice the output as it is placed in the view.

React Native Version

0.77.0

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

info Fetching system and libraries information...
System:
  OS: macOS 15.4
  CPU: (10) arm64 Apple M1 Max
  Memory: 4.26 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.2.4
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "29"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-21 | Google APIs ARM 64 v8a
      - android-23 | ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.22562.218.2431.13114758
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 23.0.1
    path: /Users/dcorbin/.jenv/shims/javac
  Ruby:
    version: 3.4.1
    path: /Users/dcorbin/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: 0.77.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

info React Native v0.78.2 is now available (your project is running on v0.77.0).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.78.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.77.0&to=0.78.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Stacktrace or Logs

N/A

Reproducer

https://github.com/dcorbin/LayoutEdgeToEdge

Screenshots and Videos

targetSdk 35
Image
targetSdk 34
Image

Activity

  1. react-native-bot commented on Apr 6, 2025

    @react-native-bot
    Collaborator

    Tip

    Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.77.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

  2. react-native-bot commented on Apr 6, 2025

    @react-native-bot
    Collaborator

    Tip

    Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

  3. dcorbin commented on Apr 7, 2025

    @dcorbin
    Author

    https://developer.android.com/develop/ui/views/layout/edge-to-edge

    To me, this confirms my belief. If the top view is the full size of the window (and I think it is), the measure() and measureInWindow() should return the same Y value.

  4. dcorbin commented on Jun 13, 2025

    @dcorbin
    Author

    I think this repo also shows it: https://github.com/dcorbin-bugs/measureInWindowBug
    It definitely shows that Android and IOS have different behaviors in measureInWindow.

    In this case, with edge-to-edge, I position a control absolutely, and measureInWindow is returning a y value from the top safeInset.

    The IOS behavior makes sense to me, but the Android does not.

    You can see screenshots of both platforms here : https://github.com/dcorbin-bugs/measureInWindowBug/tree/main/screenshots

  5. Bardiamist commented on Jun 24, 2025

    @Bardiamist
    Contributor

    Same problem. I working on edge-to-edge. My status bar is translucent. measureInWindow returns wrong y value on Android. On iOS works as expected.

    React native 0.79.4

  6. robmcilroy1992 commented on Jul 21, 2025

    @robmcilroy1992

    Hey @dcorbin did you find any resolution for this? We're facing the same on Android 35 and RN 0.77.2. Our X axis value is way off, I think it's related to it being embedded in a wix react native navigation side menu which is animated in/out but works fine on IOS

  7. dcorbin commented on Jul 21, 2025

    @dcorbin
    Author

    My solution was to wrap the measure functions in Platform aware functions that adjust Android by safeAreaInsets

  8. gavrilikhin-d commented on Aug 25, 2025

    @gavrilikhin-d

    This is looks like a known issue since 2018. #19497

  9. react-native-bot commented on Feb 22, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  10. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    and removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Feb 22, 2026
  11. shettayyy commented on May 24, 2026

    @shettayyy

    I can confirm this is still a problem. It's difficult to position an element like maybe a spotlight on Android as edge-to-edge supported devices and devices that do not support edge-to-edge provide different Y coordinates

  12. react-native-bot commented on Nov 20, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  13. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions