Skip to main content
ShareContent represents the different types of content that can be shared through the Facebook Share Dialog. There are three main content types: links, photos, and videos.

Types

ShareContent

type ShareContent =
  | ShareLinkContent
  | SharePhotoContent
  | ShareVideoContent;

ShareLinkContent

A model for status and link content to be shared.
type ShareLinkContent = {
  contentType: 'link';
  commonParameters?: ShareContentCommonParameters;
  contentUrl: string;
  contentDescription?: string; // Deprecated from Graph API 2.9
  contentTitle?: string; // Deprecated from Graph API 2.9
  imageUrl?: string; // Deprecated from Graph API 2.9
  quote?: string;
};
contentType
'link'
required
Must be set to 'link' to indicate this is link content.
contentUrl
string
required
URL for the content being shared.
commonParameters
ShareContentCommonParameters
Common sharing parameters like hashtag, people tags, and place ID.
quote
string
A predefined quote to attach to this share. If specified, the quote text will render with custom styling on top of the link.
contentDescription
string
The description of the link. If not specified, this field is automatically populated by information scraped from the contentUrl.Deprecated: This field is deprecated from Graph API 2.9. See Facebook’s changelog.
contentTitle
string
The title to display for this link.Deprecated: This field is deprecated from Graph API 2.9. See Facebook’s changelog.
imageUrl
string
The URL of a picture to attach to this share.Deprecated: This field is deprecated from Graph API 2.9. See Facebook’s changelog.

Example

import ShareDialog from 'react-native-fbsdk-next';

const linkContent = {
  contentType: 'link',
  contentUrl: 'https://example.com',
  quote: 'Check out this awesome website!',
  commonParameters: {
    hashtag: '#MyApp',
  },
};

await ShareDialog.show(linkContent);

SharePhotoContent

A model for photo content to be shared.
type SharePhotoContent = {
  contentType: 'photo';
  commonParameters?: ShareContentCommonParameters;
  contentUrl?: string;
  photos: Array<SharePhoto>;
};
contentType
'photo'
required
Must be set to 'photo' to indicate this is photo content.
photos
Array<SharePhoto>
required
Array of photos to be shared. Each photo must be a local file URL when using ShareButton.
commonParameters
ShareContentCommonParameters
Common sharing parameters like hashtag, people tags, and place ID.
contentUrl
string
URL for the content being shared.

SharePhoto

type SharePhoto = {
  imageUrl: string;
  userGenerated?: boolean;
  caption?: string;
};
imageUrl
string
required
The URL to the photo. When sharing with ShareButton, this must be a local file URI (e.g., file:///path/to/photo.jpg), not a web URL.
userGenerated
boolean
Specifies whether the photo was generated by the user or the application.
caption
string
User-generated caption for the photo. The caption must come from the user, as pre-filled content is forbidden by Facebook Platform Policies (2.3).

Example

import ShareDialog from 'react-native-fbsdk-next';

const photoContent = {
  contentType: 'photo',
  photos: [
    {
      imageUrl: 'file:///path/to/photo.jpg',
      caption: 'My awesome photo',
      userGenerated: true,
    },
  ],
  commonParameters: {
    hashtag: '#Photography',
  },
};

await ShareDialog.show(photoContent);

ShareVideoContent

A model for video content to be shared.
type ShareVideoContent = {
  contentType: 'video';
  commonParameters?: ShareContentCommonParameters;
  contentUrl?: string;
  video: ShareVideo;
  contentDescription?: string;
  contentTitle?: string;
  previewPhoto?: SharePhoto;
};
contentType
'video'
required
Must be set to 'video' to indicate this is video content.
video
ShareVideo
required
The video to be shared.
commonParameters
ShareContentCommonParameters
Common sharing parameters like hashtag, people tags, and place ID.
contentUrl
string
URL for the content being shared.
contentDescription
string
Description of the video.
contentTitle
string
Title of the video.
previewPhoto
SharePhoto
The photo that represents the video (thumbnail).

ShareVideo

type ShareVideo = {
  localUrl: string;
};
localUrl
string
required
The URL to the video. Must point to the location of the video on disk (e.g., file:///path/to/video.mp4).

Example

import ShareDialog from 'react-native-fbsdk-next';

const videoContent = {
  contentType: 'video',
  video: {
    localUrl: 'file:///path/to/video.mp4',
  },
  contentTitle: 'My Amazing Video',
  contentDescription: 'Check out this video I created!',
  previewPhoto: {
    imageUrl: 'file:///path/to/thumbnail.jpg',
  },
  commonParameters: {
    hashtag: '#Video',
  },
};

await ShareDialog.show(videoContent);

ShareContentCommonParameters

Common parameters that can be used with all share content types.
type ShareContentCommonParameters = {
  peopleIds?: Array<string>;
  placeId?: string;
  ref?: string;
  hashtag?: string;
};
peopleIds
Array<string>
List of IDs for taggable people to tag with this content.
placeId
string
The ID for a place to tag with this content.
ref
string
A value to be added to the referrer URL when a person follows a link from this shared content on feed.
hashtag
string
A hashtag to be added to the share interface. The hashtag must be 32 characters or less.

Example

const commonParameters = {
  hashtag: '#MyApp',
  placeId: '123456789',
  peopleIds: ['987654321', '456789123'],
  ref: 'my-campaign',
};

const shareContent = {
  contentType: 'link',
  contentUrl: 'https://example.com',
  commonParameters,
};

Build docs developers (and LLMs) love