alinz / react-native-share-extension

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

Working version of sample code #135

Open AndrewHenderson opened 5 years ago

AndrewHenderson commented 5 years ago

Created a working version of the sample code.

Android works out of the box.

iOS still requires the necessary additional steps to set up.

isaachinman commented 5 years ago

What's the difference now between examples/simple and examples/Sample1?

AndrewHenderson commented 5 years ago

@isaachinman I renamed it “simple” since it is React Native boilerplate with the simplest possible implementation of the share extension. I thought, if we add more complex demos in the future, we can use descriptive names rather than SampleN.

mtzfactory commented 5 years ago

Hi @AndrewHenderson , I just downloaded your pull request, but it doesn't work as expected, although it works, it doesn't behave like the example in the documentation

Here is your simple example running in my phone (Xiaomi A2, Android 9): share_extension_android

I modified the modal-box properties to start from bottom and specifying a height but I always have the same result... I can't see the backdrop and is always full screen...

Is it working properly for you?

Best regards.

mtzfactory commented 5 years ago

Hi, finally I made it work. I noticed that you changed the Modal component from react-native-modalbox to the native one in react-native.

After changing back to react-native-modalbox and adding the property coverScreen={ true } it works as expected in the documentation image.

braincore commented 4 years ago

Another change I had to make for a fresh RN project was in styles.xml. The parent attributes need to be to a AppCompat theme. For example:

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

    <style name="Theme.Share.Transparent" parent="Theme.AppCompat.Light">
        <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:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="android:windowAnimationStyle">@style/Share.Window</item>
    </style>