Share photo to Instagram from React-Native app built with Expo SDK

前端 未结 4 1404
南笙
南笙 2020-12-29 17:17

I want my react-native app to share a photo with Instagram. I know it\'s possible when writing in native code to open up Instagram\'s filter screen with a specified photo.

4条回答
  •  不思量自难忘°
    2020-12-29 17:28

    Here is how you post

    import { CameraRoll } from 'react-native'
    
    callThisFunction = async () => {
          await CameraRoll.saveToCameraRoll("https://images.unsplash.com/photo-1504807417934-b7fdec306bfd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80", 'photo');
          let instagramURL = `instagram://library?AssetPath=null`;
          Linking.openURL(instagramURL);
      }
    

提交回复
热议问题