【问题标题】:Save and share image from project's assets in React Native在 React Native 中保存和共享项目资产中的图像
【发布时间】:2018-04-10 08:50:02
【问题描述】:

是否可以将来自项目资产文件夹的图像保存在图库中和/或使用 React Native 中的 Share api 共享它? 如果没有,是否可以在 Android 和 iOS 中本地实现?

【问题讨论】:

    标签: android ios react-native save share


    【解决方案1】:

    我建议你使用react-native-share库,因为React Native的共享库功能有限,url共享只支持IOS

    Here 是可用的有用方法

    • url你要分享的 URL(你只能在 iOS 和 Android 中分享 base64 文件 url// You need this one.

    您可以直接通过base64file url分享

    这个例子用起来真的很简单

    let shareImageBase64 = {
      title: "React Native",
      message: "Hola mundo",
      url: REACT_ICON,
      subject: "Share Link" //  for email
    };
    
    Share.open(shareImageBase64)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-31
      • 1970-01-01
      • 2022-12-04
      • 2015-10-16
      • 2012-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多