我希望我的本机应用程序与Instagram共享照片.我知道用本机代码编写打开带有指定照片的Instagram过滤器屏幕是可能的.一个限制是我正在使用Expo SDK,它不允许'npm link'用于本机依赖项.
调用此函数时,它将打开Instagram:
_handlePress = () => {
Linking.openURL('instagram://app');
}
Run Code Online (Sandbox Code Playgroud)
这是按钮:
<Button
onPress={this._handlePress}
title='Open Instagram'
/>
Run Code Online (Sandbox Code Playgroud)
图像存储在以下状态:
state = {
image: null,
uploading: false
}
Run Code Online (Sandbox Code Playgroud)
我可以在Image标签中显示图像就好了:
<Image
source={{uri: image}}
style={{width: 300, height: 300}}
/>
Run Code Online (Sandbox Code Playgroud)
但是,我无法将图像传递给Instagram.以下是一些失败的研究:第三方库:react-native-instagram-share:https://www.instagram.com/developer/mobile-sharing/iphone-hooks/
因为我不能使用'link'来使用本机依赖项.我正在使用Expo SDK,它不允许"链接"用于本机依赖项.
Instagram文档解释了如何打开Instagram,并且传递图像可以使用本机代码完成.其中,是使用"UIDocumentInteractionController",这在JavaScript中不可用.
https://www.instagram.com/developer/mobile-sharing/iphone-hooks/
我的问题没有任何其他Stackoverflow答案.