I’m trying to share a photo to Instagram with the following code:
Linking.openUrl(‘instagram://app’);
This will open the Instagram app, but I need to have Instagram open with my photo in its filter screen. There is documentation on how to do this with Objective-C, but not with React-Native.
Here is the link: Instagram Platform - Documentation - Facebook for Developers
The explanation points to native code. How do I did it in JavaScript?
Document Interaction
If your application creates photos and you’d like your users to share these photos using Instagram, you can use the Document Interaction API to open your photo in Instagram’s sharing flow.
You must first save your file in PNG or JPEG (preferred) format and use the filename extension “.ig”. Using the iOS Document Interaction APIs you can trigger the photo to be opened by Instagram. The Identifier for our Document Interaction UTI is com.instagram.photo, and it conforms to the public/jpeg and public/png UTIs. See the Apple documentation articles: Previewing and Opening Files and the UIDocumentInteractionController Class Reference for more information.
Alternatively, if you want to show only Instagram in the application list (instead of Instagram plus any other public/jpeg-conforming apps) you can specify the extension class igo, which is of type com.instagram.exclusivegram.
When triggered, Instagram will immediately present the user with our filter screen. The image is preloaded and sized appropriately for Instagram. For best results, Instagram prefers opening a JPEG that is 640px by 640px square. If the image is larger, it will be resized dynamically.