alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
762 stars 396 forks source link

Reuse RCTBridge for the share view. Fixes #64 #144

Open rbscott opened 5 years ago

rbscott commented 5 years ago

I think this is the general idea for fixing memory issues inside of the share view. This still needs to be tested. I didn't see instructions for running react-native-share-extension independently for testing, so I am putting together a mini project to verify this works.

As implemented, this should be backwards compatible.

mtzfactory commented 5 years ago

Hi,

Do you have an example for newer React Native versions (0.59.x)?

I'm using react-native v0.59.5 and I see that the AppDelegate.m file has changed the way the view is created:

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"appName"
                                            initialProperties:nil];

In previous versions was:

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"appName"
                                                 initialProperties:nil
                                                   launchOptions:launchOptions];

Should the share extension use the same coding to create the view?

aschenkel commented 2 years ago

hey @mtzfactory by any chance could u test this or recall an alternative to it? I know its been a while