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

use ReactSurface pre render

Open mistletoe5215 opened this issue 1 month ago • 3 comments

Description

after open bridgeless , and use following code: val reactNativeHost = RealRNHostProvider.requireReactNativeHost(activity, bundleId) val reactDelegate = MTRNReactDelegate(activity, reactNativeHost, mainComponentName, launchOptions, true) val reactHost = reactDelegate.reactHost val surface = reactHost.createSurface( activity, mainComponentName, launchOptions ) surface.start() val surfaceTag = generateSurfaceTag(bundleId, mainComponentName) surfaceMap.put(surfaceTag, surface) to pre render my rn surface ,then use it in following fragment: val (bundleName, appKey) = GameRecordLocalReactModule.getName() val launchOptions = arguments?: Bundle() val preloadSurface = MTRNPreloadManager.getPreloadSurface(lifecycle, bundleName, appKey) val reactView = preloadSurface?.view reactView?.let { vb?.gameRecordFrame?.addView(it,FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT )) (preloadSurface as ReactSurfaceImpl).updateInitProps(launchOptions) } and then ,my rn content (include Image 、TouchableOpacity)can't get any onPress event , can any one tell me why??

Steps to reproduce

  1. try to add rn fragment ,reference:https://reactnative.dev/docs/integration-with-android-fragment
  2. do pre render in my Native MainActivity

React Native Version

0.79.2

Affected Platforms

Runtime - Android

Areas

Bridgeless - The New Initialization Flow, Fabric - The New Renderer

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

info Fetching system and libraries information...
System:
  OS: macOS 26.0
  CPU: (10) arm64 Apple M5
  Memory: 2.95 GB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.5
    path: /Users/admin/.nvm/versions/node/v20.19.5/bin/node
  Yarn: Not Found
  npm:
    version: 10.8.2
    path: /Users/admin/.nvm/versions/node/v20.19.5/bin/npm
  Watchman:
    version: 2025.11.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.1
      - iOS 26.1
      - macOS 26.1
      - tvOS 26.1
      - visionOS 26.1
      - watchOS 26.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.2 AI-252.25557.131.2521.14432022
  Xcode:
    version: 26.1.1/17B100
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.17
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

no log when i press any rn components

MANDATORY Reproducer

no

Screenshots and Videos

No response

mistletoe5215 avatar Dec 18 '25 12:12 mistletoe5215

[!WARNING] Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

react-native-bot avatar Dec 18 '25 12:12 react-native-bot

[!WARNING] Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

react-native-bot avatar Dec 18 '25 12:12 react-native-bot

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


You can read more about about it on our website: How to report a bug.

react-native-bot avatar Dec 18 '25 12:12 react-native-bot