react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Yoga Layout Assertion Failure After Upgrading to React Native 0.78

Open RameshTigeen opened this issue 8 months ago • 11 comments

Description

After updating to React Native version 0.78, I encountered an assertion failure related to the Yoga layout engine. The error message displayed is:

Attempt to get layout metrics from dirtied Yoga node.

React Native 0.78

  1. OS: Windows
  2. Device/Emulator: Nothing 2a & Pixel Fold
  3. Node Version: 21.1.9
  4. NPM/Yarn Version: 10.20

Steps to reproduce

  1. Create a new React Native project using version 0.78.​
  2. Implement a nested inline view component.​
  3. Trigger a state update using setState() within the component.​
  4. Observe the assertion failure in the console.

React Native Version

0.78.0

Affected Platforms

Runtime - Android

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

System:
  OS: Windows 11 10.0.26100
  CPU: "(16) x64 AMD Ryzen 7 5700G with Radeon Graphics         "
  Memory: 4.73 GB / 15.35 GB
Binaries:
  Node:
    version: 22.13.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 11.1.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20250113.015429.0
    path: C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
  Android SDK:
    API Levels:
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
      - 35.0.1
    System Images:
      - android-35 | Intel x86_64 Atom
      - android-35 | Google APIs Intel x86_64 Atom
      - android-35 | Google Play Intel x86_64 Atom
      - android-35 | Google APIs ATD Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
IDEs:
  Android Studio: AI-242.23726.103.2422.12816248
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.13
    path: /c/Program Files/Microsoft/jdk-17.0.13.11-hotspot/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: ^15.1.3
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.0
    wanted: 0.78.0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Nothing in the logs when the app is crash the dev tools or not connect to device so show the error need to connect the i am using the `npx react-native log-andorid` to manage to get the logs

Reproducer

https://github.com/react-native-community/reproducer-react-native

Screenshots and Videos

Image

RameshTigeen avatar Mar 21 '25 06:03 RameshTigeen

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.78.1. 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.

react-native-bot avatar Mar 21 '25 06:03 react-native-bot

[!TIP] Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. 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.

react-native-bot avatar Mar 21 '25 06:03 react-native-bot

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

react-native-bot avatar Mar 21 '25 06:03 react-native-bot

Moving to facebook/yoga (cc @NickGerleman)

cortinico avatar Mar 21 '25 16:03 cortinico

This is related to RN integration (assertion is in RM layout ShadowNode). IIRC there was some work @lenaic did around ShadowNode update, and a new change related to node cloning which prevented this in another context that @shwanton ran into.

@lenaic should have most context.

NickGerleman avatar Mar 22 '25 00:03 NickGerleman

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

react-native-bot avatar Mar 22 '25 00:03 react-native-bot

Are there any news on this? I just got 2 production crashes reported on Crashlytics:

Fatal Exception: java.lang.OutOfMemoryError
Failed to allocate a 32 byte allocation with 2569416 free bytes and 2509KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
java.util.ArrayList.iterator (ArrayList.java:1036)
com.facebook.yoga.YogaNodeJNIBase.calculateLayout (YogaNodeJNIBase.java:207)

nemanjamitric avatar Apr 11 '25 07:04 nemanjamitric

@RameshTigeen Could you attach an implemented repro to the issue? Does this repro on RN 0.79?

lenaic avatar May 09 '25 16:05 lenaic

same error, when i use react-native-modal-datetime-picker in react native model dialog

gautamsamyak avatar May 28 '25 19:05 gautamsamyak

any update on this. i am using 0.79.4 @NickGerleman @lenaic

basitmir avatar Jun 30 '25 13:06 basitmir

Similar https://github.com/facebook/react-native/issues/52349

basitmir avatar Jul 04 '25 04:07 basitmir