Mohammed
Mohammed

Reputation: 352

Share to React-Native

I am trying to have apps on the android device to share to my react-native app. However, I can't find any documentation which can help me so I was wondering if there any way to share content from other apps to my app?

Clarification: enter image description here

I am trying to add my app to this list

Upvotes: 3

Views: 544

Answers (1)

Hesham Yassin
Hesham Yassin

Reputation: 4431

You need Allowing Other Apps to Start Your Activity. reference here.

<intent-filter  android:label="Share here!">
              <action android:name="android.intent.action.SEND" />
              <category android:name="android.intent.category.DEFAULT" />
              <data android:mimeType="text/*" />
</intent-filter>

As you may notice, This Witchcraft will show your app on the Sharing list.

In order to handle the burden, place the next snippet in your component. Any component.

componentDidMount() {
        Linking.getInitialURL().then((url) => {
            console.log('Initial url is: ' + url);
        }).catch(err => console.error('An error occurred', err));
    }

This charm is called Linking. Documentation found here

Upvotes: 1

Related Questions