alinz / react-native-share-extension

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

Release Mode: Extension crashes when sharing from Photos on iOS #97

Closed AndrewHenderson closed 6 years ago

AndrewHenderson commented 6 years ago

I have been able to get everything working perfectly in Debug mode. However, when I change to Release mode, the extension crashes immediately upon launching from the Photos app on iPhone.

I have two separate index files - one for my main app and one for my share extension. I tried using the same index file for registering both apps, but the extension would not launch, even in Debug mode. Separating the code and running a very light RN app in the extension index seemed to fix things.

AndrewHenderson commented 6 years ago

I found that in order to get the app running in Release Mode, I had to register both my App and the Share Extension App in the same index.js file:

import React from 'react'
import { AppRegistry } from 'react-native'

import App from './app'
import Share from './share'

AppRegistry.registerComponent('App', () => App)
AppRegistry.registerComponent('ShareExt', () => Share)