alinz / react-native-share-extension

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

share extension crashes in release mode when trying to share a link form Safari #83

Open i25878427 opened 6 years ago

i25878427 commented 6 years ago

Hi,

Thanks for this amazing lib.

The share extension works perfectly on my simulator and on my device in debug but when I release a version using fabric to my device the app extension crashes immediately when trying to share a link form Safari.

*I can see a flickering when trying to share and after a few millisecond it disappears.

Any idea what might be causing this issue? (I am also using app group to share data between my app and the share extension)

I tried to Crashlytics in order to debug this issue but I couldn't find Crashlytics lib in the "Link Binary With Libraries" of the share extension

Thanks,

i25878427 commented 6 years ago

The solution for my problem was having the same file as an entry point (app and share extension). Also I had to use require for the AppRegistry.registerComponent

ericlewis commented 6 years ago

@i25878427 by entry point you mean bundle right? and by require, you mean instead of import?

i25878427 commented 6 years ago

@ericlewis - entrypoint- for eample: index.js (make sure that native code is pointing to this file) will be used for both the app and the extension. In the index.js use require instead of import, for example- AppRegistry.registerComponent('ShareApp', () => require('./shareApp').default) AppRegistry.registerComponent('MyApp', () => require('./myApp').default)

ericlewis commented 6 years ago

Thank you.

Sent from my iPhone

On Mar 13, 2018, at 11:47 PM, Roy Goren notifications@github.com wrote:

@ericlewis - entrypoint- for eample: index.js (make sure that native code is pointing to this file) will be used for both the app and the extension. In the index.js use require instead of import, for example- AppRegistry.registerComponent('ShareApp', () => require('./shareApp').default) AppRegistry.registerComponent('MyApp', () => require('./myApp').default)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

AndrewHenderson commented 6 years ago

@i25878427 I'm experiencing this issue as well. However, separating the two entry points is the only way I can get my extension to work in Debug mode. If I register both the app and the extension on the same index file, the extension ceases to work.

That said, I still can't get it working in Release mode no matter what I do.

i25878427 commented 6 years ago

@AndrewHenderson- did you try the solution I suggested above? did it work for you in release mode?

camjw commented 4 years ago

@ericlewis - entrypoint- for eample: index.js (make sure that native code is pointing to this file) will be used for both the app and the extension. In the index.js use require instead of import, for example- AppRegistry.registerComponent('ShareApp', () => require('./shareApp').default) AppRegistry.registerComponent('MyApp', () => require('./myApp').default)

Thanks for this, spent quite a while trying to figure this out