alinz / react-native-share-extension

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

Sharing not works on Android #150

Closed phoneixkwok closed 5 years ago

phoneixkwok commented 5 years ago

I followed the guide in README.md to setup "react-native-share-extension" on Android.

And some changes are made due to compilation error and android version changed

ShareApplication.java

// protected boolean getUseDeveloperSupport() // from the guide
public boolean getUseDeveloperSupport()

values/styles.xml

...
//<style name="Share.Window" parent="android:Theme"> // from the guide
<style name="Share.Window" parent="Theme.AppCompat">
...
//<style name="Theme.Share.Transparent" parent="android:Theme">
<style name="Theme.Share.Transparent" parent="Theme.AppCompat">
...

And I added share.android.js to my project


Finally, the app is able to run. And "MyShareEx" is able to shown in the "Share List" When I choose to share via "MyShareEx", the screen shown is not as expected. It shown a transparent screen with title "MyShareEx" at the center.

image


It seems that the "share.android.js" is not showing.

Can anyone help me with this? Thanks.


"react-native": "0.59.5", "react-native-modalbox": "^1.7.1", "react-native-share-extension": "^1.2.1"

Android Emulator SDK version: 7.0

phoneixkwok commented 5 years ago

Works after removing the following line from styles.xml

<item name="android:windowIsFloating">true</item>

Complete styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="Share.Window" parent="Theme.AppCompat">
        <item name="android:windowEnterAnimation">@null</item>
        <item name="android:windowExitAnimation">@null</item>
    </style>

    <style name="Theme.Share.Transparent" parent="Theme.AppCompat">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:windowAnimationStyle">@style/Share.Window</item>
    </style>
</resources>

image

phuoc-insignia commented 4 years ago

@phoneixkwok You saved my day. My app crashed on android without any logs