facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

Error: Unsupported scheme for media Uri #664

Open LudinaReema opened 4 years ago

LudinaReema commented 4 years ago

Hi,

I am trying to share the (local uri) photo by using the react-native-fbsdk. I am able to share the link by using shareDialog. Not able to share the photo. I am getting the "Error: Unsupported scheme for media Uri" issue.

Here is my code: const photoUri = '../../res/assets/images/sample.png'; const sharePhotoContent = { contentType: 'photo', photos: [{ imageUrl: photoUri }] };

const tmp = this; ShareDialog.canShow(this.state.sharePhotoContent) .then(function(canShow) { if (canShow) { return ShareDialog.show(tmp.state.sharePhotoContent); } }) .then( function(result) { if (result.isCancelled) { console.log('Share cancelled'); } else { console.log(Share success with postId: ${result.postId}); } }, function(error) { console.log(Share fail with error: ${error}); } );

Is there any thing wrong with the sharePhotoContent object which contains the image uri?