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

[0.77][Android][JSC] Object.hasOwn is not defined, using FlatList, etc. #47963

Open
robhogan opened this issue Nov 26, 2024 · 3 comments
Open

Comments

@robhogan
Copy link
Contributor

Description

Object.hasOwn is not implemented in the version of JSC shipped with RN Android, or on iOS < 15.4 (according to MDN-untested).

Object.hasOwn was introduced into RN core in #46386 (CC @yungsters)

We either need to replace that usage, or add a shim/polyfill for Object.hasOwn.

IMO, this is stable release blocking for RN 0.77.

Steps to reproduce

react-native$ cd packages/rn-tester
rn-tester$ yarn install-android-jsc
rn-tester$ yarn start

Navigate to FlatList -> Basic.

React Native Version

0.77.0-rc.0

Affected Platforms

Runtime - Android

Output of npx react-native info

npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 15.1.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 145.30 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.6.0
    path: ~/.nvm/versions/node/v22.6.0/bin/node
  Yarn:
    version: 1.22.19
    path: ~/homebrew/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v22.6.0/bin/npm
  Watchman:
    version: 2024-11-25T03:04:25Z
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.11.3
    path: /Users/robhogan/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "26"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.15989.150.2411.11948838
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 1.8.0_302
    path: /usr/local/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/robhogan/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

Warning: TypeError: Object.hasOwn is not a function. (In 'Object.hasOwn(next, key)', 'Object.hasOwn' is undefined)

This error is located at:
    in Animated(View) (created by TouchableOpacity)
    in TouchableOpacity (created by TouchableOpacity)
    in _c (created by RNTesterDocumentationURL)
    in RNTesterDocumentationURL (created by HeaderAndroid)
    in RCTView (created by View)
    in View (created by HeaderAndroid)
    in RCTView (created by View)
    in View (created by HeaderAndroid)
    in RCTView (created by View)
    in View (created by HeaderAndroid)
    in HeaderAndroid (created by RNTTitleBar)
    in RNTTitleBar (created by RNTesterApp)
    in RNTesterApp
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in RNTesterApp(RootComponent)

Reproducer

https://github.com/facebook/react-native

Screenshots and Videos

image
@react-native-bot react-native-bot added Component: FlatList Platform: Android Android applications. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Nov 26, 2024
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@robhogan robhogan added JavaScript and removed Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Nov 26, 2024
@NickGerleman
Copy link
Contributor

NickGerleman commented Nov 29, 2024

FYI @Kudo who has been working on updating Android JSC

0.76 requires 15.1 though, instead of 15.4, so we don’t have it supported in the current min iOS we claim to support.

@Kudo
Copy link
Contributor

Kudo commented Nov 29, 2024

the version i updated is based on WebKitGTK 2.26.4, which is still old and would not support Object.hasOwn. there is a hard blocker for updating jsc-android to newer version. newer jsc doesn't have a way to turn off Intl support. we have to ship Intl variant only and would definitely increase apk size. that's why i plan to update jsc version and ship Intl variant only when we moving away jsc from core.

so, i would recommend a polyfill in 0.77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants