【发布时间】:2016-08-31 20:54:24
【问题描述】:
我正在尝试通过 react-native-fbsdk 包在 React Native 中将图像分享到 Facebook。
我有以下内容,几乎完全是从文档中复制的,但我不知道如何格式化 imageUrl,我一直收到错误消息说 SharingContent is invalid。
我在这里做错了什么?
const sharePhotoContent = {
contentType: 'photo',
photos: [
{
imageUrl: "./local/image/path.png",
userGenerated: false,
caption: "Hello World"
}
]
};
ShareDialog.canShow(sharePhotoContent).then(
function(canShow) {
if (canShow) {
return ShareDialog.show(sharePhotoContent);
}
}
).then(
function(result) {
if (result.isCancelled) {
AlertIOS.alert('Share cancelled');
} else {
AlertIOS.alert('Share success with postId: ' + result.postId);
}
},
function(error) {
AlertIOS.alert('Share fail with error: ' + error);
}
);
【问题讨论】:
-
我知道已经有一段时间了,但我想知道你是否找到了一种方法来做到这一点(在你的项目中为 .png 构建一个 url 并与 react-native-fbsdk 共享它,那是)?谢谢
-
没有。我从来没有弄明白。
-
感谢您回复我,是的,您会认为 Facebook 会让其中的一些内容更加透明,因为 RN 是他们的宝贝。哦,好吧
标签: facebook react-native react-native-fbsdk