Skip to content

[Android][NewArch] Weird layout styling if multiple instances of the same component with the same props #48249

@BogiKay

Description

@BogiKay

Description

I observed odd layout behaviour if I create two instances of the same component with the same props(or more likely if rendering outcome is the same). Basically, if on the screen there're two instances of the same component layout related styles of the second instance are overwritten by the first instance of the component. Hence, we can get two different results based on the order of components.

Issue seems to happen if rendering outcomes are the same. In my case the same margin(or padding) and Text's value. If value of text input is changed as in the recorded video, then layout is correct.

I already checked that the same issue happen for TextInput wrapped by View.

I'm trying to debug the problem, so any suggestions where should I start investigating are welcomed.

Steps to reproduce

  1. Install deps of the application with reproducible bug
  2. run the app on an android device or emulator
  3. Toggle the value by clicking the button
  4. Observe change of second component width despite the fact that only value is changed.

React Native Version

0.76.5

Affected Platforms

Runtime - Android

Areas

Fabric - The New Renderer

Output of npx react-native info

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 82.25 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.2
    path: ~/.nvm/versions/node/v18.20.2/bin/node
  Yarn:
    version: 4.5.2
    path: ~/.nvm/versions/node/v18.20.2/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v18.20.2/bin/npm
  Watchman:
    version: 2024.10.21.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/bogusz/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "34"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 35.0.0
    System Images:
      - android-29 | Google APIs ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/bogusz/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.5
    wanted: 0.76.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

no logs

Reproducer

https://github.com/BogiKay/android-layout-bug

Screenshots and Videos

android-layout-issue.webm

Metadata

Metadata

Assignees

Labels

Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.PartnerPlatform: AndroidAndroid applications.Resolution: FixedA PR that fixes this issue has been merged.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)p: CallstackPartner: Callstack

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions