Skip to content

Can't access View from reactTag on iOS (New Architecture) #50800

@DorianMazur

Description

@DorianMazur

Description

I'm migrating to the New Architecture and I'm trying to access a native view instance by its reactTag on iOS. On Android, this is straightforward:

val uiManager = UIManagerHelper.getUIManager(getContext(), UIManagerType.FABRIC)
val view = uiManager?.resolveView(tag)

On iOS (Old Architecture), I used to do:

self.bridge?.uiManager.view(forReactTag: tag)

But now, with the New Architecture (Bridgeless/Fabric enabled), I can't figure out how to access the view from a reactTag. I can't find any documentation or relevant API for this on iOS.

Steps to reproduce

  1. Create a Native Module for iOS in a React Native app with the New Architecture (Fabric/Bridgeless) enabled.
  2. Attempt to access a native view instance by its reactTag inside your native code (Swift/Objective-C).
    Example (Old Way):
    self.bridge?.uiManager.view(forReactTag: tag)
  3. Notice that the above method does not work with the New Architecture. View cannot be find.

React Native Version

0.78.2

Affected Platforms

Runtime - iOS

Areas

TurboModule - The New Native Module System

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

System:
  OS: macOS 15.3.2
  CPU: (8) arm64 Apple M1 Pro
  Memory: 142.91 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.12.0
    path: ~/.nvm/versions/node/v22.12.0/bin/node
  Yarn:
    version: 3.6.1
    path: ~/.nvm/versions/node/v22.12.0/bin/yarn
  npm:
    version: 10.9.0
    path: ~/.nvm/versions/node/v22.12.0/bin/npm
  Watchman:
    version: 2024.09.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-29 | ARM 64 v8a
      - android-29 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-33 | ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | ARM 64 v8a
      - android-Tiramisu | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.21829.142.2421.12409432
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.3
    path: /usr/bin/javac
  Ruby:
    version: 3.3.5
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.2
    wanted: 0.78.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

N/A

Reproducer

https://github.com/DorianMazur/ui-manager-ios-not-working

Screenshots and Videos

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions