alinz/react-native-share-extension

Changing jsBundleURLForBundleRoot has no effect at all

SirCameron opened this issue · 8 comments

I am trying to load the the js from a different entry file but changing the above in the share extension .m file has no effect.
Adding the entries for separate bundling in the plist file also have zero effect.

Currently I have:

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.share" fallbackResource:nil];

But when packaging for release, it is still loading from index.js, which is a problem because I'm using firebase and react-navigation, so it simply crashes.

How do I properly get it to use a different entry js file?

@ajith-ab dude, your lib doesn't even install properly. Please stop spamming these issues.

@alinz Could you help here?

@SirCameron in your shareExtension.m

  1. change the jsBundleURLForBundleRoot:@"index"
  2. In you main index file register your main app & extension(which points to its own component)
    like this:
    AppRegistry.registerComponent(MyApp', () => require('app/App').default);
    AppRegistry.registerComponent('MyShareX', () => require('./share').default);
    Note: Don't forget to link libraries which are there in the docs.
    Then it will work.

@kumbhar-ketan Thanks, but I wanted the share extension to run from its own JS entry.

@SirCameron in your shareExtension.m

change the jsBundleURLForBundleRoot:@"share"
In you share file register your extension(which points to its own component)
like this:
AppRegistry.registerComponent('MyShareX', () => require('./share').default);
This will work.

@kumbhar-ketan thanks, it will not work if your entry file is using dependencies like react-navigation or firebase that are not installed in your share extension target. That's why it's easier to have the share extension use a different JS entry. I explain how to pull that off in another issue.

But, here I was hoping the maintainers of this package could fix this issue to make that easier.

@SirCameron The thing you are talking like "it will not run if react-navigation & firebase is there". FYI I have implemented that with firebase & react-navigation. Please read the documentation clearly then you will get the idea.