react-native-share: Facebook iOS not working

Steps to reproduce

  1. Use shareSingle

This is what I am doing:

const shareOptions = {
      url: picture.uri, // <<<< dynamic
      social: social === 'instagram' ? Share.Social.INSTAGRAM : Share.Social.FACEBOOK,
    };

    Share.shareSingle(shareOptions)
      .then((res) => { console.log(res); })
      .catch((err) => { err && console.log(err); });

Expected behaviour

Open the Facebook app to share the image.

Actual behaviour

Safari will open and I have the following image: href should represent a valid URL. The console.log of the promise tells me that the application is not installed (instead it is installed). screenshot 2018-10-17 at 17 44 58

Environment

  • React Native version: 0.57.1
  • React Native platform + platform version: iOS 12

react-native-share

Version: master (1.1.2)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 19 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Experiencing the same issue. Instagram is working fine but facebook just opens up facebook.com on Safari with the following error href should represent a valid URL.

Here’s the code:

Share.shareSingle({
  url: asset.assetUri,
  social: Share.Social.FACEBOOK,
});

and I do have facebook in LSApplicationQueriesSchemes:

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>instagram-stories</string>
		<string>instagram</string>
		<string>facebook</string>
		<string>whatsapp</string>
		<string>message</string>
        ...

EDIT: Ok actually the issue is only with the doc 🙂, the query scheme for facebook is not facebook but fb, so just add fb to your LSApplicationQueriesSchemes array and it’s going to work just fine!

You can use Linking.canOpenURL('fb://') to detect if it’s installed or not

under share button function you can use facebook share function very easy and its work on IOS facebook link: https://developers.facebook.com/docs/react-native/sharing/ sample: <Button iconSrc={{ uri: FACEBOOK_ICON }} onPress={()=>{ ShareDialog.canShow(shareLinkContent).then( function(canShow) { if (canShow) { return ShareDialog.show(shareLinkContent); } } ) }}>Facebook</Button>

@jgcmarins With the latest version of Instagram v68 release today (22 oct) seems working again on iOS. Facebook still not working

could you try master version? ----> Yes could you provide a repo to reproduce? ----> Yes, have to create a small project for it. I’ll do ASAP.