我希望我的 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 答案。