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

Emitted event from Android is not received on the JS side #46306

Open
Anush-Shand opened this issue Sep 3, 2024 · 3 comments
Open

Emitted event from Android is not received on the JS side #46306

Anush-Shand opened this issue Sep 3, 2024 · 3 comments
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@Anush-Shand
Copy link

Description

I migrated my library to the new architecture and this issue occurs only when the bridgeless mode is enabled for the sample app. When I launch my app from tapping on a notification from the killed state, an event is fired immediately from the android side but it is never received on the listener in App.js. This works perfectly fine on the old architecture.

Also for new architecture with the bridgeless mode disabled, the event is emitted before the listener is attached. This was confirmed by adding a delay.

What has changed with respect to

  1. The new architecture such that my event is emitted before the listener is attached?
  2. The bridgeless mode such that listener never receives the event in the new architecture irrespective of the delay?

Steps to reproduce

  1. Install the android application.
  2. Send a notification from firebase.
  3. Tap on notification and observe the logs

React Native Version

0.74.5

Affected Platforms

Runtime - Android

Areas

TurboModule - The New Native Module System, Bridgeless - The New Initialization Flow

Output of npx react-native info

System:
  OS: macOS 13.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 105.23 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.2.0
    path: ~/.nvm/versions/node/v21.2.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v21.2.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v21.2.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK: Not Found
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12169540
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.6
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: ^0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

Notice how listeners are attached after the event `CleverTapPushNotificationClicked` is sent. The below logs are with bridgeless mode enabled

Sending event CleverTapPushNotificationClicked
2024-09-03 15:47:18.271 31768-31768 unknown:BridgelessReact com.reactnct                         W  ReactHost{0}.startSurface(surfaceId = 0): Schedule
2024-09-03 15:47:18.271 31768-31768 unknown:BridgelessReact com.reactnct                         W  ReactHost{0}.attachSurface(surfaceId = 0)
2024-09-03 15:47:18.271 31768-31856 unknown:BridgelessReact com.reactnct                         W  ReactHost{0}.getOrCreateReactInstanceTask()
2024-09-03 15:47:18.271 31768-31856 unknown:BridgelessReact com.reactnct                         W  ReactHost{0}.startSurface(surfaceId = 0): Execute
2024-09-03 15:47:18.327 31768-31870 WebViewFactory          com.reactnct                         I  Loading com.google.android.webview version 103.0.5060.71 (code 506007134)
2024-09-03 15:47:18.332 31768-31870 nativeloader            com.reactnct                         D  Configuring classloader-namespace for other apk /data/app/~~EFPfHDi5gXVBA0K4QsePig==/com.google.android.trichromelibrary_506007134-afJeSXpZ5uPqQKwR6hzE5g==/TrichromeLibrary.apk. target_sdk_version=33, uses_libraries=ALL, library_path=/data/app/~~fWTShcRyzfiQmwLj_gZTPQ==/com.google.android.webview-sTWl46WYdt9sNenS1AhG-w==/lib/arm64:/data/app/~~fWTShcRyzfiQmwLj_gZTPQ==/com.google.android.webview-sTWl46WYdt9sNenS1AhG-w==/WebViewGoogle.apk!/lib/arm64-v8a:/data/app/~~EFPfHDi5gXVBA0K4QsePig==/com.google.android.trichromelibrary_506007134-afJeSXpZ5uPqQKwR6hzE5g==/TrichromeLibrary.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
2024-09-03 15:47:18.340 31768-31870 nativeloader            com.reactnct                         D  Configuring classloader-namespace for other apk /data/app/~~fWTShcRyzfiQmwLj_gZTPQ==/com.google.android.webview-sTWl46WYdt9sNenS1AhG-w==/WebViewGoogle.apk. target_sdk_version=33, uses_libraries=, library_path=/data/app/~~fWTShcRyzfiQmwLj_gZTPQ==/com.google.android.webview-sTWl46WYdt9sNenS1AhG-w==/lib/arm64:/data/app/~~fWTShcRyzfiQmwLj_gZTPQ==/com.google.android.webview-sTWl46WYdt9sNenS1AhG-w==/WebViewGoogle.apk!/lib/arm64-v8a:/data/app/~~EFPfHDi5gXVBA0K4QsePig==/com.google.android.trichromelibrary_506007134-afJeSXpZ5uPqQKwR6hzE5g==/TrichromeLibrary.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
2024-09-03 15:47:18.347 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaProviderManager
2024-09-03 15:47:18.347 31768-31768 unknown:ReactNative     com.reactnct                         E  Unable to launch logbox because react was unable to create the root view
2024-09-03 15:47:18.349 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
2024-09-03 15:47:18.350 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.SearchBarManager
2024-09-03 15:47:18.351 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager
2024-09-03 15:47:18.351 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaViewManager
2024-09-03 15:47:18.352 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.th3rdwave.safeareacontext.SafeAreaViewShadowNode
2024-09-03 15:47:18.353 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ScreenViewManager
2024-09-03 15:47:18.354 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager
2024-09-03 15:47:18.354 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ScreenContainerViewManager
2024-09-03 15:47:18.355 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.reactnativepagerview.PagerViewViewManager
2024-09-03 15:47:18.355 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ModalScreenViewManager
2024-09-03 15:47:18.356 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackHeaderSubviewManager
2024-09-03 15:47:18.356 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackViewManager
2024-09-03 15:47:18.357 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.swmansion.rnscreens.ScreenStackHeaderConfigViewManager
2024-09-03 15:47:18.377 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.debuggingoverlay.DebuggingOverlayManager
2024-09-03 15:47:18.380 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2024-09-03 15:47:18.381 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
2024-09-03 15:47:18.383 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2024-09-03 15:47:18.383 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
2024-09-03 15:47:18.385 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2024-09-03 15:47:18.386 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
2024-09-03 15:47:18.388 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
2024-09-03 15:47:18.392 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2024-09-03 15:47:18.394 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2024-09-03 15:47:18.395 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
2024-09-03 15:47:18.398 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2024-09-03 15:47:18.399 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
2024-09-03 15:47:18.402 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2024-09-03 15:47:18.405 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2024-09-03 15:47:18.407 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
2024-09-03 15:47:18.409 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2024-09-03 15:47:18.409 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
2024-09-03 15:47:18.411 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2024-09-03 15:47:18.411 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
2024-09-03 15:47:18.412 31768-31870 com.reactnct            com.reactnct                         W  Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed)
2024-09-03 15:47:18.412 31768-31870 com.reactnct            com.reactnct                         W  Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed)
2024-09-03 15:47:18.412 31768-31870 com.reactnct            com.reactnct                         W  Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed)
2024-09-03 15:47:18.412 31768-31870 com.reactnct            com.reactnct                         W  Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2024-09-03 15:47:18.412 31768-31870 com.reactnct            com.reactnct                         W  Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed)
2024-09-03 15:47:18.413 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2024-09-03 15:47:18.415 31768-31870 cr_WVCFactoryProvider   com.reactnct                         I  Loaded version=103.0.5060.71 minSdkVersion=29 isBundle=false multiprocess=true packageId=2
2024-09-03 15:47:18.415 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2024-09-03 15:47:18.415 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
2024-09-03 15:47:18.416 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2024-09-03 15:47:18.417 31768-31869 unknown:Vi...rtyUpdater com.reactnct                         W  Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
2024-09-03 15:47:18.431 31768-31870 cr_LibraryLoader        com.reactnct                         I  Successfully loaded native library
2024-09-03 15:47:18.432 31768-31870 cr_CachingUmaRecorder   com.reactnct                         I  Flushed 8 samples from 8 histograms.
2024-09-03 15:47:18.434 31768-31881 cr_VariationsUtils      com.reactnct                         I  Failed reading seed file "/data/user/0/com.reactnct/app_webview/variations_seed_new"
2024-09-03 15:47:18.434 31768-31881 cr_VariationsUtils      com.reactnct                         I  Failed reading seed file "/data/user/0/com.reactnct/app_webview/variations_seed"
2024-09-03 15:47:18.442 31768-31884 TrafficStats            com.reactnct                         D  tagSocket(136) with statsTag=0xffffffff, statsUid=-1
2024-09-03 15:47:18.444 31768-31885 TrafficStats            com.reactnct                         D  tagSocket(136) with statsTag=0xffffffff, statsUid=-1
2024-09-03 15:47:18.455 31768-31869 ReactNativeJS           com.reactnct                         I  Bridgeless mode is enabled
2024-09-03 15:47:18.491 31768-31869 ReactNativeJS           com.reactnct                         I  Running "Example" with {"rootTag":11,"initialProps":{},"fabric":true}
2024-09-03 15:47:18.580 31768-31886 TrafficStats            com.reactnct                         D  tagSocket(136) with statsTag=0xffffffff, statsUid=-1
2024-09-03 15:47:18.604 31768-31887 TrafficStats            com.reactnct                         D  tagSocket(137) with statsTag=0xffffffff, statsUid=-1
2024-09-03 15:47:18.650 31768-31869 CleverTap:...c_deviceID com.reactnct                         V  CleverTapAPI instance = com.clevertap.android.sdk.CleverTapAPI@5c6f83d
2024-09-03 15:47:18.656 31768-31870 CleverTapReact          com.reactnct                         I  CleverTap.registerForPush is a no-op in Android
2024-09-03 15:47:18.657 31768-31869 ReactNativeJS           com.reactnct                         I  Listeners attached

Reproducer

https://github.com/CleverTap/clevertap-react-native/tree/task/SDK-3736/Research-and-Document-RN-new-architecture-changes/Example

Screenshots and Videos

No response

@Anush-Shand Anush-Shand added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Sep 3, 2024
@react-native-bot react-native-bot added Platform: Android Android applications. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Sep 3, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: React Native Team Attention and removed Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Sep 12, 2024
@coado
Copy link
Collaborator

coado commented Sep 19, 2024

For now I can tell that there is a difference between the old and the new architecture. The event listeners are registered after the event is received in the JS on Fabric in oppose to what happens on Paper. I created a minimal repro for this one as I am still investigating the issue https://github.com/coado/react-native-event-emitter-issue

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. Platform: Android Android applications. Resolution: PR Submitted A pull request with a fix has been provided. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

4 participants