Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React Native] Strange Error at render and/or submit #10456

Closed
1 task done
firasrg opened this issue May 28, 2023 · 13 comments · Fixed by #10458
Closed
1 task done

[React Native] Strange Error at render and/or submit #10456

firasrg opened this issue May 28, 2023 · 13 comments · Fixed by #10458
Labels
browser compatibility Browser level issue.

Comments

@firasrg
Copy link

firasrg commented May 28, 2023

Version Number

7.44.1

Codesandbox/Expo snack

https://snack.expo.dev/@frg1220/bug---react-hook-form-v7

Steps to reproduce

Steps

  1. Open the Expo Snack link
  2. Switch to Android emulator OR QR code to run on device
  3. Render the form page
  4. Get an error from React Native compiler

Notes

  • No errors on WEB platform.
  • Switching to version 7.17.5, solves the problem.

Expected behaviour

I'm expecting to see the form running without any issues, do submission and apply normal validations.

What browsers are you seeing the problem on?

No response

Relevant log output

TypeError: Object.hasOwn is not a function. (In 'Object.hasOwn(e, _r)', 'Object.hasOwn' is undefined)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Moshyfawn
Copy link
Member

Interesting, the error's the same as #10455

@Moshyfawn
Copy link
Member

Moshyfawn commented May 28, 2023

So, from what I can see on the surface, Object.hasOwn was introduced in Node v16.9.0 and is used in RHF codebase.

What's weird is that the last "working" version was v7.44.0-rc.1 (npm can't find v7.44.0-rc.2) for some reason; can't verify). I don't belive it contains any changes related to Object.hasOwn 🤔

@Moshyfawn
Copy link
Member

Ah, OK, so v7.44.0-rc.2 is the version that introduced the Object.hasOwn method into the codebase.

@bluebill1049 do you want to set a new min required Node version to v16.9.0 or try to avoid it?

It is a major RHF version bump..

@Moshyfawn
Copy link
Member

@firasrg you can downgrade to something like v7.43.9 for now

@firasrg
Copy link
Author

firasrg commented May 28, 2023

@Moshyfawn thank you so much for the reply 😃

Alright then

I have a good experience with React, do you think, that I can fix this issue?

@Moshyfawn
Copy link
Member

I have a good experience with React, do you think, that I can fix this issue?

Let's see what @bluebill1049 wants to do first and go from there

@bluebill1049
Copy link
Member

@bluebill1049 which commit introduced that?

@bluebill1049 bluebill1049 added status: under investigation aware of this issue and pending for investigation browser compatibility Browser level issue. and removed status: under investigation aware of this issue and pending for investigation labels May 28, 2023
@bluebill1049
Copy link
Member

Thank you @Moshyfawn 🙏 fixing it.

@Moshyfawn
Copy link
Member

@bluebill1049 which commit introduced that?

d68ef91

bluebill1049 added a commit that referenced this issue May 28, 2023
* 🪟 fix #10456object.hasown replaced with hasOwnProperty

* fix: use hasownproperty in isEmptyArray

---------

Co-authored-by: moshyfawn <email@moshyfawn.dev>
@ryota-murakami
Copy link
Contributor

So, from what I can see on the surface, Object.hasOwn was introduced in Node v16.9.0 and is used in RHF codebase.

What's weird is that the last "working" version was v7.44.0-rc.1 (npm can't find v7.44.0-rc.2) for some reason; can't verify). I don't belive it contains any changes related to Object.hasOwn 🤔

I was surprised that Object.hasOwn was a relatively newly implemented method!

@bluebill1049
Copy link
Member

I didn't know that as well @ryota-murakami 😂 we have been spoiled by babel for too long.

@ryota-murakami
Copy link
Contributor

I didn't know that as well @ryota-murakami 😂 we have been spoiled by babel for too long.

@bluebill1049 I agree with you!
I think that the current state of "runtime" is not good, and I would like to migrate to Deno as soon as possible and continue using React-Hook-Form there as well.

@firasrg
Copy link
Author

firasrg commented May 29, 2023

Hello !

Awesome! the issue is fixed quickly! I appreciate your reactivity. 😍
Now going to switch to the new version!

Enjoy your day

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
browser compatibility Browser level issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants