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

RCTJavaScriptDidLoadNotification never fires; iOS JS never receives event #35

Open
alecgorge opened this issue Nov 29, 2024 · 1 comment

Comments

@alecgorge
Copy link

Today I used patch-package to patch @kesha-antonov/[email protected] for the project I'm working on.

Downloads were working fine on Android, and native logs all looked fine on iOS but it would never publish the events back to JS. I'm not sure if these is a safe fix but it has worked okay for me so far.

diff --git a/node_modules/@kesha-antonov/react-native-background-downloader/ios/RNBackgroundDownloader.m b/node_modules/@kesha-antonov/react-native-background-downloader/ios/RNBackgroundDownloader.m
index fb90c07..a96954a 100644
--- a/node_modules/@kesha-antonov/react-native-background-downloader/ios/RNBackgroundDownloader.m
+++ b/node_modules/@kesha-antonov/react-native-background-downloader/ios/RNBackgroundDownloader.m
@@ -152,6 +152,8 @@ RCT_EXPORT_MODULE();
                                                   selector:@selector(handleBridgeJavascriptLoad:)
                                                   name:RCTJavaScriptDidLoadNotification
                                                   object:nil];
+            
+            isJavascriptLoaded = YES;
         }
     }
 }
@LMakshow
Copy link
Contributor

I encountered the same issue. It happens only in the New Architecture: using the library via the interop layer doesn't trigger the handleBridgeJavascriptLoad function.

When I use the app via Old Architecture, I see in the native logs this line right at the app start, while in the New Architecture, it's absent and no events are emitted back to JS.
<0x60000222c780 RNBackgroundDownloader.m:(168)> [RNBackgroundDownloader] - [handleBridgeJavascriptLoad]

I think it's safe to suppose that the JS is loaded in the case of no-bridge mode. Fixing this issue will make this library compatible with the RN New Architecture!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants