Missing measureInWindow Typings
Description
I think the measureInWindow function Typing might have been messed up or forgotten in the switch to internal typescript types.
Suddenly I am getting a typescript error for the code block
<View
onLayout={(event) => {
event.target.measureInWindow((x, y) => {
// do stuff here
});
}}
/>
The error is: Property 'measureInWindow' does not exist on type 'number'.
However, the code works as it always has and if you console.log(event.target.measureInWindow) you get [Function measureInWindow]
So I believe the type was simply incorrectly implemented or forgotten. But if this function was deprecated in some way please just let me know.
React Native Version
0.71.4
Output of npx react-native info
System: OS: macOS 13.2.1 CPU: (12) arm64 Apple M2 Max Memory: 948.83 MB / 96.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.19.1 - /opt/homebrew/opt/node@16/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.19.3 - /opt/homebrew/opt/node@16/bin/npm Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 33 Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 34.0.0 System Images: android-32 | Google APIs Intel x86 Atom_64, android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 19.0.2 - /opt/homebrew/opt/openjdk/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.4 => 0.71.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Detailed in the description.
Attempt to use the measureInWindow function in an onLayout for a View
Snack, code example, screenshot, or link to a repository
Code example in the description
| :warning: | Newer Version of React Native is Available! |
|---|---|
| :information_source: | You are on a supported minor version, but it looks like there's a newer patch available. 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. |
Confirmed still an issue in most recent version

This is marked as deprecated. Not sure if this answers your question.
The docs mention the method usage in the context of ref instead of event.target. Good to know there's that little trick there though.
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.
This issue was closed because it has been stalled for 7 days with no activity.