Share URL to facebook on Android

How to share text & url to facebook on Android? React Native allows us to share url on iOS but not for Android. Please help!

Here it is :wink:

I did it for both system and the doc says:

> Open a dialog to share text content.

> In iOS, Returns a Promise which will be invoked an object containing action, activityType. If the user dismissed the dialog, the Promise will still be resolved with action being Share.dismissedAction and all the other keys being undefined.

> In Android, Returns a Promise which always be resolved with action being Share.sharedAction.

How did you get it to work on Android? Only works on iOS for me as well.

I actually didn’t test on IOS by myself (I need a macbook :sweat_smile:), but it seems to works on both system.
I did like this:

import React, { Component } from 'react';
import {
} from 'react-native';
import { Icon } from 'react-native-elements';

class SharingItem extends Component {

  onClick() {
        ios: {
          message: 'Have a look on : ',
          url: this.props.url,
        android: {
          message: 'Have a look on : \n' + this.props.url
      title: 'Wow, did you see that?'
    }, {{
        ios: {
          // iOS only:
          excludedActivityTypes: [
        android: {
          // Android only:
          dialogTitle: 'Share : ' + this.props.title

  render() {
    return (
          onPress={() => { this.onClick(); }}

export default SharingItem;

Ahh, i see now the URL attribute only works on ios.


Cool if it’s helped you :slightly_smiling_face:

Cheers :wink:

I worked now, thanks a lot!

1 Like

Cool, happy that’s helped you :wink:

Can you help me with, coding share message in such a way that the whatsapp will render the image and title and message.
For example.

Note: I don’t have dynamic detail page like github

This topic was automatically closed after 14 days. New replies are no longer allowed.