【发布时间】:2017-11-19 21:07:37
【问题描述】:
我希望我的 react-native 应用与 Instagram 分享照片。我知道在编写本机代码时可以使用指定的照片打开 Instagram 的过滤器屏幕。一个限制是我使用的是 Expo SDK,它不允许对本机依赖项使用“npm link”。
调用此函数时,会打开 Instagram:
_handlePress = () => {
Linking.openURL('instagram://app');
}
这是按钮:
<Button
onPress={this._handlePress}
title='Open Instagram'
/>
图像存储的状态:
state = {
image: null,
uploading: false
}
我可以在 Image 标签中显示图片就好了:
<Image
source={{uri: image}}
style={{width: 300, height: 300}}
/>
但是,我无法将图像传递给 Instagram。以下是一些失败的研究: 第三方库: react-native-instagram-share: https://www.instagram.com/developer/mobile-sharing/iphone-hooks/
因为我不能使用“链接”来使用本机依赖项。我正在使用 Expo SDK,它不允许本地依赖项的“链接”。
Instagram 文档解释了如何打开 Instagram,并且可以使用本机代码来传递图像。即使用“UIDocumentInteractionController”,这在 JavaScript 中是不可用的。
https://www.instagram.com/developer/mobile-sharing/iphone-hooks/
我的问题没有任何其他 Stackoverflow 答案。
【问题讨论】:
-
我认为 Share API 不能专门针对 Instagram。
标签: react-native instagram expo