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

Possible to start without rootView

Open guns2410 opened this issue 8 years ago • 3 comments

Looking at the code, it seems that RNWorkers require bridge from the rootView.

It is possible to have another start function that accepts the bridge as the parameter. Possibly like:

- (void) startWorkersWithBridge: (RCTBridge *) bridge
{
  mainBridge = bridge;
  if([simulationEnabled boolValue] == YES){
    [self fillDictionaryWithMainBridge];
  }
}

My Objective C skills are not so good. So please excuse me if there seems to be something silly here 😬

guns2410 avatar Jun 14 '17 12:06 guns2410

Are you planing to communicate between workers directly ?

Yes, it is possible, I only use the mainBridge because I need it to forward messages from worker bridge to main bridge.

But to have the same behavior on Android probably it will be a little painful.

fabriciovergara avatar Jun 14 '17 12:06 fabriciovergara

I need it because I am using wix/react-native-navigation which does not have a root View. So my best bet was if it was possible to use it with bridge since it only uses mainBridge of rootView.

guns2410 avatar Jun 14 '17 13:06 guns2410

@guns2410 Same one here. Did you manage to get it working? I used this but it either hangs at the splash screen or it doesn't start the workers depending on if [[RNWorkersManager sharedInstance] initWorkerWithPort:8083 bundleRoot:@"index.worker" fallbackResouce:@"worker"]; is placed before or after [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];

Techwolf12 avatar Oct 10 '17 13:10 Techwolf12