Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: getBoundingClientRect undefined check#2496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
pinpong wants to merge4 commits intogorhom:master
base:master
Choose a base branch
Loading
frompinpong:fix/useBoundingClientRect

Conversation

@pinpong
Copy link
Contributor

Fix#2494 because!== null not checking if undefined
I have the same error after updating to RN0.82.0-rc4

Dahmon, daannet, and Rexogamer reacted with thumbs up emoji
@mgcrea
Copy link

This is now crashing in0.82.0:

Proper fix imo:

diff --git a/src/hooks/useBoundingClientRect.ts b/src/hooks/useBoundingClientRect.tsindex cc85c8ced2de8ec514360368ed20af733f8f9aec..cb92a016d67215a65a1d2b9ce710d6be34a36a6b 100644--- a/src/hooks/useBoundingClientRect.ts+++ b/src/hooks/useBoundingClientRect.ts@@ -56,7 +56,7 @@ export function useBoundingClientRect(     }      // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba-    if (ref.current.unstable_getBoundingClientRect !== null) {+    if (typeof ref.current.unstable_getBoundingClientRect === "function") {       // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba       const layout = ref.current.unstable_getBoundingClientRect();       handler(layout);@@ -64,7 +64,7 @@ export function useBoundingClientRect(     }      // @ts-ignore once it `unstable_getBoundingClientRect` gets stable 🤞.-    if (ref.current.getBoundingClientRect !== null) {+    if (typeof ref.current.getBoundingClientRect === "function") {       // @ts-ignore once it `unstable_getBoundingClientRect` gets stable.       const layout = ref.current.getBoundingClientRect();       handler(layout);
AZ604 and muzhaqi16 reacted with thumbs up emojimuzhaqi16 reacted with eyes emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Crash when calling unstable_getBoundingClientRect

2 participants

@pinpong@mgcrea

[8]ページ先頭

©2009-2025 Movatter.jp