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

CSS "top" style property affecting testID in components nested in a Pressable component #50047

Open
lucartc opened this issue Mar 16, 2025 · 1 comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.

Comments

@lucartc
Copy link

lucartc commented Mar 16, 2025

Description

If a custom component has a Pressable parent component and it has a CSS top style property set, its testID is supressed and is not shown as a resource-id when maestro hierarchy is run, as should be expected.

Although it may seem a bug related to Maestro, this issue indicates otherwise, and so I felt like an issue should be created here.

These issues may be related: #32969 #39382

Desired behaviour

testID of all components should appear as resource-id in hierarchy regardless of the presence of CSS top style attribute or if it has a Pressable parent component in its parent tree.

Actual behaviour

testID not showing as a resource-id in the hierarchy if CSS top style attribute is informed and if it has a Pressable component in its parent tree.

Steps to reproduce

Run example repo

  1. Clone this repo
  2. Install packages with npm install
  3. Install Maestro
  4. Run npx expo run:android
  5. Run maestro hierarchy | grep-id. You should see 2 lines with "resource-id" : "id-1", and "resource-id" : "id-2", respectively
  6. Uncomment line 9 at SecondComponent.jsx, where property top: '100%' is set
  7. Run maestro hierarchy | grep-id again. Now you should see only "resource-id" : "id-1",

Creating a project from scratch

  1. Run npx create-expo-app@latest
  2. Change index.tsx into this
  3. Create a new custom folder inside /components
  4. Create two custom components at /components/custom, FirstComponent.jsx and SecondComponent.jsx like this and this, respectively
  5. Install Maestro
  6. Run npx expo run:android
  7. Run maestro hierarchy | grep-id. You should see 2 lines with "resource-id" : "id-1", and "resource-id" : "id-2", respectively
  8. Uncomment line 9 at SecondComponent.jsx to set property top: '100%'
  9. Run ``again. Now you should see only "resource-id" : "id-1",

React Native Version

0.76.7

Affected Platforms

Runtime - Android

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

System:
  OS: Linux 6.8 Pop!_OS 22.04 LTS
  CPU: (8) x64 AMD Ryzen 5 3400G with Radeon Vega Graphics
  Memory: 3.42 GB / 13.57 GB
  Shell:
    version: 5.1.16
    path: /bin/bash
Binaries:
  Node:
    version: 20.14.0
    path: ~/node-v20.14.0-linux-x64/bin/node
  Yarn: Not Found
  npm:
    version: 10.7.0
    path: ~/node-v20.14.0-linux-x64/bin/npm
  Watchman:
    version: 4.9.0
    path: /usr/bin/watchman
SDKs:
  Android SDK:
    API Levels:
      - "29"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.3
      - 34.0.0
      - 35.0.0
      - 35.0.1
    System Images:
      - android-22 | Google APIs Intel x86 Atom
      - android-24 | Google APIs Intel x86 Atom
      - android-35 | Google APIs Intel x86_64 Atom
      - android-35 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 23.0.2
    path: /usr/bin/javac
  Ruby:
    version: 3.4.2
    path: /home/luca/.local/share/mise/installs/ruby/3.4.2/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.7
    wanted: 0.76.7
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

It doesn't have a stacktrace/log besides the output of `maestro hierarchy`. The full output files are sent below.

Reproducer

https://github.com/lucartc/RNBug

Screenshots and Videos

Component(blue square) with top: '100%' commented

Image

Component(blue square) with top: '100%' uncommented

Image

As it can be seen, in both cases the SecondComponent still appears at the screen, excluding the hypothesis
that its missing testID is due to it not being visible.

These are the full outputs of maestro hierarchy for when the line is uncommented and commented, respectively:
uncommented.txt
commented.txt

@migueldaipre migueldaipre added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Triage 🔍 labels Mar 18, 2025
@migueldaipre
Copy link
Collaborator

Hey, @lucartc, thanks for reporting the issue. Could you test the latest versions of React Native and see if the issue persists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.
Projects
None yet
Development

No branches or pull requests

2 participants