Skip to content

[0.77] getBoundingClientRect TypeScript type definition missing on View with New Architecture #50684

Open
@bryanmylee

Description

@bryanmylee

Description

With the introduction of New Architecture and useLayoutEffect, we can now read layout synchronously with ref.current?.getBoundingClientRect.

However, the TypeScript definition for NativeMethods does not yet include the newly supported method.

Steps to reproduce

Check the definition of NativeMethods in react-native/types/public/ReactNativeTypes.d.ts, note that getBoundingClientRect is missing.

React Native Version

0.77.1

Affected Platforms

Build - MacOS

Areas

Other (please specify)

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

info Fetching system and libraries information...
System:
  OS: macOS 14.5
  CPU: (12) arm64 Apple M2 Pro
  Memory: 121.22 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v18.19.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/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 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "31"
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-35 | Google Play ARM 64 v8a
      - android-Baklava | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /Users/bryan/.rvm/rubies/ruby-3.3.6/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.1
    wanted: ~0.77.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

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

Stacktrace or Logs

Not applicable.

Reproducer

https://github.com/bryanmylee/missing-types-new-arch-native-methods

Screenshots and Videos

I've searched for any mention of this all over but can't find anything, and the documentation barely makes a mention of getBoundingClientRect.

This appears to be the most valid channel to report this bug, however this does not produce a stacktrace or reproducer, so I'm happy to move this elsewhere if necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions