alinz / react-native-share-extension

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

Not working with React Native 0.60.5 #180

Closed ketanvault closed 4 years ago

ketanvault commented 5 years ago

Not working with React Native 0.60.5. Followed each & every step as there in the docs. Please help me to resolve this.

jeffelector commented 5 years ago

same case in here

ketanvault commented 5 years ago

@alinz Please try to reply ASAP. I have to resolve this as it is required urgently.

kumbhar-ketan commented 5 years ago

Hey @alinz, I have the same problem. Please try to fix this ASAP.

kumbhar-ketan commented 5 years ago

Hey @alinz, are you going to reply this ? I'm stuck at a point or else please suggest me another package.

jeffelector commented 5 years ago

Hey @alinz, are you going to reply this ? I'm stuck at a point or else please suggest me another package.

https://github.com/ajith-ab/react-native-file-share-intent try this one.

kumbhar-ketan commented 5 years ago

@jeffelector is it doing all the sharing operations like sharing links, text, photos & videos ?

jeffelector commented 5 years ago

Adds the application to the share intent of the device, so it can be launched from other apps and receive data from them

this is from the documentation ..for me it work just fine i manage to pass string ,but for photo i am not sure.. i know it can be pass as uri to the photo and then you can make something with it .

kumbhar-ketan commented 5 years ago

@jeffelector Thanks for the information.

tarang8811 commented 5 years ago

Hello any updates on this? My share extension is not working after upgrading to 0.60.5. It runs fine on android but does not work in iOS

AkshayP8140 commented 5 years ago

Hello any updates on this? My share extension is not working after upgrading to 0.60.5. It runs fine on android but does not work in iOS

I also get this issue it not working in 0.60.5^ for iOS I got this error --> 'React/RCTBridge.h' file not found

kumbhar-ketan commented 5 years ago

Hey @tarang8811 & @AkshayP8140 Please add the libraries which are specified in documentation using add libraries to your Share Extension project. This library is not a pod specific. So have to add/link the libraries. Please read the document clearly about how to add libraries. I have done it in my project which is on React 0.60.5.

AkshayP8140 commented 5 years ago

@kumbhar-ketan I make my project with this step https://github.com/alinz/react-native-share-extension/issues/182#issuecomment-534993812

so, After perform all that step I can run the project or extension but I not get my main page when I click on the extension

kumbhar-ketan commented 5 years ago

@AkshayP8140 Can you post your maindelegate file which you are using in share extension. Also post a share component which you are using to display UI on clicking of the share extension.

AkshayP8140 commented 5 years ago

@AkshayP8140 Can you post your maindelegate file which you are using in share extension. Also post a share component which you are using to display UI on clicking of the share extension.

MyShareEx.m

#import <Foundation/Foundation.h>
#import "ReactNativeShareExtension.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLog.h>

@interface MyShareEx : ReactNativeShareExtension
@end

@implementation MyShareEx

RCT_EXPORT_MODULE();

- (UIView*) shareView {
  NSURL *jsCodeLocation;

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

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"MyShareEx"
                                               initialProperties:nil
                                                   launchOptions:nil];
  rootView.backgroundColor = nil;

  // Uncomment for console output in Xcode console for release mode on device:
  // RCTSetLogThreshold(RCTLogLevelInfo - 1);

  return rootView;
}

@end

index.js

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import Share_file from './Components/Share';

AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent('MyShareEx', () => Share_file);
kumbhar-ketan commented 5 years ago

@AkshayP8140 this is wrong. You can't open same intent twice. You must change the default entry file of your share extension to other file. Like In MyShareX.m file replace index by your js filename. In your case it is './Components/Share'

AkshayP8140 commented 5 years ago

@kumbhar-ketan like this

import {AppRegistry} from 'react-native';
import Share_file from './Components/Share';

AppRegistry.registerComponent('MyShareEx', () => Share_file);
kumbhar-ketan commented 5 years ago

No. You must register it in index js but you must set the entry point which you used to register it. Ex. import {AppRegistry} from 'react-native'; import App from './App'; import {name as appName} from './app.json'; import Share_file from './Share';

AppRegistry.registerComponent(appName, () => App); AppRegistry.registerComponent('MyShareEx', () => Share_file);

Now change in your MyShareX.m file - @'index' => @'Share'

AkshayP8140 commented 5 years ago

@kumbhar-ketan I change but not working

https://github.com/alinz/react-native-share-extension/issues/180#issuecomment-544832872 This is working in emulator but it not work in the device

I think it because of bundler issues When I Run in Device In Xcode give this type pf console when I click on Extention

"Make sure you're running a packager server or have included a .jsbundle file in your application bundle."

ajith-ab commented 4 years ago

i ve used this package with all new features with react native greater than 0.60 support react-native-receive-sharing-intent

ketanvault commented 4 years ago

@ajith-ab react-native-share-extension It works on latest react-native 0.62.2 version though. so I don't think I need what you suggest in every ticket of this package.